Time Series
Examples | Type Definition
Time series objects represent data that changes over time. In Blocktap, time series data is comprised of statistics and metrics calculated using the raw data points.
A common example example is OHLCV "candle" data. These values are generated from raw trade data and aggregated by periods of time.
Blocktap supports time intervals of: _1m
, _5m
, _15m
, _30m
, _1h
, _2h
, _4h
, _1d
.
Blocktap has time series statstics for Asset
, Market
, and Exchange
data. Our time series functionality allows returning results for all of these types in unison. This means you can write a single query that combines market statistics and peer-to-peer statistics.
Time series must always be given an initial argument of resolution
which is the length of time that each object in the result set covers. For example, a simple query to retrieve price and volume data for a market:
Examples
Price data for single market
This example returns basic price data markets.
```graphql
query price {
timeseries(resolution: _1d, limit: 7, startDate: "2018-10-01") {
startDate
markets(filter: {
exchangeSymbol:{ _in:["Binance", "HitBTC" ]}
baseSymbol: { _eq: "BTC" },
quoteSymbol: { _eq: "USDT" } }
) {
exchangeSymbol
openPrice
baseVolume
}
}
}
{
"data": {
"timeseries": [
{
"startDate": "2018-10-07T00:00:00.000Z",
"markets": [
{
"exchangeSymbol": "Binance",
"openPrice": "6596.44000000",
"baseVolume": "17406.83176200"
},
{
"exchangeSymbol": "HitBTC",
"openPrice": "6595.47000000",
"baseVolume": "8787.13000000"
}
]
},
{
"startDate": "2018-10-06T00:00:00.000Z",
"markets": [
{
"exchangeSymbol": "Binance",
"openPrice": "6635.65000000",
"baseVolume": "10939.50539100"
},
{
"exchangeSymbol": "HitBTC",
"openPrice": "6627.73000000",
"baseVolume": "12380.79000000"
}
]
},
{
"startDate": "2018-10-05T00:00:00.000Z",
"markets": [
{
"exchangeSymbol": "Binance",
"openPrice": "6591.69000000",
"baseVolume": "16096.55239200"
},
{
"exchangeSymbol": "HitBTC",
"openPrice": "6590.84000000",
"baseVolume": "12318.92000000"
}
]
},
{
"startDate": "2018-10-04T00:00:00.000Z",
"markets": [
{
"exchangeSymbol": "Binance",
"openPrice": "6510.01000000",
"baseVolume": "20074.30081800"
},
{
"exchangeSymbol": "HitBTC",
"openPrice": "6507.52000000",
"baseVolume": "10184.14000000"
}
]
},
{
"startDate": "2018-10-03T00:00:00.000Z",
"markets": [
{
"exchangeSymbol": "Binance",
"openPrice": "6525.79000000",
"baseVolume": "28451.96913800"
},
{
"exchangeSymbol": "HitBTC",
"openPrice": "6525.91000000",
"baseVolume": "9889.21000000"
}
]
},
{
"startDate": "2018-10-02T00:00:00.000Z",
"markets": [
{
"exchangeSymbol": "Binance",
"openPrice": "6610.00000000",
"baseVolume": "28245.81008800"
},
{
"exchangeSymbol": "HitBTC",
"openPrice": "6605.26000000",
"baseVolume": "14956.91000000"
}
]
},
{
"startDate": "2018-10-01T00:00:00.000Z",
"markets": [
{
"exchangeSymbol": "Binance",
"openPrice": "6626.57000000",
"baseVolume": "20621.50689400"
},
{
"exchangeSymbol": "HitBTC",
"openPrice": "6626.36000000",
"baseVolume": "11111.94000000"
}
]
}
]
}
}
Try me!
Multiple markets
This example demonstrates how pricing data can be shown for multiple markets at the same time when using the same
base and quote symbol.
query markets {
timeseries(resolution: _1d, limit: 7, startDate: "2018-10-01") {
startDate
markets(
filter: {
exchangeSymbol: { _in: ["Binance", "HitBTC"] }
baseSymbol: { _eq: "BTC" }
quoteSymbol: { _eq: "USDT" }
}
) {
marketSymbol
openPrice
highPrice
lowPrice
closePrice
baseVolume
quoteVolume
marketCount
percentChange
}
}
}
{
"data": {
"timeseries": [
{
"startDate": "2018-10-07T00:00:00.000Z",
"markets": [
{
"marketSymbol": "Binance:BTC/USDT",
"openPrice": "6525.79000000",
"highPrice": "6525.79000000",
"lowPrice": "6525.79000000",
"closePrice": "6525.79000000",
"baseVolume": "0.00000000",
"quoteVolume": "0.00000000",
"marketCount": 1,
"percentChange": "0"
},
{
"marketSymbol": "HitBTC:BTC/USDT",
"openPrice": "6524.17000000",
"highPrice": "6524.17000000",
"lowPrice": "6524.17000000",
"closePrice": "6524.17000000",
"baseVolume": "0.00000000",
"quoteVolume": "0.00000000",
"marketCount": 1,
"percentChange": "0"
}
]
},
{
"startDate": "2018-10-06T00:00:00.000Z",
"markets": [
{
"marketSymbol": "Binance:BTC/USDT",
"openPrice": "6525.79000000",
"highPrice": "6525.79000000",
"lowPrice": "6525.79000000",
"closePrice": "6525.79000000",
"baseVolume": "0.00000000",
"quoteVolume": "0.00000000",
"marketCount": 1,
"percentChange": "0"
},
{
"marketSymbol": "HitBTC:BTC/USDT",
"openPrice": "6524.17000000",
"highPrice": "6524.17000000",
"lowPrice": "6524.17000000",
"closePrice": "6524.17000000",
"baseVolume": "0.00000000",
"quoteVolume": "0.00000000",
"marketCount": 1,
"percentChange": "0"
}
]
},
{
"startDate": "2018-10-05T00:00:00.000Z",
"markets": [
{
"marketSymbol": "Binance:BTC/USDT",
"openPrice": "6525.79000000",
"highPrice": "6525.79000000",
"lowPrice": "6525.79000000",
"closePrice": "6525.79000000",
"baseVolume": "0.00000000",
"quoteVolume": "0.00000000",
"marketCount": 1,
"percentChange": "0"
},
{
"marketSymbol": "HitBTC:BTC/USDT",
"openPrice": "6524.17000000",
"highPrice": "6524.17000000",
"lowPrice": "6524.17000000",
"closePrice": "6524.17000000",
"baseVolume": "0.00000000",
"quoteVolume": "0.00000000",
"marketCount": 1,
"percentChange": "0"
}
]
},
{
"startDate": "2018-10-04T00:00:00.000Z",
"markets": [
{
"marketSymbol": "Binance:BTC/USDT",
"openPrice": "6525.79000000",
"highPrice": "6525.79000000",
"lowPrice": "6525.79000000",
"closePrice": "6525.79000000",
"baseVolume": "0.00000000",
"quoteVolume": "0.00000000",
"marketCount": 1,
"percentChange": "0"
},
{
"marketSymbol": "HitBTC:BTC/USDT",
"openPrice": "6524.17000000",
"highPrice": "6524.17000000",
"lowPrice": "6524.17000000",
"closePrice": "6524.17000000",
"baseVolume": "0.00000000",
"quoteVolume": "0.00000000",
"marketCount": 1,
"percentChange": "0"
}
]
},
{
"startDate": "2018-10-03T00:00:00.000Z",
"markets": [
{
"marketSymbol": "Binance:BTC/USDT",
"openPrice": "6525.79000000",
"highPrice": "6525.79000000",
"lowPrice": "6525.79000000",
"closePrice": "6525.79000000",
"baseVolume": "0.00000000",
"quoteVolume": "0.00000000",
"marketCount": 1,
"percentChange": "0"
},
{
"marketSymbol": "HitBTC:BTC/USDT",
"openPrice": "6524.17000000",
"highPrice": "6524.17000000",
"lowPrice": "6524.17000000",
"closePrice": "6524.17000000",
"baseVolume": "0.00000000",
"quoteVolume": "0.00000000",
"marketCount": 1,
"percentChange": "0"
}
]
},
{
"startDate": "2018-10-02T00:00:00.000Z",
"markets": [
{
"marketSymbol": "Binance:BTC/USDT",
"openPrice": "6610.00000000",
"highPrice": "6640.00000000",
"lowPrice": "6494.00000000",
"closePrice": "6525.79000000",
"baseVolume": "28245.81008800",
"quoteVolume": "185725492.28023912",
"marketCount": 1,
"percentChange": "-1.27"
},
{
"marketSymbol": "HitBTC:BTC/USDT",
"openPrice": "6605.26000000",
"highPrice": "6630.49000000",
"lowPrice": "6483.89000000",
"closePrice": "6524.17000000",
"baseVolume": "14956.91000000",
"quoteVolume": "98321688.98470000",
"marketCount": 1,
"percentChange": "-1.23"
}
]
},
{
"startDate": "2018-10-01T00:00:00.000Z",
"markets": [
{
"marketSymbol": "Binance:BTC/USDT",
"openPrice": "6626.57000000",
"highPrice": "6667.09000000",
"lowPrice": "6510.00000000",
"closePrice": "6611.61000000",
"baseVolume": "20621.50689400",
"quoteVolume": "136115256.96830679",
"marketCount": 1,
"percentChange": "-0.23"
},
{
"marketSymbol": "HitBTC:BTC/USDT",
"openPrice": "6626.36000000",
"highPrice": "6659.71000000",
"lowPrice": "6521.36000000",
"closePrice": "6606.79000000",
"baseVolume": "11111.94000000",
"quoteVolume": "73380338.74390000",
"marketCount": 1,
"percentChange": "-0.3"
}
]
}
]
}
}
Try me!