Get Portfolio Valuation
GET https://api.sfox.com/v1/account/balance/history
Retrieve a history of the USD value of your account's portfolio at hourly or daily intervals
Request
Query Parameters
Name
Type
Description
start_date required
timestamp
Timestamp of the start of the query. Unix timestamp (ms)
end_date
timestamp
Timestamp of the end of the query. Unix timestamp (ms)
interval
int
Timeseries interval (sec).
Possible values: 3600 (hourly), 86400 (daily)
Default value: 86400
Example Request
curl -H 'Authorization: Bearer <API_TOKEN>'
'https://api.sfox.com/v1/account/balance/history?interval=86400&start_date=1701475200000&end_date=1701734400000'const axios = require('axios');
axios({
method: 'get',
url: 'https://api.sfox.com/v1/account/balance/history?interval=86400&start_date=1701475200000&end_date=1701734400000',
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/account/balance/history?interval=86400&start_date=1701475200000&end_date=1701734400000",
headers={
"Authorization": "Bearer <API_KEY>",
}
)
print(data)Response
Response Body
Key
Type
Description
data
[object]
An array of portfolio value objects, each object with a timestamp and usd_value
timestamp
timestamp
Unix timestamp (ms) of the valuation
usd_value
number
USD valuation of your portfolio as of the timestamp
Responses
{
"data": [
{
"timestamp": 1701475200000,
"usd_value": 349515.64495392627
},
{
"timestamp": 1701561600000,
"usd_value": 349628.6458040236
},
{
"timestamp": 1701648000000,
"usd_value": 349653.452981625
},
{
"timestamp": 1701734400000,
"usd_value": 349301.02066800353
},
{
"timestamp": 1701820800000,
"usd_value": 350066.51819476683
},
{
"timestamp": 1701907200000,
"usd_value": 350761.96052562393
}
]
}//Invalid start_date
{
"error": "start_date must be a valid unix timestamp in milliseconds"
}
//Invalid end_date
{
"error": "end_date must be a valid unix timestamp in milliseconds"
}
// Invalid interval
{
"error": "interval must be 3600 or 86400"
}Last updated