Links

Post-Trade Settlement

Manage positions, settlement, and risk
Note: the following endpoints are only available to accounts that have Post-Trade Settlement enabled
get
https://api.sfox.com/v1
/post-trade-settlement
Account Risk Metrics

Response Body

Key
Description
exposure
Current USD value of credit used
available_exposure
USD value of credit available
exposure_limit
Credit limit
equity
Current USD value of your holdings
equity_for_withdrawals
The USD value of your portfolio that is available for withdrawals
Shell
NodeJS
Python
curl -H 'Authorization: Bearer <API_TOKEN>' \
https://api.sfox.com/v1/post-trade-settlement
const axios = require('axios');
axios({
method: 'get',
url: 'https://api.sfox.com/v1/post-trade-settlement',
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/post-trade-settlement",
headers={
"Authorization": "Bearer <API_KEY>",
}
)
print(data)
get
https://api.sfox.com/v1
/post-trade-settlement/positions
Positions & Settlement History

Response Body

Key
Description
id
Position ID
status
The status of the position ACTIVE : Outstanding pending settlement CLOSED : Settled
date_added
Date and time the position was opened
date_loan_closed
The date and time the position was settled (null if position is active)
loan_currency_symbol
Currency borrowed
current_loan_qty
The amount currently awaiting settlement including interest if applicable
collateral_currency
Order proceeds currency
pair
Currency pair traded to open the position
interest_rate
The annualized interest rate of the borrowed currency
interest_qty
The amount of interest that has been charged to this position in terms of the currency borrowed
margin_type
Long or short
open_order_id
The order ID that opened the position
order_id_close
The order ID that closed the position (null if position is active)
proceeds
Proceeds of the collateral currency as a result of this position
vwap
Open Price. The fill price of the order that opened the position
Shell
NodeJS
Python
curl -H 'Authorization: Bearer <API_TOKEN>' \
https://api.sfox.com/v1/post-trade-settlement/positions
const axios = require('axios');
axios({
method: 'get',
url: 'https://api.sfox.com/v1/post-trade-settlement/positions',
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/post-trade-settlement/positions",
headers={
"Authorization": "Bearer <API_KEY>",
}
)
print(data)
get
https://api.sfox.com/v1
/post-trade-settlement/interest
Interest Rates & Terms

Response Body

Key
Description
interest_rate
Annualized interest rate as decimal (i.e. 0.02 = 2%)
interest_grace_period_minutes
The amount of time in minutes after a position has been opened that interest will not accrue to the position
interest_frequency_minutes
The frequency in minutes at which a position will accrue interest after the grace period has ended
Shell
NodeJS
Python
curl -H 'Authorization: Bearer <API_TOKEN>' \
https://api.sfox.com/v1/post-trade-settlement/interest
const axios = require('axios');
axios({
method: 'get',
url: 'https://api.sfox.com/v1/post-trade-settlement/interest',
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/post-trade-settlement/interest",
headers={
"Authorization": "Bearer <API_KEY>",
}
)
print(data)
post
https://api.sfox.com/v1
/account/transfer
Wallet Transfer
Transfers from your collateral wallet to your trading wallet will automatically settle unsettled positions, if applicable, first. The remainder, if any, will be applied to your trading wallet
Shell
NodeJS
Python
curl -H 'Authorization: Bearer <API_TOKEN>' \
-H 'Content-Type: application/json' \
-X POST \
--data '{"currency": "btc", "quantity": "1", "from_wallet": "trading", "to_wallet": "collateral"}' \
https://api.sfox.com/v1/account/transfer
const axios = require('axios');
axios({
method: 'post',
url: 'https://api.sfox.com/v1/account/transfer',
headers: {
'Authorization': 'Bearer <API_KEY>'
},
data: {
currency: 'btc',
quantity: 1,
from_wallet: 'trading',
to_wallet: 'collateral'
}
}).then(response => {
console.log(response)
}).catch(err => {
console.error(err)
});
import requests
data = requests.post(
"https://api.sfox.com/v1/account/transfer",
headers={
"Authorization": "Bearer <API_KEY>",
},
data={
"currency": "btc",
"quantity": 1,
"from_wallet": "trading",
"to_wallet": "collateral"
}
)
print(data)