Orders
post
https://api.sfox.com/v1
/orders/:side
Place an Order

Special Parameters

Some of SFOX's algorithms require different parameters that define execution
Parameter
Description
Applicable Algorithms
Default
amount
The amount (quote currency) to spend when buying NOTE: amount is required when placing BUY orders using the Applicable Algorithms
Market IOC Stop Trailing Stop
N/A
total_time
The time, in seconds, that a TWAP order will stay active from the time the TWAP order is placed
TWAP
N/A
interval
The frequency, in seconds, that slices of a TWAP order will be executed
TWAP
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
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
false
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 Gorilla WeightedExchange: Smart Limit Hare
Hare/Gorilla: Fast Smart/Limit/Hare BestPrice
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
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 Stop Trailing Stop
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
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
1
curl -X POST \
2
-H 'Content-type: application/json' \
3
-H 'Authorization: Bearer <API_TOKEN>' \
4
--data '{ "quantity": 1,
5
"currency_pair": "btcusd" }' \
6
'https://api.sfox.com/v1/orders/buy'
Copied!
1
const axios = require('axios');
2
3
axios({
4
method: 'post',
5
url: 'https://api.sfox.com/v1/orders/buy',
6
headers: {
7
'Authorization': 'Bearer <API_KEY>'
8
},
9
data: {
10
quantity: 1,
11
currency_pair: 'btcusd'
12
}
13
}).then(response => {
14
console.log(response)
15
}).catch(err => {
16
console.error(err)
17
});
Copied!
1
import requests
2
3
data = requests.post(
4
"https://api.sfox.com/v1/orders/buy",
5
headers={
6
"Authorization": "Bearer <API_KEY>",
7
},
8
data={
9
"quantity": 1,
10
"currency_pair":"btcusd"
11
}
12
)
13
print(data)
Copied!
delete
https://api.sfox.com/v1
/orders/:order_id
Cancel an Order
Shell
NodeJS
Python
1
curl -X DELETE
2
-H 'Authorization: Bearer <API_TOKEN>' \
3
'https://api.sfox.com/v1/orders/123'
Copied!
1
const axios = require('axios');
2
3
axios({
4
method: 'delete',
5
url: 'https://api.sfox.com/v1/orders/123',
6
headers: {
7
'Authorization': 'Bearer <API_KEY>'
8
}
9
}).then(response => {
10
console.log(response)
11
}).catch(err => {
12
console.error(err)
13
});
Copied!
1
import requests
2
3
data = requests.delete(
4
"https://api.sfox.com/v1/orders/123",
5
headers={
6
"Authorization": "Bearer <API_KEY>",
7
}
8
)
9
print(data)
Copied!
delete
https://api.sfox.com/v1
/orders
Cancel Multiple Orders
Shell
NodeJS
Python
1
curl -X DELETE \
2
-H 'Authorization: Bearer <API_TOKEN>' \
3
'https://api.staging.sfox.com/v1/orders?ids=123,456'
Copied!
1
const axios = require('axios');
2
3
axios({
4
method: 'delete',
5
url: 'https://api.sfox.com/v1/orders',
6
headers: {
7
'Authorization': 'Bearer <API_KEY>'
8
},
9
params: {
10
ids: '123,456'
11
}
12
}).then(response => {
13
console.log(response)
14
}).catch(err => {
15
console.error(err)
16
});
Copied!
1
import requests
2
3
data = requests.delete(
4
"https://api.sfox.com/v1/orders",
5
headers={
6
"Authorization": "Bearer <API_KEY>",
7
},
8
params={
9
"ids": "123,456"
10
}
11
)
12
print(data)
Copied!
delete
https://api.sfox.com/v1
/orders/open
Cancel All Open Orders
Shell
NodeJS
Python
1
curl -X DELETE \
2
-H 'Authorization: Bearer <API_TOKEN>' \
3
'https://api.staging.sfox.com/v1/orders/open'
Copied!
1
const axios = require('axios');
2
3
axios({
4
method: 'delete',
5
url: 'https://api.sfox.com/v1/orders/open',
6
headers: {
7
'Authorization': 'Bearer <API_KEY>'
8
}
9
}).then(response => {
10
console.log(response)
11
}).catch(err => {
12
console.error(err)
13
});
Copied!
1
import requests
2
3
data = requests.delete(
4
"https://api.sfox.com/v1/orders/open",
5
headers={
6
"Authorization": "Bearer <API_KEY>",
7
}
8
)
9
print(data)
Copied!
patch
https://api.sfox.com/v1
/orders/:order_id
Amend an Order
Shell
NodeJS
Python
1
curl -X PATCH \
2
-H 'Authorization: Bearer <API_TOKEN>' \
3
--data '{ "quantity": 2 }' \
4
'https://api.staging.sfox.com/v1/orders/123'
Copied!
1
const axios = require('axios');
2
3
axios({
4
method: 'patch',
5
url: 'https://api.sfox.com/v1/orders/123',
6
headers: {
7
'Authorization': 'Bearer <API_KEY>'
8
},
9
data: { quantity: 1 }
10
}).then(response => {
11
console.log(response)
12
}).catch(err => {
13
console.error(err)
14
});
Copied!
1
import requests
2
3
data = requests.patch(
4
"https://api.sfox.com/v1/orders/123",
5
headers={
6
"Authorization": "Bearer <API_KEY>",
7
},
8
data={
9
"quantity": 1
10
}
11
)
12
print(data)
Copied!
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 filled
Done
The order was completed successfully
Shell
NodeJS
Python
1
curl -H 'Authorization: Bearer <API_TOKEN>' \
2
'https://api.staging.sfox.com/v1/orders/1'
Copied!
1
const axios = require('axios');
2
3
axios({
4
method: 'get',
5
url: 'https://api.sfox.com/v1/orders/123',
6
headers: {
7
'Authorization': 'Bearer <API_KEY>'
8
}
9
}).then(response => {
10
console.log(response)
11
}).catch(err => {
12
console.error(err)
13
});
Copied!
1
import requests
2
3
data = requests.get(
4
"https://api.sfox.com/v1/orders/123",
5
headers={
6
"Authorization": "Bearer <API_KEY>",
7
}
8
)
9
print(data)
Copied!
get
https://api.sfox.com/v1
/orders
Get Open Orders
Shell
NodeJS
Python
1
curl -H 'Authorization: Bearer <API_TOKEN>' \
2
'https://api.staging.sfox.com/v1/orders'
Copied!
1
const axios = require('axios');
2
3
axios({
4
method: 'get',
5
url: 'https://api.sfox.com/v1/orders',
6
headers: {
7
'Authorization': 'Bearer <API_KEY>'
8
}
9
}).then(response => {
10
console.log(response)
11
}).catch(err => {
12
console.error(err)
13
});
Copied!
1
import requests
2
3
data = requests.get(
4
"https://api.sfox.com/v1/orders",
5
headers={
6
"Authorization": "Bearer <API_KEY>",
7
}
8
)
9
print(data)
Copied!
get
https://api.sfox.com/v1
/orders/done
Get Done Trades
Shell
NodeJS
Python
1
curl -H 'Authorization: Bearer <API_TOKEN>' \
2
'https://api.staging.sfox.com/v1/orders/done'
Copied!
1
const axios = require('axios');
2
3
axios({
4
method: 'get',
5
url: 'https://api.sfox.com/v1/orders/done',
6
headers: {
7
'Authorization': 'Bearer <API_KEY>'
8
}
9
}).then(response => {
10
console.log(response)
11
}).catch(err => {
12
console.error(err)
13
});
Copied!
1
import requests
2
3
data = requests.get(
4
"https://api.sfox.com/v1/orders/done",
5
headers={
6
"Authorization": "Bearer <API_KEY>",
7
}
8
)
9
print(data)
Copied!
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
1
curl -H 'Authorization: Bearer <API_TOKEN>' \
2
'https://api.staging.sfox.com/v1/markets/currency-pairs'
Copied!
1
const axios = require('axios');
2
3
axios({
4
method: 'get',
5
url: 'https://api.sfox.com/v1/markets/currency-pairs',
6
headers: {
7
'Authorization': 'Bearer <API_KEY>'
8
}
9
}).then(response => {
10
console.log(response)
11
}).catch(err => {
12
console.error(err)
13
});
Copied!
1
import requests
2
3
data = requests.get(
4
"https://api.sfox.com/v1/markets/currency-pairs",
5
headers={
6
"Authorization": "Bearer <API_KEY>",
7
}
8
)
9
print(data)
Copied!