OpenAPI

Summary

The .../details resources in the Portfolio Service Group will be deprecated from OpenAPI on or after November 1, 2022. This change will affect the following resources:

  • port/v1/positions/{PositionId}/details
  • port/v1/netpositions/{NetPositionId}/details
  • port/v1/orders/{OrderId}/details
  • port/v1/closedpositions/{ClosedPositionId}/details

Consumers currently relying on these services are advised to switch to the base single-entity resource (such as port/v1/positions/{PositionId}). Fields previously available in the .../details routes have been migrated to appropriate FieldGroups in the single-entity resource. This allows for seamless transition. In addition, data can now be retrieved in bulk or consumed using a streaming subscription.

Which resources are impacted by this change?

The Portfolio Service Group in OpenAPI currently offers a .../details resource in 4 locations: positions, netpositions, orders, and closedpositions (see above).

What changes are being made?

The .../details endpoints are a convenience resource that automatically adds all available FieldGroups to the response object, in addition to a "Details" FieldGroup that is not otherwise available (such as PositionDetails). Three changes are made in order to deprecate this feature:

  • Fields available in the "Details" FieldGroups have been migrated to either the "Base" or "View" FieldGroups, or added to a new FieldGroup altogether.
  • Fields available in the "Details" FieldGroups now support streaming.
  • The .../details route is made redundant, and will consequently be deprecated.

Why are these changes being made?

The .../details endpoints expose useful data, but the resource only allows for single-entity GET request and doesn't support streaming. Only very few specific fields are available in .../details that would otherwise not be accessible in the single-entity (or bulk) resources. Moving these specific fields over to the non-details resources yields the following benefits:

  • Requests can now be made in bulk with all fields that were previously available in .../details added to every entity in the collection response. This can potentially save a large number of requests being made to OpenAPI, as the client application no longer has to send a request to .../details for every individual entity.
  • Single-entity requests can use FieldGroups to specify which data should be returned (instead of all data) which reduces bandwidth usage.
  • Streaming is now supported for all fields that were previously only available as static GET responses from .../details, which allows for interactive display of details such as trade costs converted to the base currency of the account in real-time (see the new "Costs" FieldGroup in (Net/Closed)Positions).
  • Removing .../details simplifies OpenAPI and clears up otherwise confusing design where a certain FieldGroup is only available under a specific route, instead of offering all FieldGroups directly on the base resource.

I am using these endpoints, what changes should I make to my application?

If your application requests a .../details resource, the work required to adapt to this change is minimal and will make your application leaner. Because the .../details resource requires the ID of the entity to be known in advance, a request has already been made to the collection endpoint (or data is received on a streaming connection). With the above changes, you are now able to retrieve all data previously available only in the .../details route directly in the collection response (or in the streaming snapshot)

If your app for instance retrieves all positions using: /port/v1/positions?ClientKey=[ClientKey], and subsequently collects details by calling the .../details resource for each position in the previous response, you can now retrieve all data directly by requesting:

/port/v1/positions?ClientKey=[ClientKey]&FieldGroups=[select applicable FieldGroups here]

As mentioned, all data previously available under the .../details resource has been migrated to FieldGroups in the base resource.

The same FieldGroups can also be used in a POST request to the subscription endpoint for each resource, which allows for detailed data to be retrieved and streamed in real-time.

If you have any questions or concerns regarding the above deprecation changes, feel free to reach out to openapisupport@saxobank.com.

Reference Documentation of affected resources

https://www.developer.saxo/openapi/referencedocs/port/v1/positions

https://www.developer.saxo/openapi/referencedocs/port/v1/netpositions

https://www.developer.saxo/openapi/referencedocs/port/v1/orders

https://www.developer.saxo/openapi/referencedocs/port/v1/closedpositions


Specific mapping for the PositionDetails section which will be removed

FieldNew Location
AllocationKeyIdPositionBase.AllocationKeyId
CloseCostCosts.CloseCost
CloseCostInBaseCurrencyCosts.CloseCostInBaseCurrency
CopiedPositionIdPositionBase.CopiedPositionId
CorrelationKeyPositionBase.CorrelationKey
CorrelationTypesPositionBase.CorrelationTypes
CurrencyCutPctCosts.CurrencyCutPct
ExternalReferencePositionBase.ExternalReference
GreeksGreeks
LockedByBackOfficePositionBase.LockedByBackOffice
MarketValuePositionView.MarketValue
MarketValueInBaseCurrencyPositionView.MarketValueInBaseCurrency
MarketValueOpenPositionView.MarketValueOpen
OpenCostCosts.OpenCost
OpenCostInBaseCurrencyCosts.openCostInBaseCurrency
OpenSwapPositionBase.SourceOrderId
OriginatingAlgoOrderStrategyIdPositionBase.SourceOrderId
OriginatingAlgoOrderTextWill not be transitioned!
SourceOrderIdPosiitonBase.SourceOrderId
StrategyIdPositionBase.StrategyId
TradeAllocationKeyPositionBase.AllocationKeyId (notice rename)
TradeIdeaIdWill not be transitioned!