---
title: "Calculate position"
method: GET
path: "/v2/orders/position/"
tags: ["Orders"]
---

# Calculate position

`GET /v2/orders/position/`

## Request

- Base URL: `https://magicmarkets.com` (the document declares no server; this is the origin it was published from)
- URL: `https://magicmarkets.com/v2/orders/position/`
- Auth: API key in header `X-Api-Key`

Calculate profit/loss position based on filtered orders. Accepts the same query parameters as the list orders endpoint.

## Query parameters

- `status` string[]
- `sport` string[]
- `event_id` string[]
- `order_type` string[]
- `date_from` string, date-time
- `date_to` string, date-time
- `search` string
- `include_cashout_info` boolean

## Response `200`

Position calculation

- PositionEnvelope
  - `status` 'ok'
  - `data` PositionResponse: Aggregate profit/loss position over the filtered orders. `sport`, `event_id` and `event_info` are present once the filters match at least one order.
    - `payoff_grid` PositionGrid, required: Profit or loss per scoreline, in USDT: `values[home_score][away_score]`. The grid is square and its size depends on the sport.
      - `ccy_code` string, required: Always USDT
      - `values` array[], required
        - number[]
    - `totals` object, required: Position per bet type, keyed by the unflipped bet type string
    - `unknown_bets_num` integer, required: Number of bets that could not be projected onto the grid
    - `unknown_grid` PositionGrid, required: Profit or loss per scoreline, in USDT: `values[home_score][away_score]`. The grid is square and its size depends on the sport.
      - `ccy_code` string, required: Always USDT
      - `values` array[], required
        - number[]
    - `sport` string
    - `event_id` string
    - `event_info` EventInfo
      - `event_type` 'normal' | 'multirunner' | 'parlay'
      - `event_id` string, nullable: null for parlay orders
      - `event_name` string, nullable
      - `home_id` integer, nullable: Normal events only
      - `home_team` string, nullable
      - `away_id` integer, nullable: Normal events only
      - `away_team` string, nullable
      - `competition_id` integer, nullable
      - `competition_name` string, nullable
      - `competition_country` string, nullable: ISO country code (e.g. XE for England)
      - `start_time` string, date-time, nullable
      - `date` string, date, nullable
      - `result` union: Match or race result. The shape depends on the sport - see the `EventResult*` schemas. Null while the result is unknown.
        - EventResultMatch: Football and other two-half sports. `ht_*` are the half-time score and are omitted for single-period sports; `ft_*` are the full-time score.
          - `ht_home` integer, nullable
          - `ht_away` integer, nullable
          - `ft_home` integer, nullable
          - `ft_away` integer, nullable
        - EventResultTennis: Tennis. `setN_pM` is player M's game count in set N.
          - `set1_p1` integer, nullable
          - `set1_p2` integer, nullable
          - `set2_p1` integer, nullable
          - `set2_p2` integer, nullable
          - `set3_p1` integer, nullable
          - `set3_p2` integer, nullable
          - `set4_p1` integer, nullable
          - `set4_p2` integer, nullable
          - `set5_p1` integer, nullable
          - `set5_p2` integer, nullable
          - `who_retired` integer, nullable: 1 or 2 if a player retired, else 0 or null
        - EventResultHockey: Ice hockey. `tpN_*` are the three period scores; `tall_*` the regulation total; `pen_*` the penalty-shootout score.
          - `tp1_home` integer, nullable
          - `tp1_away` integer, nullable
          - `tp2_home` integer, nullable
          - `tp2_away` integer, nullable
          - `tp3_home` integer, nullable
          - `tp3_away` integer, nullable
          - `tall_home` integer, nullable
          - `tall_away` integer, nullable
          - `pen_home` integer, nullable
          - `pen_away` integer, nullable
        - EventResultTableTennis: Table tennis. `gameN_*` is the point score in game N (up to 7 games).
          - `game1_home` integer, nullable
          - `game1_away` integer, nullable
          - `game2_home` integer, nullable
          - `game2_away` integer, nullable
          - `game3_home` integer, nullable
          - `game3_away` integer, nullable
          - `game4_home` integer, nullable
          - `game4_away` integer, nullable
          - `game5_home` integer, nullable
          - `game5_away` integer, nullable
          - `game6_home` integer, nullable
          - `game6_away` integer, nullable
          - `game7_home` integer, nullable
          - `game7_away` integer, nullable
        - EventResultMultirunner: Multirunner (outright) events.
          - `runner_results` object[]: Finishing positions per runner
            - `team_id` integer
            - `position` integer: 1=first, 2=second, 0=unknown, -1=void, -2=non-runner, -3=eliminated
          - `non_runner_count` integer
      - `teams` object[], nullable: Runner list (multirunner events only)
        - `team_id` integer
        - `name` string
      - `end_time` string, date-time, nullable: Race end time (multirunner events only)
      - `leg_event_infos` EventInfo[], nullable: Sub-event info for each leg (parlay orders only)
    - `cashout_info` PositionCashoutInfo: Cashout valuation for the position. Present on every non-multirunner position. Cashout is offered on football only; on every other sport, and whenever cashout is otherwise unavailable, `allowed` is false and every value below is null.
      - `allowed` boolean, required
      - `reason` string, nullable, required: Why cashout is unavailable, when it can be shared: `position_already_flat` or `insufficient_credit`.
      - `valuation` union[], required: [currency, amount] - e.g. ["USDT", 115.38]
        - union
          - string
          - number
      - `stake` union[], required: [currency, amount] - e.g. ["USDT", 115.38]
        - union
          - string
          - number
      - `smart_credit_delta` union[], required: [currency, amount] - e.g. ["USDT", 115.38]
        - union
          - string
          - number
      - `position` PositionGrid, required: Profit or loss per scoreline, in USDT: `values[home_score][away_score]`. The grid is square and its size depends on the sport.
        - `ccy_code` string, required: Always USDT
        - `values` array[], required
          - number[]

## Other responses

- `400`: The filters match orders from more than one event or sport
- `401`: Authentication failed - API key missing, malformed, or rejected.
- `403`: Authorization failed - the key is valid but cannot perform this action.
- `429`: Rate limit hit. Honour the `Retry-After` header.
- `500`: Unexpected internal error. Quote `data[1]` (the token) when contacting support.

---

[API](https://skmtc.dev/magicmarkets/apis/magicmarkets-api.md) · [All operations](https://skmtc.dev/magicmarkets/apis/magicmarkets-api/llms.txt) · [OpenAPI document](https://skmtc.dev/magicmarkets/apis/magicmarkets-api/revisions/00c2a7dcce2a?raw)
