Get Candlesticks

GET https://chartdata.sfox.com/candlesticks

Retrieve historical candlestick / OHLCV (Open-High-Low-Close-Volume) data for a currency pair. Returns an array of objects, each representing a candle.

  • Data represents aggregated trades data from all of sFOX's supported liquidity providers. NOT representative of trades executed on sFOX.

  • Data is not forward-filled and, therefore, may be incomplete. e.g. no data will be returned for an interval during which 0 trades were recorded.

Responses are limited to 500 candles. If the requested startTime , endTime , and period will result in more than 500 data points, your request will be rejected. To retrieve data over a larger time range, you will need to make multiple requests with new startTime / endTime ranges. Candles may precede your specified startTime value.

Query Parameters

ParameterTypeDescription

pair required

string

Specify the currency pair to retrieve data for. e.g. btcusd

startTime required

timestamp

The unix timestamp (seconds) of the first datapoint returned

endTime required

timestamp

The unix timestamp (seconds) of the last datapoint you want returned

period

int

The duration or interval of each datapoint or candle in seconds (e.g. period = 60 would return 1-minute candles). Possible values:

  • 60 (1 minute) default if not specified

  • 300 (5 minute)

  • 900 (15 minute)

  • 3600 (1 hour)

  • 21600 (6 hour)

  • 86400 (1 day)

Response Body

KeyDescription

open_price

The price of the first trade recorded after the start_time

high_price

The highest trade price during this period

low_price

The lowest trade price during this period

close_price

The price of the last trade executed in this period

volume

Total base currency volume traded during this period

start_time

The unix timestamp of the beginning of the period

pair

The trading pair / symbol

candle_period

The duration of each datapoint in seconds

vwap

The volume-weighted average price of the period

trades

The total number of trades executed across all liquidity providers during that period

Responses

200
[
  {
    "open_price":"9654",
    "high_price":"9662.37",
    "low_price":"9653.66",
    "close_price":"9655.73",
    "volume":"6.31945755",
    "start_time":1592939280,
    "pair":"btcusd",
    "candle_period":60,
    "vwap":"9655.70504211",
    "trades":53
  }
]

Example Request

curl 'https://chartdata.sfox.com/candlesticks?endTime=1665165809&pair=btcusd&period=86400&startTime=1657217002'

Last updated