Bitcoin time series extends the TimeSeriesAsset
object to include custom time aggregated fields related to the Bitcoin peer-to-peer network and blockchain.
You can access these fields by using the ... on TimeSeriesBtc
inline fragment when using TimeSerisAsset
property in a time series query. Inline fragments are a way to specify additional properties on an object that can take on many forms, such as the TimeSeriesAsset
type.
You can read more information about inline fragments in the the GraphQL documentation.
This example shows onchain data statistics over aggregated by day over a 3 day period.
query bitcoinTimeSeries {
timeseries(resolution: _1d, limit: 3, startDate: "2019-02-01", sort: OLD_FIRST) {
startDate
assets(filter: { assetSymbol: { _eq: "BTC" } }) {
assetSymbol
... on TimeSeriesBtc {
onchain {
totalBlocks
startHeight
endHeight
avgDifficulty
targetHashRate
avgBlockTime
avgBlockSize
totalSize
startSize
endSize
totalTxs
avgTxsPerBlock
totalFees
avgFeesPerBlock
totalSubsidy
avgSubsidyPerBlock
totalReward
avgRewardPerBlock
startSupply
endSupply
totalExpectedSubsidy
startExpectedSupply
endExpectedSupply
totalValueOut
avgValueOutPerBlock
totalInputs
avgInputsPerBlock
totalOutputs
avgOutputsPerBlock
totalCoinbaseOutputs
avgCoinbaseOutputsPerBlock
}
}
}
}
}
{
"data": {
"timeseries": [
{
"startDate": "2019-02-01T00:00:00.000Z",
"assets": [
{
"assetSymbol": "BTC",
"onchain": {
"totalBlocks": "158",
"startHeight": "560983",
"endHeight": "561141",
"avgDifficulty": "5814661935891.805",
"targetHashRate": "41623.60654575",
"avgBlockTime": "555.816",
"avgBlockSize": "1024592.437",
"totalSize": "161885605",
"startSize": "407767294122",
"endSize": "407929179727",
"totalTxs": "339183",
"avgTxsPerBlock": "2146.728",
"totalFees": "33.11076701",
"avgFeesPerBlock": "0.20956182",
"totalSubsidy": "1975.00000000",
"avgSubsidyPerBlock": "12.500",
"totalReward": "2008.11076701",
"avgRewardPerBlock": "12.70956182",
"startSupply": "17512271.04497312",
"endSupply": "17514246.04497312",
"totalExpectedSubsidy": "1975.00000000",
"startExpectedSupply": "17512300.00000000",
"endExpectedSupply": "17514275.00000000",
"totalValueOut": "2803583.71450016",
"avgValueOutPerBlock": "17744.20072468",
"totalInputs": "715300",
"avgInputsPerBlock": "4527.215",
"totalOutputs": "822971",
"avgOutputsPerBlock": "5208.677",
"totalCoinbaseOutputs": "396",
"avgCoinbaseOutputsPerBlock": "2.506"
}
}
]
},
{
"startDate": "2019-02-02T00:00:00.000Z",
"assets": [
{
"assetSymbol": "BTC",
"onchain": {
"totalBlocks": "144",
"startHeight": "561141",
"endHeight": "561285",
"avgDifficulty": "5814661935891.805",
"targetHashRate": "41623.60654575",
"avgBlockTime": "598.167",
"avgBlockSize": "981337.799",
"totalSize": "141312643",
"startSize": "407929179727",
"endSize": "408070492370",
"totalTxs": "321888",
"avgTxsPerBlock": "2235.333",
"totalFees": "18.92618462",
"avgFeesPerBlock": "0.13143184",
"totalSubsidy": "1800.00000000",
"avgSubsidyPerBlock": "12.500",
"totalReward": "1818.92618462",
"avgRewardPerBlock": "12.63143184",
"startSupply": "17514246.04497312",
"endSupply": "17516046.04497312",
"totalExpectedSubsidy": "1800.00000000",
"startExpectedSupply": "17514275.00000000",
"endExpectedSupply": "17516075.00000000",
"totalValueOut": "1527138.57361821",
"avgValueOutPerBlock": "10605.12898346",
"totalInputs": "604181",
"avgInputsPerBlock": "4195.701",
"totalOutputs": "761788",
"avgOutputsPerBlock": "5290.194",
"totalCoinbaseOutputs": "413",
"avgCoinbaseOutputsPerBlock": "2.868"
}
}
]
},
{
"startDate": "2019-02-03T00:00:00.000Z",
"assets": [
{
"assetSymbol": "BTC",
"onchain": {
"totalBlocks": "138",
"startHeight": "561285",
"endHeight": "561423",
"avgDifficulty": "5814661935891.805",
"targetHashRate": "41623.60654575",
"avgBlockTime": "622.703",
"avgBlockSize": "935500.210",
"totalSize": "129099029",
"startSize": "408070492370",
"endSize": "408199591399",
"totalTxs": "300033",
"avgTxsPerBlock": "2174.152",
"totalFees": "14.74322284",
"avgFeesPerBlock": "0.10683495",
"totalSubsidy": "1725.00000000",
"avgSubsidyPerBlock": "12.500",
"totalReward": "1739.74322284",
"avgRewardPerBlock": "12.60683495",
"startSupply": "17516046.04497312",
"endSupply": "17517771.04497312",
"totalExpectedSubsidy": "1725.00000000",
"startExpectedSupply": "17516075.00000000",
"endExpectedSupply": "17517800.00000000",
"totalValueOut": "690916.78426866",
"avgValueOutPerBlock": "5006.64336427",
"totalInputs": "556906",
"avgInputsPerBlock": "4035.551",
"totalOutputs": "700986",
"avgOutputsPerBlock": "5079.609",
"totalCoinbaseOutputs": "340",
"avgCoinbaseOutputsPerBlock": "2.464"
}
}
]
}
]
}
}