Menu

Collecting funding rates from three exchange APIs with a Cloudflare Worker (and the 403 that placement fixed)
📰

Collecting funding rates from three exchange APIs with a Cloudflare Worker (and the 403 that placement fixed)

DEV Community: api·CoinPopBit·1 day ago
#QSQh6c4H
#devtoapi#devto#dev#venue#coin
Reading 0:00
15s threshold

This is a write-up of a small data collector: a Cloudflare Worker on an hourly cron that reads settled funding rates from the public APIs of OKX, Bybit and MEXC and stores them in D1. The code is about 100 lines. Most of the time went into two things that are not in any quick-start: the three APIs disagree on almost every field name, and two of them answered 403 from the Worker while answering 200 from a laptop.

What is being collected

Perpetual futures have a funding rate: a periodic payment between longs and shorts, usually settled every 8 hours. Each exchange publishes a predicted rate that changes until settlement, and a settled rate that is final.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.