Currency Cube
What it is
The Currency cube gives one chain-agnostic USD price per asset. Bitcoin is one currency, bid:bitcoin, blended from WBTC, cbBTC and its other bridged or wrapped forms across every supported chain.
Use it when you want one global number for an asset like BTC or ETH. For the price of a specific token on a specific market, use the Pairs cube with Ranking: { Position: { eq: 1 } }.
How to get it
Query or subscribe to Trading.Currencies. Filters that matter:
- Currency:
Currency: { Id: { is: "bid:bitcoin" } }. Ids are lowercase symbols for listed currencies (usdc,dai,aave,arb) andbid:<chain>:<address>for tokens that are their own currency. - Interval:
Interval: { Time: { Duration: { eq: 60 } } }. Durations are 1, 3, 5, 10, 30, 60, 300, 900, 1800 and 3600 seconds.
Ranking, RankingDetail and LeadingPool do not exist on Currencies. Liquidity and Supply do.
How it is derived
The index blends the asset's token representations into one series, weighting each by its liquidity share after the staleness discount. See How Currency Prices Are Determined.
Stablecoin currencies are priced from an external spot source, not from DEX trades. At currency level they carry Liquidity.Usd 0, Liquidity.Source "", RealShare 0 and Supply.MarketCap 0.
How OHLC is calculated
The OHLC values describe a single computed cross-chain index series over the interval. Within each interval the cube tracks the liquidity-weighted blend of the asset's token representations and records that blend's open, high, low and close:
- Open: the index value at the start of the interval.
- High: the highest value the index reached during the interval.
- Low: the lowest value the index reached during the interval.
- Close: the index value at the end of the interval.
High and Low are not the maximum and minimum of the per-chain prices. Because the index is a liquidity-weighted blend, an extreme print on a single chain, especially a thin one, is damped and may never reach the currency candle at all.
Individual chain representations can therefore sit outside the currency's High/Low band. If you are monitoring a depeg or a single-venue dislocation, query the constituents through Tokens filtered on Currency.Id instead.
Fields
| Field | Type | Meaning |
|---|---|---|
Currency { Id Name Symbol } | String | The asset. |
Block { Date Time Timestamp } | String / DateTime / String | Time of the last update in the interval. |
Interval { Time { Start End Duration } } | DateTime / DateTime / Int | The bar. Duration in seconds. |
Price.Ohlc { Open High Low Close } | Float | OHLC of the index series, above. |
Price.Average { Estimate Mean SimpleMoving WeightedSimpleMoving ExponentialMoving } | Float | Averages over the interval and a 5-entry moving window. Estimate is the valuation price. |
Price.IsQuotedInUsd | Boolean | true by default; prices are in USD. |
Volume.Base | Float | Asset amount traded across all representations and chains. |
Volume.Quote | Float | Sum of quote-token amounts. Not USD; use Volume.Usd. |
Volume.Usd | Float | Volume in USD. |
Volume.BaseAttributedToUsd | Float | Part of Volume.Base traded against quote tokens with a known USD price. |
Liquidity { Usd Source RealShare ... } | Float / String | USD liquidity summed over every token representation and chain in the blend. RealShare is the fraction backed by measured reserves; Source is the leading pool's. Per-pool reserve fields and UpdatedAt are not set here. See Liquidity fields. |
Supply { CirculatingSupply TotalSupply MaxSupply MarketCap FullyDilutedValuationUsd } | Float | Currency-level supply and valuation, the same figures as on Tokens and Pairs. See Supply fields reference. |
Examples
What is the latest cross-chain Bitcoin price?
{
Trading {
Currencies(
where: {
Currency: { Id: { is: "bid:bitcoin" } },
Interval: { Time: { Duration: { eq: 60 } } }
},
limit: { count: 1 },
orderBy: { descending: Block_Time }
) {
Currency {
Id
Name
Symbol
}
Block {
Date
Time
Timestamp
}
Interval {
Time {
Start
Duration
End
}
}
Volume {
Base
BaseAttributedToUsd
Quote # Sum of quote token amounts (not USD); use Usd for USD totals (see Price Index Algorithm)
Usd
}
Supply {
TotalSupply
FullyDilutedValuationUsd
MarketCap
}
Price {
IsQuotedInUsd #The price is shown in USD (`IsQuotedInUsd: true` by default).
Ohlc {
Open # Index value at the start of the interval
High # Highest index value in the interval
Low # Lowest index value in the interval
Close # Index value at the end of the interval
}
Average {
Estimate
ExponentialMoving
Mean
SimpleMoving
WeightedSimpleMoving
}
}
}
}
}
Price.Ohlc.Closeis the index price at the end of the latest minute.Supply.TotalSupplyis the on-chain wrapped supply, not Bitcoin's 19.9 M; see Bitcoin and on-chain supply.
Related
Ready to run this in production?
Get an API key and run these queries in minutes, or talk to us about plans and enterprise delivery.