/positions/{accountId}/{asset}/chart-events/bucketsPosition events of the account on one market grouped by candles of the requested resolution, oldest candle first.
- Candles are aligned the same way the datafeed does it: a candle starts at a multiple of the resolution since the unix epoch, a daily one at UTC midnight.
- A candle is included when its start lies inside
[from, to]; the distance betweenfromandtomay not exceed 350 candles. - Candles without events are omitted.
- Each candle has a
buyside (long increases, short decreases, closes and liquidations) and asellside (short increases, long decreases, closes and liquidations). A side holds up to 5 latest events, newest first, and the number of all its events in the candle. - Only increases, closes, force closes and liquidations are counted; funding and margin changes are not chart events.
- 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
BTCresolutionstring · enumrequiredCandle resolution to group events by, same values as the datafeed /history endpoint.
"1" "5" "15" "30" "60" "240" "1D"60fromintegerrequiredStart of the first candle, unix timestamp in seconds (inclusive).
- minimum
- 0
- maximum
- 9007199254740991
1767225600tointegerrequiredStart of the last candle, unix timestamp in seconds (inclusive).
- minimum
- 0
- maximum
- 9007199254740991
1768482000Examples
curl --request GET 'https://api.upscale.trade/positions/{accountId}/{asset}/chart-events/buckets' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY'const response = await fetch("https://api.upscale.trade/positions/{accountId}/{asset}/chart-events/buckets", {
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/buckets",
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
Array of ChartEventBucketResponse
timenumberrequiredStart of the candle, unix timestamp in seconds.
1767225600buyobjectrequiredBuy side: increases of long positions and decreases, closes and liquidations of short positions.
Object · 2 fields
totalCountnumberrequiredNumber of all events of this side in the candle.
12eventsobject[]requiredUp to 5 latest events of this side in the candle, 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"
}
]View example
{
"totalCount": 12,
"events": [
{
"asset": "BTC",
"direction": "long",
"eventName": "open",
"executedAt": 1767225599,
"price": "1000000000",
"size": "1000000000"
}
]
}sellobjectrequiredSell side: increases of short positions and decreases, closes and liquidations of long positions.
Object · 2 fields
totalCountnumberrequiredNumber of all events of this side in the candle.
12eventsobject[]requiredUp to 5 latest events of this side in the candle, 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"
}
]View example
{
"totalCount": 12,
"events": [
{
"asset": "BTC",
"direction": "long",
"eventName": "open",
"executedAt": 1767225599,
"price": "1000000000",
"size": "1000000000"
}
]
}[
{
"time": 1767225600,
"buy": {
"totalCount": 12,
"events": [
{
"asset": "BTC",
"direction": "long",
"eventName": "open",
"executedAt": 1767225599,
"price": "1000000000",
"size": "1000000000"
}
]
},
"sell": {
"totalCount": 12,
"events": [
{
"asset": "BTC",
"direction": "long",
"eventName": "open",
"executedAt": 1767225599,
"price": "1000000000",
"size": "1000000000"
}
]
}
}
]