Using OpenAPI requires knowledge about a range of core entities and concepts of the API. This article outlines the most common ones.
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.
|Fx||FxVanillaOption, FxOneTouch, FxNoTouch||EURUSD||Cash|
|Cfd||CfdOnStock, CfdOnIndex, CfdOnFutures||KO:xnys||Margin|
|Stocks||Stock, StockIndex (not tradable)||BA:xlon||Cash|
|Exchange Traded Options||StockOption, StockIndexOption, FuturesOption||AAPL:xcbf||Cash|
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 and a 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.
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 order||Two way order||Stand-Alone order||Two 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:
- OrderRelation (StandAlone, IfDoneMaster, IfDoneSlaveOco, Oco)
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 behavior is controlled through an order type and a duration and associated properties. Order Types supported are
|Market||Order is attempted filled at best price in the market|
|Limit||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
|A buy order will be executed when the price increases to the provided price point;|
a sell order when the price falls below
|The different variants determines what price is the trigger: bid, ask, last-traded|
|StopLimit||A buy StopLimit order will turn in to a regular limit order once the price goes beyond the OrderPrice. The limit order will have a OrderPrice of the StopLimitPrice|
|A trailing stop order type is used to guard a position against a potential loss, but the order price follows that of the position when the price goes up. It does so in steps, trying to keep a fixed distance to the current price||Only relevant for related orders|
Order types are relevant for placing order, but also when retrieving a list of orders ( indicates are required property for those order 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.
|ImmediateOrCancel||IOC||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|
|GoodTillDate||GTD||Requires an explicit date. Cancellation of the order happens at some point on that date.|