Saxo Bank ClosedPositions API

Read only end points serving closed positions and the underlying closed positions making up the net closed position. The set of closed positions is restricted by the supplied query parameters as well as whether or not the identity represented by the authorization token has access to the account on which the positions are posted. * A user of a client will have access to accounts under that client * A user of an IB or WLC will have access to accounts on that client or clients there under * An employee has access to all accounts * A request containing a TradingFloor "Federated Access" token will have access to the account specified in that token. * If access is granted on the basis of the TradingFloor "Federated Access" token, then the number of fields will be a subset of the full set of fields shown in the specification for the response.

Operations 8

DELETE /port/v1/closedpositions/subscriptions/{ContextId} Remove multiple subscriptions #
DELETE /port/v1/closedpositions/subscriptions/{ContextId}/{ReferenceId} Remove subscription #
PATCH /port/v1/closedpositions/subscriptions/{ContextId}/{ReferenceId} Change the closed positions subscription page size #
POST /port/v1/closedpositions/subscriptions Create a subscription on a list of closed positions and make it active #
GET /port/v1/closedpositions/{ClosedPositionId}/details Get detailed information for a single position #
GET /port/v1/closedpositions/{ClosedPositionId} Get a single position #
GET /port/v1/closedpositions/me Get closed positions for a client, to which the logged in user belongs #
GET /port/v1/closedpositions Get closed positions for a client, accountGroup or account #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/saxo-closedpositions-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

saxo-closedpositions-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Services.AutoTrading Account Values Closed Positions API
  description: 'The AutoTrading service group provides endpoints for interacting with Saxo Bank''s SaxoSelect offering.Through these interfaces a client application can get Saxo Select trade leaders, portfolios and investments. Portfolio investments can be created and modifed.<div class=well style=''border: 1px solid rgb(204, 82, 0); border-image: none; background-color: rgb(255, 209, 179);padding:1px;''><strong> Note:</strong> </br>This service is subject to special licensing agreements and not generally available to all OpenAPI applications.</div>'
  version: 2.4.138+710c760591
  x-framework-version: 38.0.2+439c5b0ec3
  x-machine: SIMOAWEB11-DK2
servers:
- url: https://gateway.saxobank.com/sim/openapi
tags:
- name: ClosedPositions
  description: "Read only end points serving closed positions and the underlying closed positions making up the net closed position.\n            The set of closed positions is restricted by the supplied query parameters as well as whether or not the identity \n            represented by the authorization token has access to the account on which the positions are posted.\n\n*   A user of a client will have access to accounts under that client\n*   A user of an IB or WLC will have access to accounts on that client or clients there under \n*   An employee has access to all accounts\n*   A request containing a TradingFloor \"Federated Access\" token will have access to the account specified in that token.\n*   If access is granted on the basis of the TradingFloor \"Federated Access\" token, then the number of fields will be a subset \n                of the full set of fields shown in the specification for the response."
paths:
  /port/v1/closedpositions/subscriptions/{ContextId}:
    delete:
      tags:
      - ClosedPositions
      summary: Remove multiple subscriptions
      description: Removes multiple all subscriptions for the current session on this resource, and frees all resources on the server.
      operationId: ClosedPositionsV1DeleteSubscriptions
      parameters:
      - name: ContextId
        in: path
        description: The context id part of the streaming session (used to identify the subscription within a streaming session).
        required: true
        schema:
          type: string
        example: '29931122'
      - name: Tag
        in: query
        description: Optional. Remove only subscriptions that are marked with specified tag.
        schema:
          type: string
        example: '2345223'
      responses:
        '204':
          description: No Content
        '202':
          description: Subscription delete request will be processed eventually.
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - OpenApiOAuthSecurityScheme: []
      - OpenApiJWTSecurityScheme: []
      x-required-permissions:
        personal: Subscribe
        community: Subscribe
  /port/v1/closedpositions/subscriptions/{ContextId}/{ReferenceId}:
    delete:
      tags:
      - ClosedPositions
      summary: Remove subscription
      description: Removes subscription for the current session identified by subscription id..
      operationId: ClosedPositionsV1DeleteSubscription
      parameters:
      - name: ContextId
        in: path
        description: The context id part of the streaming session (used to identify the subscription within a streaming session).
        required: true
        schema:
          type: string
        example: '29931122'
      - name: ReferenceId
        in: path
        description: Unique id of the subscription
        required: true
        schema:
          type: string
        example: 0f8fad5b-d9cb-469f-a165-70867728950e
      responses:
        '204':
          description: No Content
        '202':
          description: Subscription delete request will be processed eventually.
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - OpenApiOAuthSecurityScheme: []
      - OpenApiJWTSecurityScheme: []
      x-required-permissions:
        personal: Subscribe
        community: Subscribe
    patch:
      tags:
      - ClosedPositions
      summary: Change the closed positions subscription page size
      description: Extends or reduces the page size, number of positions shown, on a running closed positions subscription. When expanding the page size, the subsequent closed positions are streamed so to avoid race conditions.
      operationId: ClosedPositionsV1UpdateClosedPositionSubscriptionPagesize
      parameters:
      - name: ContextId
        in: path
        description: The context id part of the streaming session.
        required: true
        schema:
          type: string
        example: '29931122'
      - name: ReferenceId
        in: path
        description: Unique ID of the subscription
        required: true
        schema:
          type: string
        example: P54123
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PositionPagingSubscriptionUpdateRequest'
            example:
              NewPageSize: 99
      responses:
        '204':
          description: No Content
        '202':
          description: Subscription change will be processed and respose will be streamed.
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - OpenApiOAuthSecurityScheme: []
      - OpenApiJWTSecurityScheme: []
      x-required-permissions:
        personal: Subscribe
        community: Subscribe
  /port/v1/closedpositions/subscriptions:
    post:
      tags:
      - ClosedPositions
      summary: Create a subscription on a list of closed positions and make it active
      description: Sets up a subscription and returns an initial snapshot of list of closed positions specified by the parameters in the request.
      operationId: ClosedPositionsV1AddActiveSubscription
      parameters:
      - name: $top
        in: query
        description: The number of entries to return from the beginning of the collection
        schema:
          minimum: 0
          type: integer
          format: int32
          default: 0
        example: 1
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClosedPositionsSubscriptionRequest'
            example:
              Arguments:
                AccountGroupKey: LZTc7DdejXODf-WSl2aCyQ==
                AccountKey: LZTc7DdejXODf-WSl2aCyQ==
                ClientKey: 7m4I|vtYLUnEGg77o9uQhw==
                ClosedPositionId: 139597294-139694249
                FieldGroups:
                - ClosedPosition
              ContextId: '20221030064907102'
              Format: application/json
              ReferenceId: CP35618
              RefreshRate: 1000
              Tag: PAGE1
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClosedPositionsSubscriptionResponse'
              example:
                Format: application/json
                InactivityTimeout: 120
                ReferenceId: CP50382
                RefreshRate: 1000
                Snapshot:
                  Data:
                  - ClosedPosition:
                      AccountId: 192134INET
                      Amount: 300000
                      AssetType: FxSpot
                      BuyOrSell: Buy
                      ClientId: '654321'
                      ClosedProfitLoss: 9597
                      ClosedProfitLossInBaseCurrency: 9597
                      ClosingMarketValue: 0
                      ClosingMarketValueInBaseCurrency: 0
                      ClosingMethod: Explicit
                      ClosingPositionId: '139694249'
                      ClosingPrice: 1.09139
                      ConversionRateInstrumentToBaseSettledClosing: false
                      ConversionRateInstrumentToBaseSettledOpening: true
                      ExecutionTimeClose: '2017-05-02T00:00:00Z'
                      ExecutionTimeOpen: '2017-04-12T00:00:00Z'
                      OpeningPositionId: '139597294'
                      OpenPrice: 1.0594
                      Uic: 21
                    ClosedPositionUniqueId: 139597294-139694249
                    NetPositionId: EURUSD_FxSpot
                State: Active
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                required:
                - ErrorCode
                - Message
                type: object
                properties:
                  ErrorCode:
                    enum:
                    - InvalidClientId
                    - InvalidInput
                    - InvalidModelState
                    - NoValidInput
                    - SubscriptionExceedesPositionsLimit
                    - UnsupportedSubscriptionFormat
                    type: string
                    example: None
                    x-enum-descriptions:
                      InvalidModelState: Error code returned when model state is invalid.
                      UnsupportedSubscriptionFormat: Error code returned when a subscription format that isn't supported by the publisher is requested.
                      InvalidClientId: Indicates that the requested client id was invalid.
                      InvalidInput: An error was encountered when processing given input parameters.
                      NoValidInput: No valid input values passed.
                      SubscriptionExceedesPositionsLimit: Too many positions requested. Streaming updates are only allowed on a limited number of positions.
                  Message:
                    type: string
                  ModelState:
                    $ref: '#/components/schemas/ModelStateDictionary'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                required:
                - ErrorCode
                - Message
                type: object
                properties:
                  ErrorCode:
                    enum:
                    - SubscriptionLimitExceeded
                    type: string
                    example: None
                    x-enum-descriptions:
                      SubscriptionLimitExceeded: Error code returned when more than the maximum allowed number of subscriptions for a specified type, is exceeded.
                  Message:
                    type: string
                  ModelState:
                    $ref: '#/components/schemas/ModelStateDictionary'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - OpenApiOAuthSecurityScheme: []
      - OpenApiJWTSecurityScheme: []
      x-required-permissions:
        personal: Subscribe
        community: Subscribe
      x-streaming-type:
        $ref: '#/components/schemas/ClosedPositionResponseArray'
  /port/v1/closedpositions/{ClosedPositionId}/details:
    get:
      tags:
      - ClosedPositions
      summary: Get detailed information for a single position
      description: "Obsolete Gets detailed information about a single position as specified by the query parameters.\n            NOTE: This endpoint will be deprecated by November 2022. All functionality has been migrated to /port/v1/closedpositions/{ClosedPositionId}."
      operationId: ClosedPositionsV1GetPositionDetails
      parameters:
      - name: AccountGroupKey
        in: query
        description: The key of the account group to which the closed positions belongs.
        schema:
          title: The key of the account group to which the closed positions belongs.
          minLength: 1
          type: string
          x-type-name: AccountGroupKey
        example: stringValue
      - name: AccountKey
        in: query
        description: The key of the account to which the closed positions belongs.
        schema:
          title: The key of the account to which the closed positions belongs.
          minLength: 1
          type: string
          x-type-name: AccountKey
        example: 01b64edf-da03-4145-bf33-ae21527d4c86
      - name: ClientKey
        in: query
        description: The key of the client to which the closesd positions belongs.
        required: true
        schema:
          title: The key of the client to which the closesd positions belongs.
          minLength: 1
          type: string
          x-type-name: ClientKey
        example: 493b43a5-fe85-4d1f-9071-dd4a9d4e42a4
      - name: ClosedPositionId
        in: path
        description: Unique id of the position.
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClosedPositionDetailedResponse'
              example:
                ClosedPosition:
                  AccountId: 192134INET
                  Amount: 300000
                  AssetType: FxSpot
                  BuyOrSell: Buy
                  ClientId: '654321'
                  ClosedProfitLoss: 9597
                  ClosedProfitLossInBaseCurrency: 9597
                  ClosingMarketValue: 0
                  ClosingMarketValueInBaseCurrency: 0
                  ClosingMethod: Explicit
                  ClosingPositionId: '139694249'
                  ClosingPrice: 1.09139
                  ConversionRateInstrumentToBaseSettledClosing: false
                  ConversionRateInstrumentToBaseSettledOpening: true
                  ExecutionTimeClose: '2017-05-02T00:00:00Z'
                  ExecutionTimeOpen: '2017-04-12T00:00:00Z'
                  OpeningPositionId: '139597294'
                  OpenPrice: 1.0594
                  Uic: 21
                ClosedPositionDetails:
                  CurrencyConversionRateInstrumentToBaseClosing: 1
                  CurrencyConversionRateInstrumentToBaseOpening: 1
                  ValueDateClose: '2017-05-04T00:00:00Z'
                  ValueDateOpen: '2017-05-04T00:00:00Z'
                ClosedPositionUniqueId: 139597294-139694249
                DisplayAndFormat:
                  Currency: USD
                  Decimals: 4
                  Description: Euro/US Dollar
                  Format: AllowDecimalPips
                  Symbol: EURUSD
                Exchange:
                  Description: Inter Bank
                  ExchangeId: SBFX
                  IsOpen: true
                NetPositionId: EURUSD_FxSpot
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                required:
                - ErrorCode
                - Message
                type: object
                properties:
                  ErrorCode:
                    enum:
                    - InvalidClientId
                    - PositionIdNotSpecified
                    type: string
                    example: None
                    x-enum-descriptions:
                      PositionIdNotSpecified: Position not specified.
                      InvalidClientId: Indicates that the requested client id was invalid.
                  Message:
                    type: string
                  ModelState:
                    $ref: '#/components/schemas/ModelStateDictionary'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      deprecated: true
      security:
      - OpenApiOAuthSecurityScheme: []
      - OpenApiJWTSecurityScheme: []
      x-required-permissions:
        personal: Read
        community: Read
  /port/v1/closedpositions/{ClosedPositionId}:
    get:
      tags:
      - ClosedPositions
      summary: Get a single position
      description: Get a single position.
      operationId: ClosedPositionsV1GetClosedPosition
      parameters:
      - name: AccountGroupKey
        in: query
        description: The key of the account group to which the closed positions belongs.
        schema:
          title: The key of the account group to which the closed positions belongs.
          minLength: 1
          type: string
          x-type-name: AccountGroupKey
        example: stringValue
      - name: AccountKey
        in: query
        description: The key of the account to which the closed positions belongs.
        schema:
          title: The key of the account to which the closed positions belongs.
          minLength: 1
          type: string
          x-type-name: AccountKey
        example: 01b64edf-da03-4145-bf33-ae21527d4c86
      - name: ClientKey
        in: query
        description: The key of the client to which the closesd positions belongs.
        required: true
        schema:
          title: The key of the client to which the closesd positions belongs.
          minLength: 1
          type: string
          x-type-name: ClientKey
        example: 493b43a5-fe85-4d1f-9071-dd4a9d4e42a4
      - name: ClosedPositionId
        in: path
        description: Unique id of the position.
        required: true
        schema:
          type: string
      - name: FieldGroups
        in: query
        description: Specifies which data to return. Default is [ClosedPosition]
        schema:
          title: Specifies which data to return. Default is [ClosedPosition]
          type: array
          items:
            $ref: '#/components/schemas/ClosedPositionFieldGroup'
        example:
        - DisplayAndFormat
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClosedPositionResponse'
              example:
                ClosedPosition:
                  AccountId: 192134INET
                  Amount: 300000
                  AssetType: FxSpot
                  BuyOrSell: Buy
                  ClientId: '654321'
                  ClosedProfitLoss: 9597
                  ClosedProfitLossInBaseCurrency: 9597
                  ClosingMarketValue: 0
                  ClosingMarketValueInBaseCurrency: 0
                  ClosingMethod: Explicit
                  ClosingPositionId: '139694249'
                  ClosingPrice: 1.09139
                  ConversionRateInstrumentToBaseSettledClosing: false
                  ConversionRateInstrumentToBaseSettledOpening: true
                  ExecutionTimeClose: '2017-05-02T00:00:00Z'
                  ExecutionTimeOpen: '2017-04-12T00:00:00Z'
                  OpeningPositionId: '139597294'
                  OpenPrice: 1.0594
                  Uic: 21
                ClosedPositionUniqueId: 139597294-139694249
                NetPositionId: EURUSD_FxSpot
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                required:
                - ErrorCode
                - Message
                type: object
                properties:
                  ErrorCode:
                    enum:
                    - InvalidClientId
                    - PositionIdNotSpecified
                    type: string
                    example: None
                    x-enum-descriptions:
                      PositionIdNotSpecified: Position not specified.
                      InvalidClientId: Indicates that the requested client id was invalid.
                  Message:
                    type: string
                  ModelState:
                    $ref: '#/components/schemas/ModelStateDictionary'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - OpenApiOAuthSecurityScheme: []
      - OpenApiJWTSecurityScheme: []
      x-required-permissions:
        personal: Read
        community: Read
  /port/v1/closedpositions/me:
    get:
      tags:
      - ClosedPositions
      summary: Get closed positions for a client, to which the logged in user belongs
      description: Returns a list of closed positions fulfilling the criteria specified by the query string parameters.
      operationId: GET_ClosedPositionsV1GetClosedPositions
      parameters:
      - name: $skip
        in: query
        description: The number of entries to skip from the beginning of the collection
        schema:
          minimum: 0
          type: integer
          format: int32
        example: 1
      - name: $top
        in: query
        description: The number of entries to return from the beginning of the collection
        schema:
          minimum: 0
          type: integer
          format: int32
          default: 0
        example: 1
      - name: FieldGroups
        in: query
        description: Specifies which data to return. Default is [ClosedPosition].
        required: true
        schema:
          type: array
          items:
            $ref: '#/components/schemas/ClosedPositionFieldGroup'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClosedPositionResponseListResult'
              example:
                __next: /openapi/port/....../?$top=1&$skip=1
                Data:
                - ClosedPosition:
                    AccountId: 192134INET
                    Amount: 300000
                    AssetType: FxSpot
                    BuyOrSell: Buy
                    ClientId: '654321'
                    ClosedProfitLoss: 9597
                    ClosedProfitLossInBaseCurrency: 9597
                    ClosingMarketValue: 0
                    ClosingMarketValueInBaseCurrency: 0
                    ClosingMethod: Explicit
                    ClosingPositionId: '139694249'
                    ClosingPrice: 1.09139
                    ConversionRateInstrumentToBaseSettledClosing: false
                    ConversionRateInstrumentToBaseSettledOpening: true
                    ExecutionTimeClose: '2017-05-02T00:00:00Z'
                    ExecutionTimeOpen: '2017-04-12T00:00:00Z'
                    OpeningPositionId: '139597294'
                    OpenPrice: 1.0594
                    Uic: 21
                  ClosedPositionUniqueId: 139597294-139694249
                  NetPositionId: EURUSD_FxSpot
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - OpenApiOAuthSecurityScheme: []
      - OpenApiJWTSecurityScheme: []
      x-required-permissions:
        personal: Read
        community: Read
  /port/v1/closedpositions:
    get:
      tags:
      - ClosedPositions
      summary: Get closed positions for a client, accountGroup or account
      description: Returns a list of closed positions fulfilling the criteria specified by the query string parameters.
      operationId: ClosedPositionsV1GetClosedPositions
      parameters:
      - name: $skip
        in: query
        description: The number of entries to skip from the beginning of the collection
        schema:
          minimum: 0
          type: integer
          format: int32
        example: 1
      - name: $top
        in: query
        description: The number of entries to return from the beginning of the collection
        schema:
          minimum: 0
          type: integer
          format: int32
          default: 0
        example: 1
      - name: AccountGroupKey
        in: query
        description: The key of the account group to which the closed positions belongs.
        schema:
          title: The key of the account group to which the closed positions belongs.
          minLength: 1
          type: string
          x-type-name: AccountGroupKey
        example: stringValue
      - name: AccountKey
        in: query
        description: The key of the account to which the closed positions belongs.
        schema:
          title: The key of the account to which the closed positions belongs.
          minLength: 1
          type: string
          x-type-name: AccountKey
        example: 01b64edf-da03-4145-bf33-ae21527d4c86
      - name: ClientKey
        in: query
        description: The key of the client to which the closesd positions belongs.
        required: true
        schema:
          title: The key of the client to which the closesd positions belongs.
          minLength: 1
          type: string
          x-type-name: ClientKey
        example: 493b43a5-fe85-4d1f-9071-dd4a9d4e42a4
      - name: ClosedPositionId
        in: query
        description: The id of the closed position to which the closedposition belongs
        schema:
          title: The id of the closed position to which the closedposition belongs
          type: string
        example: stringValue
      - name: FieldGroups
        in: query
        description: Specifies which data to return. Default is [ClosedPosition]
        schema:
          title: Specifies which data to return. Default is [ClosedPosition]
          type: array
          items:
            $ref: '#/components/schemas/ClosedPositionFieldGroup'
        example:
        - DisplayAndFormat
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClosedPositionResponseListResult'
              example:
                __next: /openapi/port/....../?$top=1&$skip=1
                Data:
                - ClosedPosition:
                    AccountId: 192134INET
                    Amount: 300000
                    AssetType: FxSpot
                    BuyOrSell: Buy
                    ClientId: '654321'
                    ClosedProfitLoss: 9597
                    ClosedProfitLossInBaseCurrency: 9597
                    ClosingMarketValue: 0
                    ClosingMarketValueInBaseCurrency: 0
                    ClosingMethod: Explicit
                    ClosingPositionId: '139694249'
                    ClosingPrice: 1.09139
                    ConversionRateInstrumentToBaseSettledClosing: false
                    ConversionRateInstrumentToBaseSettledOpening: true
                    ExecutionTimeClose: '2017-05-02T00:00:00Z'
                    ExecutionTimeOpen: '2017-04-12T00:00:00Z'
                    OpeningPositionId: '139597294'
                    OpenPrice: 1.0594
                    Uic: 21
                  ClosedPositionUniqueId: 139597294-139694249
                  NetPositionId: EURUSD_FxSpot
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                required:
                - ErrorCode
                - Message
                type: object
                properties:
                  ErrorCode:
                    enum:
                    - ClosedPositionNotAccessibleInEndOfDayNettingMode
                    - InvalidClientId
                    - InvalidExchangeId
                    - NoValidInput
                    type: string
                    example: None
                    x-enum-descriptions:
                      NoValidInput: No valid input values passed.
                      InvalidClientId: Indicates that the requested client id was invalid.
                      InvalidExchangeId: The provided exchange id is invalid.
                      ClosedPositionNotAccessibleInEndOfDayNettingMode: ClosedPosition is not accessible in EndOfDay netting mode of the client
                  Message:
                    type: string
                  ModelState:
                    $ref: '#/components/schemas/ModelStateDictionary'
        '204':
          description: No Content
        '401':
          $ref: '#/components/responses/Unauthorized'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - OpenApiOAuthSecurityScheme: []
      - OpenApiJWTSecurityScheme: []
      x-required-permissions:
        personal: Read
        community: Read
components:
  responses:
    BadRequest:
      description: One or more of the provided parameters are invalid.
      content:
        application/json:
          schema:
            required:
            - ErrorCode
            - Message
            type: object
            properties:
              ErrorCode:
                enum:
                - InvalidRequest
                type: string
                example: None
                x-enum-descriptions:
                  InvalidRequest: Default error code returned when it cannot be determined which part of the request is malformed.
              Message:
                type: string
              ModelState:
                $ref: '#/components/schemas/ModelStateDictionary'
    Unauthorized:
      description: Indicates that the request was rejected because the 'Authorization' header was missing in the request or contained an invalid security token.
    TooManyRequests:
      description: The request was rejected due to rate limit being exceeded.
    ServiceUnavailable:
      description: Service Unavailable.
  schemas:
    PriceDisplayFormatType:
      title: The format modifiers in which e.g. a price must be displayed and possibly edited.
      enum:
      - AllowDecimalPips
      - Fractions
      - ModernFractions
      - Normal
      - Percentage
      type: string
      example: Fractions
      x-enum-descriptions:
        Normal: Standard decimal formatting is used with the Decimals field indicating the number of decimals.
        Fractions: Display as regular fraction i.e. 3 1/4
        ModernFractions: Special US Bonds futures fractional format (1/32s or 1/128s without nominator). If PriceDecimals = -5 then the nominator is 32, else 128.
        Percentage: Display as percentage, e.g. 12.34%.
        AllowDecimalPips: "Display the last digit as a smaller than the rest of the numbers. Note that this digit is not included in the number of decimals, effectively\n            increasing the number of decimals by one. E.g. 12.345 when Decimals is 2 and DisplayFormat is AllowDecimalPips."
    ClosedPosition:
      title: Static contents for a closed position.
      type: object
      properties:
        AccountId:
          title: The id of the account to which the closed position belongs.
          type: string
          example: stringValue
        Amount:
          title: Sum volume of positions in instrument.
          type: number
          example: 10
        AssetType:
          title: The AssetType.
          allOf:
          - $ref: '#/components/schemas/AssetType'
        BuyOrSell:
          title: Closing direction - Buy or Sell
          allOf:
          - $ref: '#/components/schemas/BuySell'
        ClientId:
          title: The id of the client to which the closed position belongs.
          type: string
          example: stringValue
        ClosedProfitLoss:
          title: Closed ProfitLoss in Instrument currency
          type: number
          example: 10
        ClosedProfitLossInBaseCurrency:
          title: Closed ProfitLoss in Base (client/ account) currency
          type: number
          example: 10
        ClosingIndexRatio:
          title: Closing IndexRatio, Applicable for Inflation linked bonds.
          type: nu

# --- truncated at 32 KB (71 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/saxo/refs/heads/main/openapi/saxo-closedpositions-api-openapi.yml