Market Data
get
https://api.sfox.com/v1
/offer/:side
Smart Routing Order Estimates

Response Body

Key
Description
Example
quantity
The base currency quantity applicable to the estimate. Equal to the amount parameter in the request.
1
vwap
The estimated fill price, or volume-weighted average price, you would receive for an order of this quantity at the time of this request. (Quote Currency)
43501.79
price
The estimated order limit price what would have to be specified when placing this order to buy or sell this quantity and receive the estimated fill price at the time of this request. (Quote Currency)
43501.8
fees
The estimated fees you would pay in quote currency terms if this order was executed.
10.21
total
The estimated quote currency amount you would pay (side = buy) or receive (side = sell) net fees for this order quantity.
43511.00
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.
VWAP, Price, Fees, and Total are in the quote currency (e.g. USD for a btcusd pair).
Shell
NodeJS
Python
1
curl 'https://api.sfox.com/v1/offer/buy?amount=1&pair=btcusd'
Copied!
1
const axios = require('axios');
2
3
axios({
4
method: 'get',
5
url: 'https://api.sfox.com/v1/offer/buy',
6
params: {
7
amount: 1,
8
pair: 'btcusd'
9
}
10
}).then(response => {
11
console.log(response)
12
}).catch(err => {
13
console.error(err)
14
});
Copied!
1
import requests
2
3
data = requests.get(
4
"https://api.sfox.com/v1/offer/buy",
5
headers={
6
"Authorization": "Bearer <API_KEY>",
7
},
8
params={
9
"amount": 1,
10
"pair": "btcusd"
11
}
12
)
13
print(data)
Copied!
get
https://chartdata.sfox.com/candlesticks
Candlestick / OHLCV Historical Data

Response Body

Key
Description
open_price
The price at the start of that period
high_price
The highest price reached during that period
low_price
The lowest price reached during that period
close_price
The price at the end of that period
volume
Total volume of the asset traded during that period
start_time
The unix timestamp of the beginning of the period
end_time
The unix timestamp of the end of the period
pair
The trading pair of the data
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 - 30 days
900
Now - 60 days
3600
Now - 180 days
21600
Year to Date
86400
No limit
Shell
NodeJS
Python
1
curl 'https://chartdata.sfox.com/candlesticks?endTime=1651536000&pair=btcusd&period=86400&startTime=1634256000'
Copied!
1
const axios = require('axios');
2
3
axios({
4
method: 'get',
5
url: 'https://chartdata.sfox.com/candlesticks',
6
params: {
7
pair: 'btcusd',
8
startTime: 1634256000,
9
endTime: 1651536000,
10
period: 86400
11
}
12
}).then(response => {
13
console.log(response)
14
}).catch(err => {
15
console.error(err)
16
});
Copied!
1
import requests
2
3
data = requests.get(
4
"https://chartdata.sfox.com/candlesticks",
5
headers={
6
"Authorization": "Bearer <API_KEY>",
7
},
8
params={
9
"pair":"btcusd",
10
"startTime": 1634256000,
11
"endTime": 1651536000,
12
"period": 86400
13
}
14
)
15
print(data)
Copied!
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
timestamps
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
Shell
NodeJS
Python
1
curl 'https://api.sfox.com/v1/markets/orderbook/btcusd'
Copied!
1
const axios = require('axios');
2
3
axios({
4
method: 'get',
5
url: 'https://api.sfox.com/v1/markets/orderbook/btcusd',
6
}).then(response => {
7
console.log(response)
8
}).catch(err => {
9
console.error(err)
10
});
Copied!
1
import requests
2
3
data = requests.get(
4
"https://api.sfox.com/v1/markets/orderbook/btcusd",
5
headers={
6
"Authorization": "Bearer <API_KEY>",
7
}
8
)
9
print(data)
Copied!