OpenAPI

Using OpenAPI requires knowledge about a range of core entities and concepts of the API. This article outlines the most common ones.

Limitations

Saxo Bank offers trading in many different asset classes as well as a very configurable platform. Many of the things described in the documentation are only available for certain styles of setup. Things described may not be available for your current setup.

AssetTypes and Settlement Style

Saxo's platform allows a client to trade a wide range of financial instruments. Availability is subject to setup of the individual client. The different types are called AssetTypes and influence the client's account balance in different ways.

CategoryAssetTypeExampleSettlement Style
FxFxSpot, FxForwardsEURUSDMargin
FxFxVanillaOption, FxOneTouch, FxNoTouchEURUSDCash
CfdCfdOnStock, CfdOnIndex, CfdOnFuturesKO:xnysMargin
FuturesContractFutures, FutureStrategiesLCOZ8Cash
StocksStock, StockIndex (not tradable)BA:xlonCash
Exchange Traded OptionsStockOption, StockIndexOption, FuturesOptionAAPL:xcbfCash
BondsBondBELGIUM-5.5-28MAR28Cash

On top of the above asset types, the api uses Cash, FxBinaryOptions, ManagedFund in non-trading scenarios.

Settlement style affects how trading a specific asset type impacts account balance and P/L calculations on positions held by the client and even for cash products ana certain margin requirement may exist in order to hold a position in they instrument.

Prices and Market Data

What prices a client has access to is controlled through the instruments and asset types that the client is set up to trade in as well as the associated price feeds. The price feed on Fx and Bonds is real time and free, but for exchange based products it is paid for through a subscription to the price feed for that exchange or trading venue and under licensing rules specific to the feed.Also depending on data access rights a feed may be real-time or delayed. 

Getting price feeds through the API for usage in a 3rd party application requires additional licenses and agreements and have an additional cost compared to getting the price feed within the Saxo Bank trading platforms. You will therefore often be able to see prices within our trading platform, which are not available to a 3rd party platform. See the FAQ for information about how to get price feeds via the API. Note that if your application is not able to receive prices for a particular instrument, this has cascading effect across several OpenAPI resources. For example:

  • The trade/prices endpoint will of course not return prices.
  • The port/positions, port/netpositions and port/orders endpoints, will not return current price or any derived field such as P/L or distance to market
  • The chart endpoint will not return samples.

Prices are subject to different formatting rules for input on orders, but is also as a convention when being displayed.

Positions and Netting Mode

A client is can be configured for either End-of-Day-netting or Intraday-netting. As the name suggests, this setting impacts how positions are netted during the day and whether orders can be related to positions. When placing orders, it is thus important to know the client's netting mode configuration.

Orders

The primary way to trade through the API is to place an order. Orders placed can be active (working) or passive (notworking). A working order is one that gets executed once its trigger condition is hit, whereas a notworking order is one that is resting until its master order is executed. These relationships are relevant for both order placement as well as for understanding a clients current list of orders.

Three way orderTwo way orderStand-Alone orderTwo orders in OCO relationship

The purpose of related orders is to guard the resulting position from a loss or to ensure that a profit is realized at the right target. If an entry order to buy has related orders, they will be to sell. If an entry order to sell has related orders, they will be to buy. OCO orders are special in the sense that they are both active and if one is executed, the other is cancelled. An order can be cancelled without being filled. It can be partially filled and cancelled before it is fully filled.

When on End-of-Day netting, orders can also be related to a specific position.

Orders are bound together in a relationship controlled by the following attributes on an order:

  • OrderId
  • OrderType
  • RelatedOrderId
  • OrderRelation (StandAlone, IfDoneMaster, IfDoneSlaveOco, Oco)
  • RelatedPositionId

Here is a very basic example of how the entry order in a three way relationship can look (the two other orders are IfDoneSlaveOco and is usually retrieved from the API together with the entry order):

Order Relationship Example
{
	"Amount": 50,
	"AssetType": "Stock",
	"BuySell": "Buy",
	"OpenOrderType": "Limit",
	"OrderId": "48986367",
	"OrderRelation": "IfDoneMaster",
	"Price": 40,
	"RelatedOpenOrders": [
	{
		"Amount": 50,
		"OpenOrderType": "StopIfTraded",
		"OrderId": "48986369",
		"OrderPrice": 39
	},
	{
		"Amount": 50,
		"OpenOrderType": "Limit",
		"OrderId": "48986368",
		"OrderPrice": 41
	}
	],
	"Uic": 307
}

Order Types

Not all order and duration types are supported for all asset types. Support is subject to change due to changes at exchanges or regulatory changes.

Order behavior is controlled through an order type and a duration and associated properties. Order Types supported are

OrderTypeOrderPriceStopLimitPriceTrailingStopDistanceToMarketTrailingStopStepTrigger Condition
Market



Order is attempted filled at best price in the market

Limit

(tick)


A buy order will be executed when the price falls below the provided price point;
a sell order when the price increases beyond the provided price point

Stop,
StopIfTraded

(tick)


A buy order will be executed when the price increases to the provided price point;
a sell order when the price falls below 
StopLimit(tick)(tick)

A Limit order will be placed with the OrderPrice if the specified StopLimitPrice is met.

TrailingStop,
TrailingStopIfTraded
(tick)
(tick)(tick)A trailing stop order type is used to guard a position against a potential loss. The OrderPrice follows the market in steps (TrailingStopStep), trying to keep a fixed distance (TrailingStopDistanceToMarket).

Order types are relevant for placing order, but also when retrieving a list of orders ((tick) indicates are required property for those order types).

Duration Types

An order is only working for a duration specified when placing an order. The API supports the following duration types, but not all types are available for all asset types.

DurationTypeShortExpirationDateComment
ImmediateOrCancelIOC
The order is working for a very short duration and when the time is up, the order is cancelled. What ever fills happened in the short time, is what constitute a position. Primarily used for Fx and Cfds
FillOrKillFOK

DayOrder


GoodTillDateGTD(tick)Requires an explicit date. Cancellation of the order happens at some point on that date.
GoodTillCancelGTC