# Get position events for chart indicators by ticker

`GET /positions/{accountId}/{asset}/chart-events`

Position 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 `executedFrom` and `executedTo`, both inclusive.
- Limited to the phase the account is currently in.

## Authorization

bearer: http · bearer (required). Personal API key, prefixed with `usk_`.

## Parameters

- path: accountId (string · uuid; required). Trader account identifier. Must belong to the caller.

Type: string · uuid

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})$

- path: asset (string; required). Base asset ticker of the market, as returned by `GET /v2/markets`.

Type: string

Example: "BTC"

minLength: 1

- query: executedFrom (number; required). Executed from, unix timestamp in seconds (inclusive)

Type: number

Example: 1735689600

- query: executedTo (number; required). Executed to, unix timestamp in seconds (inclusive)

Type: number

Example: 1767225599

- query: limit (integer; optional). Page size: how many events to return.

Type: integer

Example: 20

Default: 20

minimum: 1

maximum: 1000

- query: offset (integer; optional). How many events to skip before the page.

Type: integer

Example: 0

Default: 0

minimum: 0

maximum: 9007199254740991

## Example · cURL

```bash
curl --request GET 'https://api.upscale.trade/positions/{accountId}/{asset}/chart-events' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_API_KEY'
```

## Example · JavaScript

```javascript
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());
```

## Example · Python

```python
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)
```

## Response 401

**401**  — Unauthorized

## Response 403

**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`).

## Response 404

**404**  — No account with this identifier, or no market for this ticker.

## Response 429

**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`.

## Response default · ChartEventsPaginatedResponse

**default** application/json — Response

Schema: ChartEventsPaginatedResponse

Type: object

Required fields: data, totalCount

Required field types: data (object[]; required), totalCount (number; required)

- data (object[]; required)

data example: [
  {
    "asset": "BTC",
    "direction": "long",
    "eventName": "open",
    "executedAt": 1767225599,
    "price": "1000000000",
    "size": "1000000000"
  }
]

data.Type: object[]

data.Requested page of chart markers, newest first.

data.[]Type: object

data.[]Required fields: asset, direction, eventName, executedAt, price, size

data.[]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)

- data.[]asset (string; required)

data.[]asset example: BTC

data.[]asset.Type: string

data.[]asset.Base asset ticker of the market the event happened on.

- data.[]direction (string · enum; required)

data.[]direction example: long

data.[]direction.Type: string · enum

data.[]direction.Direction of the position the event belongs to.

data.[]direction.Allowed values: ["long","short"]

- data.[]eventName (string · enum; required)

data.[]eventName example: open

data.[]eventName.Type: string · enum

data.[]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.

data.[]eventName.Allowed values: ["open","increase","decrease","close","liquidation"]

- data.[]executedAt (number; required)

data.[]executedAt example: 1767225599

data.[]executedAt.Type: number

data.[]executedAt.When the event happened, unix timestamp in seconds.

- data.[]price (string · int32; required)

data.[]price example: 1000000000

data.[]price.Type: string · int32

data.[]price.Price the event executed at, fp9 raw — exchanged quote over exchanged base.

data.[]price.format: int32

data.[]price.pattern: ^(?:-?[1-9][0-9]*|0)$

- data.[]size (string · int32; required)

data.[]size example: 1000000000

data.[]size.Type: string · int32

data.[]size.Absolute size the event moved, in base asset units, fp9 raw.

data.[]size.format: int32

data.[]size.pattern: ^(?:-?[1-9][0-9]*|0)$

- totalCount (number; required)

totalCount example: 0

totalCount.Type: number

totalCount.Total number of events in the requested range, across all pages.

Example



```json
{
  "data": [
    {
      "asset": "BTC",
      "direction": "long",
      "eventName": "open",
      "executedAt": 1767225599,
      "price": "1000000000",
      "size": "1000000000"
    }
  ],
  "totalCount": 0
}
```