Crypto fair-value pricing from DEX trades
What is fair-value pricing from DEX trades?
Fair-value pricing from DEX trades is using swaps on decentralized exchanges (DEXs, where trades settle onchain against a pool of tokens) as inputs to accounting marks: prices at a set time such as the end-of-day close, and volume-weighted average prices (VWAP) used to check them.
Asset managers, index providers and custodian banks need it for tokens that trade mostly or partly onchain, because a fair-value mark is taken from the asset’s principal market, and for some tokens that market is a DEX.
Goldsky decodes each trade in the pools you choose and writes it to your warehouse next to your exchange data; your team builds the windows and closes and sets the mark under your valuation policy.
Who uses fair-value pricing from DEX trades?
Asset managers, index and benchmark providers, and custodian banks that value tokens traded on decentralized exchanges.
How fair-value pricing from DEX trades works
The diagram follows one price from the swaps that settle in a pool to the fair-value mark your valuation policy sets, and shows who does each step. Your setup may differ.
Choose the pools you price from
A token can trade in many pools, and only some of them are deep and active enough to price from.
List each pool by DEX, chain and token pair, with a reason for including it. Pricing from a thin pool lets a single small trade move your mark.
Settle trades in the pool
Each swap on a DEX settles onchain, and that record is the trade price evidence.
A swap trades one token for another against the pool and is recorded in a block with the amounts on each side. The newest blocks can still be replaced, so a trade seen once isn’t final yet.
Decode each trade
Handled by Goldsky TurboThe chain stores swaps in an encoded form, and pricing needs the pool, the amounts and the time.
Decode each swap into the pool, the amount of each token and the block time, then derive the price from the amounts and each token’s decimals. A wrong decimal count makes every price in the series wrong by a power of ten.
With Goldsky, a Turbo pipeline can filter raw logs to
Decode logs with an ABI (opens in a new tab)Swapevents by their first topic and decode them with the pool’s ABI, keeping the amounts, pool and transaction hash for every trade.Write every trade to your warehouse
Handled by Goldsky TurboMarks are built from history and checked against other venues, so the trades belong next to your exchange data.
Load past trades first, then each new one as it settles, keyed so that a retried write doesn’t count a trade twice. A duplicated trade inflates volume and pulls the VWAP towards its price.
Turbo Pipelines writes each trade to your warehouse or database keyed on the event’s
How delivery and reorgs work (opens in a new tab)id; keyed tables take reorg corrections as updates and deletes, and file loads get correction records to apply.Build VWAPs and closes
A single trade is a noisy price, so a mark is usually a price at a set time, such as the close, checked against an average over a window.
In your warehouse, group trades by window and venue, weight them by volume and convert each to USD with your reference rates. Decide in advance how to treat outlier trades, so the method doesn’t change after you’ve seen the result.
Set the fair-value mark
Fair value is taken from the market where the asset mostly trades, and your policy has to say which one that is.
Your valuation policy picks the principal market for each token and the mark taken from it, and records why. A mark with no documented choice of market is the first thing auditors question.
What you control
- Your team
- Choose the pools you price from
- Build VWAPs and closes
- Set the fair-value mark
Security and deployment
- SOC 2 Type IIIndependently audited security controls.
- Dedicated infrastructureSingle-tenant options for production workloads.
- Data residencyCloud, on-premises or co-located.
More use cases that report on onchain activity
- Form 1099-DA data for brokersSupply the transfer history and USD values behind each customer’s Form 1099-DA.
- DAC8 and CARF reporting dataSupply the valued transfer history behind each user’s yearly DAC8 or CARF report.
- Onchain data for finance and BI reportingLoad onchain activity into the warehouse so finance and BI teams can report on it.
- DeFi accounting for positions and vaultsBook accrued rewards, vault shares and lending positions across DeFi protocols at period end.
- Digital asset audit evidenceGive auditors each wallet’s balance at the year-end cut-off block and the year’s transfers.
Use cases built the same way
- Protocol financial statements from chain dataBuild income statements (fees, revenue and costs) for chains and apps from their contracts.
- Daily stablecoin supply by chain for PS-01 reportsKeep the daily per-chain supply, issued, redeemed, issuer-held, frozen and lost figures that feed the weekly OCC PS-01 report.
- Supply data for stablecoin issuance platformsGive an issuance platform one view of supply across every coin and chain it runs.
- Stablecoin depeg and manipulation alertsAlert the issuer when its coin trades off peg in its own pools or pool activity looks like manipulation, on every chain it runs on.
Price crypto at fair value from DEX trades 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.