historical Bitcoin OHLC data for the last 7 days

Historical data The Trading cube covers real time and roughly the last 30 days. For anything older, rebuild the same numbers from raw trades with DEXTradeByTokens. Datasets: https://docs.bitquery.io/docs/graphql/dataset/archive/ Retention: https://docs.bitquery.io/docs/graphql/data-coverage-retenti

By gaurav · saved 4 September 2025 · run 3 times · Bitquery API v2

What it returns

Filters

The query

# Historical data
#   The Trading cube covers real time and roughly the last 30 days. For
#   anything older, rebuild the same numbers from raw trades with
#   DEXTradeByTokens.
#
# Datasets:  https://docs.bitquery.io/docs/graphql/dataset/archive/
# Retention: https://docs.bitquery.io/docs/graphql/data-coverage-retention/
#

{
  Trading {
    Currencies(
      where: {
        Currency: { Id: { is: "bid:bitcoin" } },
        Interval: { Time: { Duration: { eq: 3600 } } },
        Block: {Time:{
          since_relative:{days_ago:7}
        }}
      },
      limit: { count: 240 },
      orderBy: { descending: Block_Time }
    ) {
      Currency {
        Id
        Name
        Symbol
      }
      Block {
        Date
        Time
        Timestamp
      }
      Interval {
        Time {
          Start
          Duration
          End
        }
      }
      Volume {
        Base
        BaseAttributedToUsd
        Quote
        Usd
      }
      Price {
        IsQuotedInUsd
        Ohlc {
          Open
          High
          Low
          Close
        }
        Average {
          Mean
          SimpleMoving
          WeightedSimpleMoving
          ExponentialMoving
        }
      }
    }
  }
}

Similar queries