{"format":"opendoc-document","version":1,"url":"https://docs.upscale.trade/developers/operations/getcharteventbuckets","title":"Get position events for chart indicators grouped by candles","description":"GET /positions/{accountId}/{asset}/chart-events/buckets: Position events of the account on one market grouped by candles of the requested resolution, oldest candle first.","kind":"api-operation","locale":"en","inLanguage":"en","lastModified":"2026-09-28T19:22:49.100Z","revision":"25c86f549328fcff320805d5945f4c9804e3927950d831e601d6e3b18c170f66","section":{"title":"Developers","url":"https://docs.upscale.trade/developers"},"representations":{"html":"https://docs.upscale.trade/developers/operations/getcharteventbuckets","markdown":"https://docs.upscale.trade/developers/operations/getcharteventbuckets.md","json":"https://docs.upscale.trade/developers/operations/getcharteventbuckets.json"},"translations":{"en":"https://docs.upscale.trade/developers/operations/getcharteventbuckets","ru":"https://docs.upscale.trade/ru/developers/operations/getcharteventbuckets","es":"https://docs.upscale.trade/es/developers/operations/getcharteventbuckets"},"operation":{"id":"getChartEventBuckets","method":"GET","path":"/positions/{accountId}/{asset}/chart-events/buckets","summary":"Get position events for chart indicators grouped by candles","description":"Position events of the account on one market grouped by candles of the requested resolution, oldest candle first.\n\n- 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\n  UTC midnight.\n- A candle is included when its start lies inside `[from, to]`; the distance between `from` and `to` may not exceed 350 candles.\n- Candles without events are omitted.\n- Each candle has a `buy` side (long increases, short decreases, closes and liquidations) and a `sell` side (short increases, long decreases,\n  closes and liquidations). A side holds up to 5 latest events, newest first, and the number of all its events in the candle.\n- Only increases, closes, force closes and liquidations are counted; funding and margin changes are not chart events.\n- Limited to the phase the account is currently in.","tags":["Trading"],"deprecated":false,"parameters":[{"name":"accountId","location":"path","schema":{"type":"string · uuid","types":["string"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"uuid","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})$"},"properties":[],"variants":[]},"type":"string · uuid","required":true,"description":"Trader account identifier. Must belong to the caller.","example":"00000000-0000-4000-8000-000000000000"},{"name":"asset","location":"path","schema":{"type":"string","types":["string"],"example":"BTC","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"minLength":1},"properties":[],"variants":[]},"type":"string","required":true,"description":"Base asset ticker of the market, as returned by `GET /v2/markets`.","example":"BTC"},{"name":"resolution","location":"query","schema":{"type":"string · enum","types":["string"],"example":"60","enum":["1","5","15","30","60","240","1D"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]},"type":"string · enum","required":true,"description":"Candle resolution to group events by, same values as the datafeed `/history` endpoint.","example":"60"},{"name":"from","location":"query","schema":{"type":"integer","types":["integer"],"example":1767225600,"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"minimum":0,"maximum":9007199254740991},"properties":[],"variants":[]},"type":"integer","required":true,"description":"Start of the first candle, unix timestamp in seconds (inclusive).","example":"1767225600"},{"name":"to","location":"query","schema":{"type":"integer","types":["integer"],"example":1768482000,"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"minimum":0,"maximum":9007199254740991},"properties":[],"variants":[]},"type":"integer","required":true,"description":"Start of the last candle, unix timestamp in seconds (inclusive).","example":"1768482000"}],"bodies":[],"responses":[{"status":"401","description":"Unauthorized","properties":[],"headers":[]},{"status":"403","description":"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`).","properties":[],"headers":[]},{"status":"404","description":"No account with this identifier, or no market for this ticker.","properties":[],"headers":[]},{"status":"429","description":"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`.","properties":[],"headers":[]},{"status":"default","description":"Response","mediaType":"application/json","properties":[],"schema":{"type":"object[]","types":["array"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"items":{"type":"object","types":["object"],"title":"ChartEventBucketResponse","reference":"#/components/schemas/ChartEventBucketResponse","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[{"name":"time","type":"number","required":true,"description":"Start of the candle, unix timestamp in seconds.","example":"1767225600","schema":{"type":"number","types":["number"],"description":"Start of the candle, unix timestamp in seconds.","example":1767225600,"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"buy","type":"object","required":true,"description":"Buy side: increases of long positions and decreases, closes and liquidations of short positions.","example":"{\n  \"totalCount\": 12,\n  \"events\": [\n    {\n      \"asset\": \"BTC\",\n      \"direction\": \"long\",\n      \"eventName\": \"open\",\n      \"executedAt\": 1767225599,\n      \"price\": \"1000000000\",\n      \"size\": \"1000000000\"\n    }\n  ]\n}","schema":{"type":"object","types":["object"],"title":"ChartEventSideGroupResponse","description":"Buy side: increases of long positions and decreases, closes and liquidations of short positions.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[{"name":"totalCount","type":"number","required":true,"description":"Number of all events of this side in the candle.","example":"12","schema":{"type":"number","types":["number"],"description":"Number of all events of this side in the candle.","example":12,"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"events","type":"object[]","required":true,"description":"Up to 5 latest events of this side in the candle, newest first.","example":"[\n  {\n    \"asset\": \"BTC\",\n    \"direction\": \"long\",\n    \"eventName\": \"open\",\n    \"executedAt\": 1767225599,\n    \"price\": \"1000000000\",\n    \"size\": \"1000000000\"\n  }\n]","schema":{"type":"object[]","types":["array"],"description":"Up to 5 latest events of this side in the candle, newest first.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"items":{"type":"object","types":["object"],"title":"ChartEventResponse","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[{"name":"asset","type":"string","required":true,"description":"Base asset ticker of the market the event happened on.","example":"BTC","schema":{"type":"string","types":["string"],"description":"Base asset ticker of the market the event happened on.","example":"BTC","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"direction","type":"string · enum","required":true,"description":"Direction of the position the event belongs to.","example":"long","schema":{"type":"string · enum","types":["string"],"description":"Direction of the position the event belongs to.","enum":["long","short"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"eventName","type":"string · enum","required":true,"description":"What 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.","example":"open","schema":{"type":"string · enum","types":["string"],"description":"What 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.","enum":["open","increase","decrease","close","liquidation"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"executedAt","type":"number","required":true,"description":"When the event happened, unix timestamp in seconds.","example":"1767225599","schema":{"type":"number","types":["number"],"description":"When the event happened, unix timestamp in seconds.","example":1767225599,"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"price","type":"string · int32","required":true,"description":"Price the event executed at, fp9 raw — exchanged quote over exchanged base.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Price the event executed at, fp9 raw — exchanged quote over exchanged base.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"size","type":"string · int32","required":true,"description":"Absolute size the event moved, in base asset units, fp9 raw.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Absolute size the event moved, in base asset units, fp9 raw.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}}],"variants":[]},"variants":[]}}],"variants":[]}},{"name":"sell","type":"object","required":true,"description":"Sell side: increases of short positions and decreases, closes and liquidations of long positions.","example":"{\n  \"totalCount\": 12,\n  \"events\": [\n    {\n      \"asset\": \"BTC\",\n      \"direction\": \"long\",\n      \"eventName\": \"open\",\n      \"executedAt\": 1767225599,\n      \"price\": \"1000000000\",\n      \"size\": \"1000000000\"\n    }\n  ]\n}","schema":{"type":"object","types":["object"],"title":"ChartEventSideGroupResponse","description":"Sell side: increases of short positions and decreases, closes and liquidations of long positions.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[{"name":"totalCount","type":"number","required":true,"description":"Number of all events of this side in the candle.","example":"12","schema":{"type":"number","types":["number"],"description":"Number of all events of this side in the candle.","example":12,"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"events","type":"object[]","required":true,"description":"Up to 5 latest events of this side in the candle, newest first.","example":"[\n  {\n    \"asset\": \"BTC\",\n    \"direction\": \"long\",\n    \"eventName\": \"open\",\n    \"executedAt\": 1767225599,\n    \"price\": \"1000000000\",\n    \"size\": \"1000000000\"\n  }\n]","schema":{"type":"object[]","types":["array"],"description":"Up to 5 latest events of this side in the candle, newest first.","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"items":{"type":"object","types":["object"],"title":"ChartEventResponse","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[{"name":"asset","type":"string","required":true,"description":"Base asset ticker of the market the event happened on.","example":"BTC","schema":{"type":"string","types":["string"],"description":"Base asset ticker of the market the event happened on.","example":"BTC","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"direction","type":"string · enum","required":true,"description":"Direction of the position the event belongs to.","example":"long","schema":{"type":"string · enum","types":["string"],"description":"Direction of the position the event belongs to.","enum":["long","short"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"eventName","type":"string · enum","required":true,"description":"What 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.","example":"open","schema":{"type":"string · enum","types":["string"],"description":"What 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.","enum":["open","increase","decrease","close","liquidation"],"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"executedAt","type":"number","required":true,"description":"When the event happened, unix timestamp in seconds.","example":"1767225599","schema":{"type":"number","types":["number"],"description":"When the event happened, unix timestamp in seconds.","example":1767225599,"nullable":false,"readOnly":false,"writeOnly":false,"constraints":{},"properties":[],"variants":[]}},{"name":"price","type":"string · int32","required":true,"description":"Price the event executed at, fp9 raw — exchanged quote over exchanged base.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Price the event executed at, fp9 raw — exchanged quote over exchanged base.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}},{"name":"size","type":"string · int32","required":true,"description":"Absolute size the event moved, in base asset units, fp9 raw.","example":"1000000000","schema":{"type":"string · int32","types":["string"],"description":"Absolute size the event moved, in base asset units, fp9 raw.","example":"1000000000","nullable":false,"readOnly":false,"writeOnly":false,"constraints":{"format":"int32","pattern":"^(?:-?[1-9][0-9]*|0)$"},"properties":[],"variants":[]}}],"variants":[]},"variants":[]}}],"variants":[]}}],"variants":[]},"variants":[]},"example":"[\n  {\n    \"time\": 1767225600,\n    \"buy\": {\n      \"totalCount\": 12,\n      \"events\": [\n        {\n          \"asset\": \"BTC\",\n          \"direction\": \"long\",\n          \"eventName\": \"open\",\n          \"executedAt\": 1767225599,\n          \"price\": \"1000000000\",\n          \"size\": \"1000000000\"\n        }\n      ]\n    },\n    \"sell\": {\n      \"totalCount\": 12,\n      \"events\": [\n        {\n          \"asset\": \"BTC\",\n          \"direction\": \"long\",\n          \"eventName\": \"open\",\n          \"executedAt\": 1767225599,\n          \"price\": \"1000000000\",\n          \"size\": \"1000000000\"\n        }\n      ]\n    }\n  }\n]","headers":[]}],"security":[{"name":"bearer","type":"http · bearer","description":"Personal API key, prefixed with `usk_`.","required":true,"scopes":[]}],"codeSamples":[{"label":"cURL","language":"bash","source":"curl --request GET 'https://api.upscale.trade/positions/{accountId}/{asset}/chart-events/buckets' \\\n  --header 'Accept: application/json' \\\n  --header 'Authorization: Bearer YOUR_API_KEY'"},{"label":"JavaScript","language":"javascript","source":"const response = await fetch(\"https://api.upscale.trade/positions/{accountId}/{asset}/chart-events/buckets\", {\n  method: \"GET\",\n  headers: {\n    \"Accept\": \"application/json\",\n    \"Authorization\": \"Bearer YOUR_API_KEY\"\n  },\n});\nconsole.log(response.status, await response.text());"},{"label":"Python","language":"python","source":"import requests\n\nresponse = requests.request(\n    \"GET\",\n    \"https://api.upscale.trade/positions/{accountId}/{asset}/chart-events/buckets\",\n    headers={\"Accept\":\"application/json\",\"Authorization\":\"Bearer YOUR_API_KEY\"},\n    timeout=30,\n)\nprint(response.status_code, response.text)"}]},"breadcrumbs":[{"title":"What is Prop Trading","url":"https://docs.upscale.trade"},{"title":"Developers","url":"https://docs.upscale.trade/developers"},{"title":"Get position events for chart indicators grouped by candles","url":"https://docs.upscale.trade/developers/operations/getcharteventbuckets"}],"headings":[{"depth":2,"id":"authorization","title":"Authorization"},{"depth":2,"id":"parameters","title":"Parameters"},{"depth":2,"id":"examples","title":"Examples"},{"depth":2,"id":"responses","title":"Responses"}],"markdown":"# Get position events for chart indicators grouped by candles\n\n`GET /positions/{accountId}/{asset}/chart-events/buckets`\n\nPosition events of the account on one market grouped by candles of the requested resolution, oldest candle first.\n\n- 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\n  UTC midnight.\n- A candle is included when its start lies inside `[from, to]`; the distance between `from` and `to` may not exceed 350 candles.\n- Candles without events are omitted.\n- Each candle has a `buy` side (long increases, short decreases, closes and liquidations) and a `sell` side (short increases, long decreases,\n  closes and liquidations). A side holds up to 5 latest events, newest first, and the number of all its events in the candle.\n- Only increases, closes, force closes and liquidations are counted; funding and margin changes are not chart events.\n- Limited to the phase the account is currently in.\n\n## Authorization\n\nbearer: http · bearer (required). Personal API key, prefixed with `usk_`.\n\n## Parameters\n\n- path: accountId (string · uuid; required). Trader account identifier. Must belong to the caller.\n\nType: string · uuid\n\nformat: uuid\n\npattern: ^([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})$\n\n- path: asset (string; required). Base asset ticker of the market, as returned by `GET /v2/markets`.\n\nType: string\n\nExample: \"BTC\"\n\nminLength: 1\n\n- query: resolution (string · enum; required). Candle resolution to group events by, same values as the datafeed `/history` endpoint.\n\nType: string · enum\n\nExample: \"60\"\n\nAllowed values: [\"1\",\"5\",\"15\",\"30\",\"60\",\"240\",\"1D\"]\n\n- query: from (integer; required). Start of the first candle, unix timestamp in seconds (inclusive).\n\nType: integer\n\nExample: 1767225600\n\nminimum: 0\n\nmaximum: 9007199254740991\n\n- query: to (integer; required). Start of the last candle, unix timestamp in seconds (inclusive).\n\nType: integer\n\nExample: 1768482000\n\nminimum: 0\n\nmaximum: 9007199254740991\n\n## Example · cURL\n\n```bash\ncurl --request GET 'https://api.upscale.trade/positions/{accountId}/{asset}/chart-events/buckets' \\\n  --header 'Accept: application/json' \\\n  --header 'Authorization: Bearer YOUR_API_KEY'\n```\n\n## Example · JavaScript\n\n```javascript\nconst response = await fetch(\"https://api.upscale.trade/positions/{accountId}/{asset}/chart-events/buckets\", {\n  method: \"GET\",\n  headers: {\n    \"Accept\": \"application/json\",\n    \"Authorization\": \"Bearer YOUR_API_KEY\"\n  },\n});\nconsole.log(response.status, await response.text());\n```\n\n## Example · Python\n\n```python\nimport requests\n\nresponse = requests.request(\n    \"GET\",\n    \"https://api.upscale.trade/positions/{accountId}/{asset}/chart-events/buckets\",\n    headers={\"Accept\":\"application/json\",\"Authorization\":\"Bearer YOUR_API_KEY\"},\n    timeout=30,\n)\nprint(response.status_code, response.text)\n```\n\n## Response 401\n\n**401**  — Unauthorized\n\n## Response 403\n\n**403**  — 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`).\n\n## Response 404\n\n**404**  — No account with this identifier, or no market for this ticker.\n\n## Response 429\n\n**429**  — 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`.\n\n## Response default · ChartEventBucketResponse\n\n**default** application/json — Response\n\nType: object[]\n\n[]Schema: ChartEventBucketResponse\n\n[]Type: object\n\n[]Required fields: time, buy, sell\n\n[]Required field types: time (number; required), buy (object; required), sell (object; required)\n\n- []time (number; required)\n\n[]time example: 1767225600\n\n[]time.Type: number\n\n[]time.Start of the candle, unix timestamp in seconds.\n\n- []buy (object; required)\n\n[]buy example: {\n  \"totalCount\": 12,\n  \"events\": [\n    {\n      \"asset\": \"BTC\",\n      \"direction\": \"long\",\n      \"eventName\": \"open\",\n      \"executedAt\": 1767225599,\n      \"price\": \"1000000000\",\n      \"size\": \"1000000000\"\n    }\n  ]\n}\n\n[]buy.Type: object\n\n[]buy.Required fields: totalCount, events\n\n[]buy.Required field types: totalCount (number; required), events (object[]; required)\n\n[]buy.Buy side: increases of long positions and decreases, closes and liquidations of short positions.\n\n- []buy.totalCount (number; required)\n\n[]buy.totalCount example: 12\n\n[]buy.totalCount.Type: number\n\n[]buy.totalCount.Number of all events of this side in the candle.\n\n- []buy.events (object[]; required)\n\n[]buy.events example: [\n  {\n    \"asset\": \"BTC\",\n    \"direction\": \"long\",\n    \"eventName\": \"open\",\n    \"executedAt\": 1767225599,\n    \"price\": \"1000000000\",\n    \"size\": \"1000000000\"\n  }\n]\n\n[]buy.events.Type: object[]\n\n[]buy.events.Up to 5 latest events of this side in the candle, newest first.\n\n[]buy.events.[]Type: object\n\n[]buy.events.[]Required fields: asset, direction, eventName, executedAt, price, size\n\n[]buy.events.[]Required field types: asset (string; required), direction (string · enum; required), eventName (string · enum; required), executedAt (number; required), price (string · int32; required), size (string · int32; required)\n\n- []buy.events.[]asset (string; required)\n\n[]buy.events.[]asset example: BTC\n\n[]buy.events.[]asset.Type: string\n\n[]buy.events.[]asset.Base asset ticker of the market the event happened on.\n\n- []buy.events.[]direction (string · enum; required)\n\n[]buy.events.[]direction example: long\n\n[]buy.events.[]direction.Type: string · enum\n\n[]buy.events.[]direction.Direction of the position the event belongs to.\n\n[]buy.events.[]direction.Allowed values: [\"long\",\"short\"]\n\n- []buy.events.[]eventName (string · enum; required)\n\n[]buy.events.[]eventName example: open\n\n[]buy.events.[]eventName.Type: string · enum\n\n[]buy.events.[]eventName.What 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.\n\n[]buy.events.[]eventName.Allowed values: [\"open\",\"increase\",\"decrease\",\"close\",\"liquidation\"]\n\n- []buy.events.[]executedAt (number; required)\n\n[]buy.events.[]executedAt example: 1767225599\n\n[]buy.events.[]executedAt.Type: number\n\n[]buy.events.[]executedAt.When the event happened, unix timestamp in seconds.\n\n- []buy.events.[]price (string · int32; required)\n\n[]buy.events.[]price example: 1000000000\n\n[]buy.events.[]price.Type: string · int32\n\n[]buy.events.[]price.Price the event executed at, fp9 raw — exchanged quote over exchanged base.\n\n[]buy.events.[]price.format: int32\n\n[]buy.events.[]price.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- []buy.events.[]size (string · int32; required)\n\n[]buy.events.[]size example: 1000000000\n\n[]buy.events.[]size.Type: string · int32\n\n[]buy.events.[]size.Absolute size the event moved, in base asset units, fp9 raw.\n\n[]buy.events.[]size.format: int32\n\n[]buy.events.[]size.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- []sell (object; required)\n\n[]sell example: {\n  \"totalCount\": 12,\n  \"events\": [\n    {\n      \"asset\": \"BTC\",\n      \"direction\": \"long\",\n      \"eventName\": \"open\",\n      \"executedAt\": 1767225599,\n      \"price\": \"1000000000\",\n      \"size\": \"1000000000\"\n    }\n  ]\n}\n\n[]sell.Type: object\n\n[]sell.Required fields: totalCount, events\n\n[]sell.Required field types: totalCount (number; required), events (object[]; required)\n\n[]sell.Sell side: increases of short positions and decreases, closes and liquidations of long positions.\n\n- []sell.totalCount (number; required)\n\n[]sell.totalCount example: 12\n\n[]sell.totalCount.Type: number\n\n[]sell.totalCount.Number of all events of this side in the candle.\n\n- []sell.events (object[]; required)\n\n[]sell.events example: [\n  {\n    \"asset\": \"BTC\",\n    \"direction\": \"long\",\n    \"eventName\": \"open\",\n    \"executedAt\": 1767225599,\n    \"price\": \"1000000000\",\n    \"size\": \"1000000000\"\n  }\n]\n\n[]sell.events.Type: object[]\n\n[]sell.events.Up to 5 latest events of this side in the candle, newest first.\n\n[]sell.events.[]Type: object\n\n[]sell.events.[]Required fields: asset, direction, eventName, executedAt, price, size\n\n[]sell.events.[]Required field types: asset (string; required), direction (string · enum; required), eventName (string · enum; required), executedAt (number; required), price (string · int32; required), size (string · int32; required)\n\n- []sell.events.[]asset (string; required)\n\n[]sell.events.[]asset example: BTC\n\n[]sell.events.[]asset.Type: string\n\n[]sell.events.[]asset.Base asset ticker of the market the event happened on.\n\n- []sell.events.[]direction (string · enum; required)\n\n[]sell.events.[]direction example: long\n\n[]sell.events.[]direction.Type: string · enum\n\n[]sell.events.[]direction.Direction of the position the event belongs to.\n\n[]sell.events.[]direction.Allowed values: [\"long\",\"short\"]\n\n- []sell.events.[]eventName (string · enum; required)\n\n[]sell.events.[]eventName example: open\n\n[]sell.events.[]eventName.Type: string · enum\n\n[]sell.events.[]eventName.What 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.\n\n[]sell.events.[]eventName.Allowed values: [\"open\",\"increase\",\"decrease\",\"close\",\"liquidation\"]\n\n- []sell.events.[]executedAt (number; required)\n\n[]sell.events.[]executedAt example: 1767225599\n\n[]sell.events.[]executedAt.Type: number\n\n[]sell.events.[]executedAt.When the event happened, unix timestamp in seconds.\n\n- []sell.events.[]price (string · int32; required)\n\n[]sell.events.[]price example: 1000000000\n\n[]sell.events.[]price.Type: string · int32\n\n[]sell.events.[]price.Price the event executed at, fp9 raw — exchanged quote over exchanged base.\n\n[]sell.events.[]price.format: int32\n\n[]sell.events.[]price.pattern: ^(?:-?[1-9][0-9]*|0)$\n\n- []sell.events.[]size (string · int32; required)\n\n[]sell.events.[]size example: 1000000000\n\n[]sell.events.[]size.Type: string · int32\n\n[]sell.events.[]size.Absolute size the event moved, in base asset units, fp9 raw.\n\n[]sell.events.[]size.format: int32\n\n[]sell.events.[]size.pattern: ^(?:-?[1-9][0-9]*|0)$\n\nExample\n\n\n\n```json\n[\n  {\n    \"time\": 1767225600,\n    \"buy\": {\n      \"totalCount\": 12,\n      \"events\": [\n        {\n          \"asset\": \"BTC\",\n          \"direction\": \"long\",\n          \"eventName\": \"open\",\n          \"executedAt\": 1767225599,\n          \"price\": \"1000000000\",\n          \"size\": \"1000000000\"\n        }\n      ]\n    },\n    \"sell\": {\n      \"totalCount\": 12,\n      \"events\": [\n        {\n          \"asset\": \"BTC\",\n          \"direction\": \"long\",\n          \"eventName\": \"open\",\n          \"executedAt\": 1767225599,\n          \"price\": \"1000000000\",\n          \"size\": \"1000000000\"\n        }\n      ]\n    }\n  }\n]\n```","text":"Get position events for chart indicators grouped by candles Position 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 between `from` and `to` may not exceed 350 candles. - Candles without events are omitted. - Each candle has a `buy` side (long increases, short decreases, closes and liquidations) and a `sell` side (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. GET /positions/{accountId}/{asset}/chart-events/buckets Trading accountId Trader account identifier. Must belong to the caller. string · uuid asset Base asset ticker of the market, as returned by `GET /v2/markets`. string resolution Candle resolution to group events by, same values as the datafeed `/history` endpoint. string · enum from Start of the first candle, unix timestamp in seconds (inclusive). integer to Start of the last candle, unix timestamp in seconds (inclusive). integer 401 Unauthorized 403 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`). 404 No account with this identifier, or no market for this ticker. 429 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`. default Response","api":{"title":"Upscale Public API","version":"d796ac9","documentation":"https://docs.upscale.trade/developers","playgroundServer":"https://api.upscale.trade"}}