Market Data
get
https://api.sfox.com/v1
/offer/:side
Smart Routing Order Estimates
This response is an estimate, not a quote. Prices fluctuate often, therefore, it is possible that an order submitted after receiving this estimate will execute differently. Real-time order book and ticker data is available through SFOX’s Websocket API.

Example Request

Shell
NodeJS
Python
curl 'https://api.sfox.com/v1/offer/buy?amount=1&pair=btcusd'
const axios = require('axios');
axios({
method: 'get',
url: 'https://api.sfox.com/v1/offer/buy',
params: {
amount: 1,
pair: 'btcusd'
}
}).then(response => {
console.log(response)
}).catch(err => {
console.error(err)
});
import requests
data = requests.get(
"https://api.sfox.com/v1/offer/buy",
headers={
"Authorization": "Bearer <API_KEY>",
},
params={
"amount": 1,
"pair": "btcusd"
}
)
print(data)

Response Body

VWAP, Price, Fees, and Total are in the quote currency (e.g. USD for a btcusd pair).
Key
Description
Example
price
Estimated order limit price to specify when placing this order to receive the estimated fill price at the time of this request. (Quote Currency)
19203.23787426
subtotal
If side = buy: Estimated cost before fees. If side = sell: Estimated proceeds before fees.
19202.05116807
fees
Estimated fees you would pay in quote currency terms for this order. Note: Authentication required to receive a fees estimate
6.72071791
total
If side = buy: Estimated cost net fees. If side = sell: Estimated proceeds net fees.
19208.77188598
quantity
The base currency quantity applicable to the estimate. Equal to the quantity parameter in the request.
1
vwap
Estimated fill price you would receive at the time of this request. (Quote currency terms)
19202.05116807
currency_pair
Trading pair / symbol
"btcusd"
routing_type
sFOX order book used for this estimate
"NetPrice"
get
https://chartdata.sfox.com
/candlesticks
Candlestick / OHLCV Historical Data
Historical data may be incomplete. No data is published for intervals in which there are no trades.

Response Body

Key
Description
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

Historical Data Limits

This endpoint will only return a certain amount of historical data from the current timestamp based on the period specified in the request.
The following table outlines how much historical data can be retrieved based on the period.
Period (Seconds)
Limit
60
Now - 7 days
300
Now - 14 days
900
Now - 14 days
3600
Now - 180 days
21600
Now - 365 days
86400
No limit

Example Request

Shell
NodeJS
Python
curl 'https://chartdata.sfox.com/candlesticks?endTime=1651536000&pair=btcusd&period=86400&startTime=1634256000'
const axios = require('axios');
axios({
method: 'get',
url: 'https://chartdata.sfox.com/candlesticks',
params: {
pair: 'btcusd',
startTime: 1634256000,
endTime: 1651536000,
period: 86400
}
}).then(response => {
console.log(response)
}).catch(err => {
console.error(err)
});
import requests
data = requests.get(
"https://chartdata.sfox.com/candlesticks",
headers={
"Authorization": "Bearer <API_KEY>",
},
params={
"pair":"btcusd",
"startTime": 1634256000,
"endTime": 1651536000,
"period": 86400
}
)
print(data)
get
https://api.sfox.com/v1
/markets/orderbook/:pair
Orderbook

Response Body

Key
Description
pair
The trading pair
currency
The quote currency
asks
List of asks, size, and exchange
bids
List of the bids, size, and exchange
market_making
List of the best bid and ask on each exchange
timestamp
A list of exchanges and the latest timestamps of the orderbook
lastupdated
Last update of the blended orderbook
lastpublished
Last time an orderbook update was published

Example Request

Shell
NodeJS
Python
curl 'https://api.sfox.com/v1/markets/orderbook/btcusd'
const axios = require('axios');
axios({
method: 'get',
url: 'https://api.sfox.com/v1/markets/orderbook/btcusd',
}).then(response => {
console.log(response)
}).catch(err => {
console.error(err)
});
import requests
data = requests.get(
"https://api.sfox.com/v1/markets/orderbook/btcusd",
headers={
"Authorization": "Bearer <API_KEY>",
}
)
print(data)
Copy link
Outline
get
Smart Routing Order Estimates
get
Candlestick / OHLCV Historical Data
get
Orderbook