Links

Orders

Place, cancel, amend, and manage orders
post
https://api.sfox.com/v1
/orders/:side
Place New Order

Special Parameters

Some of SFOX's algorithms require different parameters that define execution
Parameter
Description
Applicable Order Types / Algorithms
Default
amount
The amount (quote currency) to spend when buying Note: amount is required when placing BUY orders using the Applicable Algorithms
Market (100) IOC (309) Stop (304) Trailing Stop (308)
N/A
quote_id
For executing on an RFQ, the quote_id received in the RFQ request
N/A
N/A
total_time
The time, in seconds, that a TWAP order will stay active from the time the TWAP order is placed
TWAP (307)
N/A
interval
The frequency, in seconds, that slices of a TWAP order will be executed
TWAP (307)
900
continuous
TWAP orders will execute slices as small as possible and frequently as possible over the total_time if continuous = true. (interval will be ignored)
TWAP (307)
false
post_only
TWAP orders will execute in "post-only" mode. The order will not take and will only execute slices as make orders. (using post_only means it is possible the TWAP order will not fill completely by the end of the total_time
TWAP (307)
false
time_in_force
Time in force (TIF) specifies how the lifetime of your order will be handled. Time in force options: - GTC: Good 'til canceled orders remain open until canceled. This is the default TIF option - IOC: Immediate or cancel orders instantly cancel the remaining unfilled size of an order leaving it open - FOK: Fill or kill orders are either instantly filled for the full order size or instantly rejected if the entire size cannot be matched - GTD: Good 'til date orders are automatically canceled at your specified expires date time
GTC: All (excluding IOC) IOC: Smart (200) Limit (201) FOK: Market (100) Limit (201) GTD: All
"GTC"
expires
Specify the expiration date time (UNIX timestamp in ms) for orders with time_in_force = GTD. (Required for GTD orders)
All
N/A
routing_option
Specify how SFOX will trade your order. Routing Options: - BestPrice: Prioritize routing to maximize price improvement - Fast: Prioritize routing to maximize speed of execution - WeightedExchange: Prioritize routing based on the best combination of price and speed of execution
BestPrice/Fast: Hare (303) Gorilla (301) WeightedExchange: Smart (200) Limit (201) Hare (303)
"WeightedExchange"
stop_amount OR stop_percent
Set the amount (in USD) or percentage (i.e. 0.1 = 10%) that the trigger price of a trailing stop order will trail the price of an asset
Trailing Stop (308)
N/A
max_slippage
A risk management parameter that will limit the slippage of an order in basis points (i.e. setting max_slippage to 5 = 0.05%)
Market (100) Stop (304) Trailing Stop (308)
N/A
stop_any_id
Turns your order into a "Stop-Triggers-Other" or "Trailing-Stop-Triggers-Other" order (trigger placement of an order type of your choosing at a certain price or based on a trailing amount/percent i.e. when price reaches $100 trigger a 1-hour TWAP) 310 = Stop-Triggers-Other 311 = Trailing-Stop-Triggers-Other
All
N/A
stop_any_price
Specify the trigger price of a "Stop-Triggers-Other" order
Stop-Triggers-Other
N/A
stop_any_trail_amount OR stop_any_trail_percent
Specify the trailing amount (quote currency) or trailing percent (i.e. 0.1 = 10%) of a "Trailing-Stop-Triggers-Other" order
Trailing-Stop-Triggers-Other
N/A
destination
Route the order to a specific destination. - ox for the sFOX Ox order book - darkpool for the sFOX Dark Pool
All
N/A
If no price is specified for an order (other than Market, Instant, and Simple types), the order will be rejected.
Orders placed without an Algorithm ID will default to Limit.
Shell
NodeJS
Python
curl -X POST \
-H 'Content-type: application/json' \
-H 'Authorization: Bearer <API_TOKEN>' \
--data '{ "quantity": 1,
"currency_pair": "btcusd" }' \
'https://api.sfox.com/v1/orders/buy'
const axios = require('axios');
axios({
method: 'post',
url: 'https://api.sfox.com/v1/orders/buy',
headers: {
'Authorization': 'Bearer <API_KEY>'
},
data: {
quantity: 1,
currency_pair: 'btcusd'
}
}).then(response => {
console.log(response)
}).catch(err => {
console.error(err)
});
import requests
data = requests.post(
"https://api.sfox.com/v1/orders/buy",
headers={
"Authorization": "Bearer <API_KEY>",
},
data={
"quantity": 1,
"currency_pair":"btcusd"
}
)
print(data)
delete
https://api.sfox.com/v1
/orders/:order_id
Cancel Order
Shell
NodeJS
Python
curl -X DELETE
-H 'Authorization: Bearer <API_TOKEN>' \
'https://api.sfox.com/v1/orders/123'
const axios = require('axios');
axios({
method: 'delete',
url: 'https://api.sfox.com/v1/orders/123',
headers: {
'Authorization': 'Bearer <API_KEY>'
}
}).then(response => {
console.log(response)
}).catch(err => {
console.error(err)
});
import requests
data = requests.delete(
"https://api.sfox.com/v1/orders/123",
headers={
"Authorization": "Bearer <API_KEY>",
}
)
print(data)
delete
https://api.sfox.com/v1
/orders
Cancel Multiple Orders
Shell
NodeJS
Python
curl -X DELETE \
-H 'Authorization: Bearer <API_TOKEN>' \
'https://api.sfox.com/v1/orders?ids=123,456'
const axios = require('axios');
axios({
method: 'delete',
url: 'https://api.sfox.com/v1/orders',
headers: {
'Authorization': 'Bearer <API_KEY>'
},
params: {
ids: '123,456'
}
}).then(response => {
console.log(response)
}).catch(err => {
console.error(err)
});
import requests
data = requests.delete(
"https://api.sfox.com/v1/orders",
headers={
"Authorization": "Bearer <API_KEY>",
},
params={
"ids": "123,456"
}
)
print(data)
delete
https://api.sfox.com/v1
/orders/open
Cancel All Orders
Shell
NodeJS
Python
curl -X DELETE \
-H 'Authorization: Bearer <API_TOKEN>' \
'https://api.sfox.com/v1/orders/open'
const axios = require('axios');
axios({
method: 'delete',
url: 'https://api.sfox.com/v1/orders/open',
headers: {
'Authorization': 'Bearer <API_KEY>'
}
}).then(response => {
console.log(response)
}).catch(err => {
console.error(err)
});
import requests
data = requests.delete(
"https://api.sfox.com/v1/orders/open",
headers={
"Authorization": "Bearer <API_KEY>",
}
)
print(data)
patch
https://api.sfox.com/v1
/orders/:order_id
Amend an Order
Shell
NodeJS
Python
curl -X PATCH \
-H 'Authorization: Bearer <API_TOKEN>' \
--data '{ "quantity": 2 }' \
'https://api.sfox.com/v1/orders/123'
const axios = require('axios');
axios({
method: 'patch',
url: 'https://api.sfox.com/v1/orders/123',
headers: {
'Authorization': 'Bearer <API_KEY>'
},
data: { quantity: 1 }
}).then(response => {
console.log(response)
}).catch(err => {
console.error(err)
});
import requests
data = requests.patch(
"https://api.sfox.com/v1/orders/123",
headers={
"Authorization": "Bearer <API_KEY>",
},
data={
"quantity": 1
}
)
print(data)
get
https://api.sfox.com/v1
/orders/:order_id
Order Status

Order Status Options

Value
Description
Started
The order is open on the marketplace waiting for fills
Cancel Pending
The order is in the process of being cancelled
Canceled
The order was successfully canceled
Filled
The order was partially filled
Done
The order was completed successfully
Shell
NodeJS
Python
curl -H 'Authorization: Bearer <API_TOKEN>' \
'https://api.sfox.com/v1/orders/1'
const axios = require('axios');
axios({
method: 'get',
url: 'https://api.sfox.com/v1/orders/123',
headers: {
'Authorization': 'Bearer <API_KEY>'
}
}).then(response => {
console.log(response)
}).catch(err => {
console.error(err)
});
import requests
data = requests.get(
"https://api.sfox.com/v1/orders/123",
headers={
"Authorization": "Bearer <API_KEY>",
}
)
print(data)
get
https://api.sfox.com/v1
/orders
Get Open Orders
Shell
NodeJS
Python
curl -H 'Authorization: Bearer <API_TOKEN>' \
'https://api.sfox.com/v1/orders'
const axios = require('axios');
axios({
method: 'get',
url: 'https://api.sfox.com/v1/orders',
headers: {
'Authorization': 'Bearer <API_KEY>'
}
}).then(response => {
console.log(response)
}).catch(err => {
console.error(err)
});
import requests
data = requests.get(
"https://api.sfox.com/v1/orders",
headers={
"Authorization": "Bearer <API_KEY>",
}
)
print(data)
get
https://api.sfox.com/v1
/orders/done
Get Done Orders
Shell
NodeJS
Python
curl -H 'Authorization: Bearer <API_TOKEN>' \
'https://api.sfox.com/v1/orders/done'
const axios = require('axios');
axios({
method: 'get',
url: 'https://api.sfox.com/v1/orders/done',
headers: {
'Authorization': 'Bearer <API_KEY>'
}
}).then(response => {
console.log(response)
}).catch(err => {
console.error(err)
});
import requests
data = requests.get(
"https://api.sfox.com/v1/orders/done",
headers={
"Authorization": "Bearer <API_KEY>",
}
)
print(data)
get
https://api.sfox.com/v1
/markets/currency-pairs
List asset pairs
The “symbol” key in each asset pair is the one that can be used to place orders and request market data
Shell
NodeJS
Python
curl -H 'Authorization: Bearer <API_TOKEN>' \
'https://api.sfox.com/v1/markets/currency-pairs'
const axios = require('axios');
axios({
method: 'get',
url: 'https://api.sfox.com/v1/markets/currency-pairs',
headers: {
'Authorization': 'Bearer <API_KEY>'
}
}).then(response => {
console.log(response)
}).catch(err => {
console.error(err)
});
import requests
data = requests.get(
"https://api.sfox.com/v1/markets/currency-pairs",
headers={
"Authorization": "Bearer <API_KEY>",
}
)
print(data)