This endpoint returns the trade, mark, or spot price Open, High, Low, Close (OHLC) candle data for the most recent candle or from a specified time.
Note: the maximum number of candles returned is 5000.
Endpoint |
Request Type |
Permissible API Keys |
api/charts/v1/{price_type}/{symbol}/{interval} |
GET |
N/A |
Argument |
Type |
Required |
Description |
price_type |
string |
Yes |
trade - the price at which a futures contract was bought or sold mark - the mark price of the instrument spot - the underlying spot/index price |
symbol |
string |
Yes |
The symbol of the Futures, see Ticker Symbols |
interval |
positive integer |
Yes |
Time interval for candle. One of:
|
from |
positive integer |
No |
Unix timestamp in seconds. Returns up to 5000 candles from the specified value. Returns most recent candle if not included |
to |
positive integer |
No |
Unix timestamp in seconds. Requires ‘from’ argument |
Sample Call |
https://www.cryptofacilities.com/api/charts/v1/trade/PI_XBTUSD/1m https://www.cryptofacilities.com/api/charts/v1/spot/PI_XBTUSD/1m?from=1625405796 https://www.cryptofacilities.com/api/charts/v1/mark/PI_XBTUSD/1m?from=1625405796&to=1625492256 |
Sample Return if Successful |
{ ... ], |
Field |
Type |
Description |
candles | structure | Structure containing OHLC data |
time | positive integer | Unix timestamp in milliseconds (ms). Start time of the candle |
open | positive float | Opening price of candle |
high | positive float | Highest price of candle |
low | positive float | Lowest price of candle |
close | positive float | Closing price of candle |
volume | positive integer |
Volume of candle. Will always be 0 for 'spot' and 'mark' |
more_candles | boolean | If there are candles after specified time frame |
Errors if Unsuccessful | |
Error | Description |
Invalid tradeable | Symbol argument is invalid, see Ticker Symbols |
Invalid resolution | Interval argument is invalid, must be
one of:
|
Invalid tick type | Price_type argument is invalid, must be 'trade', 'spot', or 'mark' |
Time period too large | Time period specified would cause the response to exceed the maximum number of candles that can be returned (maximum is 5000) |
Time period invalid |
Time period specified refers to an invalid or future date. Note: time is unix timestamp in seconds |