Open API

Some clients have the option to select whether to use Real-time or End of Day position netting in their trading platform. The choice of netting mode affects how and when positions are netted as well as whether or not it is possible to relate orders directly to an individual position. As an application developer you need to make sure that your application will work correctly for both types of netting. Alternatively you must ensure that the clients who are using your application will only be using the netting mode supported by your application.

Traditional EOD Netting

Traditionally Saxo Bank has offered End of Day position netting. In this netting mode, opposition positions are only netted out during the EOD process at the end of the trading day. During the trading day they will be shown in the SaxoTraderGO "Positions Tab".

In this example we have first bought and then sold 100.000 EUR. These are shown as individual long/short positions under the EURUSD net position, which is Square.

If you call OpenAPI:

  • the call to /port/v1/positions will return 2 positions (one long, and one short).
  • the call to /port/v1/netpositions will return a net position with a NetPositionBase.Amount value of 0.

Further notice:

  • It is possible to place individual stop and limit orders on each position. (you may do this in OpenAPI by using the /trade/v2/orders endpoint to place a stop/limit order and setting the PositionId field).
  • It is possible to explicitly close a position. (you may do this in OpenAPI by using the trade/v2/orders endpoint to place market order and setting the PositionId field).
  • It is possible to exercise an individual (option) position by calling /trade/v1/positions/{positionid}/exercise.

Finally, since we do not distinguish between opened and closed positions, there is only a single value for P/L on margin positions (in OpenAPI this is the UnrealizedMarginProfitLoss returned from the /port/v1/balances endpoint).

Real-Time netting

The new Real-time netting is described here

In real-time netting opposing positions are netted immediately and as soon as this happens they are removed from the (open) Positions tab to a new tab called Closed Positions.

Consider the example before, where we first bought and then sold 100000 EURUSD. This now looks like this:

When the first trade is made (Buy 100.000 EURUSD), you will see an open position for Long 100.000 EURUSD. But as soon as you make the closing trade (Sell 100.000 EURUSD), the entry in the open positions tab will be removed. Instead you will be able to find the now closed position in the "Closed Positions" tab.

If you call OpenAPI:

  • the calls to /port/v1/positions and port/v1/netpositions will return an empty list.
  • the call to /port/v1/closedpositions will return information about the closed position

Further notice that it is no longer possible to place orders related directly to an open position. In the example below I have made two consecutive Buy 100.000 and Buy 150.000 GBPUSD trades. This is now displayed as follows (after clicking the " # " button:


  • It is not possible to place orders related to an individual position.
  • If you press the "Add" button, you will get a "Place Order" dialog, and the dialog will be pre-filled with an amount the size of the open position. However the placed orders will not be directly related to the net position.

To illustrate this, below I have pressed the "Add" button twice to stop-loss/take profit order, each time getting a dialog like this:

This results in two sets of OCO orders, non of them being related directly to any position or net position.

In real-time netting mode we do distinguish between P/L on closed vs. open margin positions. To accommodate for this, the /port/balances/endpoint return two additional fields "UnrealizedMarginOpenProfitLoss and UnrealizedMarginClosedProfitLoss. The "UnrealizedProfitLoss" field has been retained for backwards compatibility and has the value of the sum of the two new additional fields.

Finally, in real-time netting mode it is not possible to exercise individual option positions. You can only exercise (parts of) an option. To do this you must use the /trade/v1/positions/exercise endpoint.  

What to be aware of when switching from EOD netting to Real-time netting

An application, which has so far worked well when the client is set up for EOD netting may experience the following differences:

  • It is no longer possible to relate orders to positions.
  • Also, if you place a three-way order (entry+ stop loss/take profit order), once the entry order has been executed and the two related orders become working, these orders will also not be related to the newly created position.
  • Opposing positions are netted immediately and removed from the /port/v1/positions and /port/v1/netpositions resources.
  • Netted positions are available as closed positions through the /port/v1/closedpositions resource. However notice that the netted positions resource does not link back to the full detail of the individual open positions. 
  • One consequence of this is that if an application expects to be able to place an order and then keep monitoring the (open) positions, to see when the order is executed, then this will not work if the position is a closing position! If this is important, they application may instead:
    • inspect the orderlog cs/v1/audit/orderactivites, or
    • the soon to be released /trade/v1/tradeactivities
  • It is also no longer possible to exercise individual option positions. Instead use the /trade/v1/positions/exercise endpoint to exercise a specified amount out of the total net position amount.

Detecting the selected netting mode

An application can detect the selected netting mode, by inspecting the value of the field PositionNettingMode, returned from calling /port/v1/clients/me. 

What should you do as a developer?

First, find out if you even have to support both netting modes:

  • If you are a Saxo Bank White Label or Introducing Broker, you may choose that your clients will only be allowed to use one of these, and thus your application may only need to support one mode.
  • If you are developing a general 3rd party application, which will be used by Saxo Bank clients throughout the world, you must be prepared to support both netting modes. At least your application must detect if the client has selected the mode you support, and if not, inform the client and ask him/her to switch to the mode you support.

If you are going to support both netting modes, start by making some trades in SaxoTraderGO in both modes to make sure you understand how they work. Then go implement!

Note that the biggest difference in the two modes, is that real-time netting no longer allows placing orders directly against a specific position. But it is not actually a requirement to do so in EOD mode. So you should be able to support both modes, if your application:

  • Refrains from placing orders related to positions
  • Refrains from exercising individual positions.
  • Checks if there are entries in the port/v1/closedpositions resource and then displays these.