/positions/{accountId}/{asset}/chart-eventsPosition events of the account on one market inside a time range, newest first — the markers a chart draws.
- Only increases, closes, force closes and liquidations are returned; funding and margin changes are not chart events.
- The range is given in whole seconds through
executedFromandexecutedTo, both inclusive. - Limited to the phase the account is currently in.
https://api.upscale.tradeParameters
accountIdstring · uuidrequiredTrader account identifier. Must belong to the caller.
- pattern
- ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
00000000-0000-4000-8000-000000000000assetstringrequiredBase asset ticker of the market, as returned by GET /v2/markets.
- minLength
- 1
BTCexecutedFromnumberrequiredExecuted from, unix timestamp in seconds (inclusive)
1735689600executedTonumberrequiredExecuted to, unix timestamp in seconds (inclusive)
1767225599limitintegeroptionalPage size: how many events to return.
Default: 20
- minimum
- 1
- maximum
- 1000
20offsetintegeroptionalHow many events to skip before the page.
Default: 0
- minimum
- 0
- maximum
- 9007199254740991
0Examples
curl --request GET 'https://api.upscale.trade/positions/{accountId}/{asset}/chart-events' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY'const response = await fetch("https://api.upscale.trade/positions/{accountId}/{asset}/chart-events", {
method: "GET",
headers: {
"Accept": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
},
});
console.log(response.status, await response.text());import requests
response = requests.request(
"GET",
"https://api.upscale.trade/positions/{accountId}/{asset}/chart-events",
headers={"Accept":"application/json","Authorization":"Bearer YOUR_API_KEY"},
timeout=30,
)
print(response.status_code, response.text)Responses
Unauthorized
The account belongs to another user (account_access_denied), or the request is authenticated with an API key while api_trading is disabled on the account (api_trading_not_enabled).
No account with this identifier, or no market for this ticker.
Rate limit of the API key exceeded (api_key_rate_limit_exceeded). Retry-After says when to come back; the body carries the bucket (read / write), the window that tripped, its limit and retryAt.
defaultResponseapplication/json
dataobject[]requiredRequested page of chart markers, newest first.
Array items · object
assetstringrequiredBase asset ticker of the market the event happened on.
BTCdirectionstring · enumrequiredDirection of the position the event belongs to.
"long" "short"longeventNamestring · enumrequiredWhat the marker stands for: open for the first increase of a position, increase for later ones, decrease for a partial close, close for a full one and liquidation for a liquidation.
"open" "increase" "decrease" "close" "liquidation"openexecutedAtnumberrequiredWhen the event happened, unix timestamp in seconds.
1767225599pricestring · int32requiredPrice the event executed at, fp9 raw — exchanged quote over exchanged base.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000sizestring · int32requiredAbsolute size the event moved, in base asset units, fp9 raw.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000View example
[
{
"asset": "BTC",
"direction": "long",
"eventName": "open",
"executedAt": 1767225599,
"price": "1000000000",
"size": "1000000000"
}
]totalCountnumberrequiredTotal number of events in the requested range, across all pages.
0{
"data": [
{
"asset": "BTC",
"direction": "long",
"eventName": "open",
"executedAt": 1767225599,
"price": "1000000000",
"size": "1000000000"
}
],
"totalCount": 0
}