Skip to main content

Perpetuals and DEX market data

What is perpetuals and DEX market data?

Perpetuals and DEX market data is the record of trades, prices, funding rates and candles from onchain perpetual futures exchanges and decentralized exchanges (DEXs), taken from the contracts where the trades settle.

Data vendors, index providers and prime brokers use it to give trading and research teams prices and volumes they can check against the chain.

Goldsky decodes each trade and funding event and publishes it to a queue you run as it settles; turning trades into candles and totals, and serving them to clients, stays with your team.

Who uses perpetuals and DEX market data?

Crypto market data vendors, index and benchmark providers, and prime brokers that give clients onchain prices next to exchange data.

How perpetuals and DEX market data gets from the chain to clients

The diagram follows one trade from the moment it settles onchain to the moment a client’s trading or research system queries it from your API. Your setup may differ.

Goldsky, step 2: TurboDecode trades and fundingPrice, size, side and funding events
Blockchains, step 1: Trade settlesA perp or DEX trade lands onchain
Your business, step 4: Build candles and totalsYour consumers roll trades into intervals
Goldsky, step 3: TurboPublish to your queueEach trade as it settles
Your business, step 5: Serve it to clientsTrading and research systems query your API
  • Goldsky

How to build a perpetuals and DEX market data feed

A pipeline decodes trade and funding events from the exchanges you cover and publishes each one to a Kafka topic you run as it settles. Your consumers build candles and totals from the topic and serve them through your own API.

What you’ll need

  • Goldsky Turbo
  • The contract addresses and ABIs of the exchanges you cover
  • A Kafka cluster, or a compatible message queue
  • Consumers that build candles and totals
  • A database and API that serve your clients
  1. Settle the trade onchain

    On onchain exchanges, every trade and every funding payment is recorded by the exchange’s contracts.

    A swap on a decentralized exchange (DEX) or a fill on a perpetual futures exchange emits an event with the market, price, size and side. Perpetuals also settle funding, the regular payment between long and short traders that keeps the contract price near the spot price.

  2. Decode trades and funding events

    Handled by Goldsky Turbo

    Raw events are encoded, so they have to be turned into prices, sizes and sides before anyone can use them.

    Each exchange’s events are decoded with its interface (ABI) into one consistent row, and every exchange you cover has to map to the same columns. An event left undecoded is a trade missing from your volume, and exchanges that differ by version need separate decoding.

    With Goldsky, a Turbo Pipelines SQL transform decodes raw logs with _gs_log_decode and the exchange’s ABI, so one pipeline can pick out Swap events from every pool on a chain.

    Stream DEX trades (opens in a new tab)
  3. Publish each trade to your queue

    Handled by Goldsky Turbo

    A queue lets several systems read the same trades as they settle, each at its own pace.

    Each trade is published once to a topic, keyed so that trades for one market arrive in order. Delivery is at least once, so consumers drop repeats by the trade’s ID.

    The Kafka sink publishes rows in Avro or JSON, uses your primary_key as the message key and keeps per-key order. Each message’s dbz.op header says whether the row is an insert, update or delete.

    Publish to Kafka (opens in a new tab)
  4. Build candles and totals

    Most clients want trades rolled into candles (open, high, low and close per interval), volumes and funding history.

    Your consumers group trades by market and interval and keep running totals. When the chain replaces recent blocks in a reorg, delete records arrive on the topic and the consumers have to take those trades back out of the candles they’ve already built.

  5. Serve the data to clients

    Trading and research systems read the data through an API or a file they can query.

    Your API serves candles, trades and funding from your own store, with each figure traceable to the transactions behind it. Mark recent intervals as provisional until their blocks are final, so clients know they can still change.

What you control

Your team
  • Build candles and totals
  • Serve the data to clients

Security and deployment

  • SOC 2 Type IIIndependently audited security controls.
  • Dedicated infrastructureSingle-tenant options for production workloads.
  • Data residencyCloud, on-premises or co-located.

Build a perpetuals and DEX market data feed with Goldsky

We’ll map it to your systems and show you what Goldsky runs, so your team builds the product, not the pipelines underneath it.

© Endless Sky Inc. All rights reserved.

PrivacyTermsSecurity

System status