OpenAPI for Excel
2019-06-19, Gid van der Ven

OpenAPI Changes

Saxo's OpenAPI will soon be updated to require algo apps to provide an additional field in order requests indicating whether the order was generated automatically, or sent in manually by a user. The Excel add-in is classified as algo app, since it can be used to completely automate order placement through VBA (examples of this include tutorial 5 and tutorial 8).

The upcoming change, which is planned to go live during Q3 2019, will block any order that does not identify its origin using the "ManualOrder" field. Orders without this field will be rejected, as it will constitute a hard requirement by the OpenAPI.

Definitions

What is the definition of automated order entry?

Automated order entry refers to orders that are generated and/or routed without human intervention. This includes any order generated by a computer system as well as orders that are routed using functionality that manages order submission through automated means (i.e. execution algorithm).

What is the definition of manual order entry?

Manual order entry refers to orders that are submitted by an individual directly entering the order into a front-end system, typically via keyboard, mouse or touch screen, and which is routed in its entirety to the match engine at the time of submission. A order that is generated automatically, but ultimately confirmed by the user before being sent to market is considered manual.

Implications

In practice, the only change required for current clients on OpenAPI for Excel will be to add the "ManualOrder" field to their order requests. Each individual order is required to have this flag set to either "true" for a manual order, or "false" for an automated order (see definition above).

A practical example, taken from tutorial 5, shows the addition of this field in the VBA code below. This particular VBA script monitors the current price of a particular FX pair and checks whether the price has hit a threshold to trigger a long or short order. Because the spreadsheet operates autonomously and fires off orders to the OpenAPI without human intervention, it qualifies as automated order entry. Each order will as a result have the field "ManualOrder" set to false:

body = "{" & _
    "'AccountKey':'" & [accountkey] & "', " & _
    "'Amount':" & Amount & ", " & _
    "'AssetType':'FxSpot', " & _
    "'BuySell':'Buy', " & _
    "'Uic':" & [Uic] & ", " & _
    "'OrderType':'Market', " & _
    "'OrderDuration':{'DurationType':'DayOrder'}, " & _
    "'ManualOrder':false" & _
"}"
    
trade = Application.Run("OpenAPIPost", "trade/v2/orders", body)

Order functionality built into solutions such as the trade ticket in tutorial 7.1 have to be adjusted to include a "true" value for the ManualOrder field, as this use case is clearly non-automated.

Orders are treated similarly regardless of the "ManualOrder" setting (i.e. routing and execution are not affected).

Scope

The /trade/v2/orders endpoint is the only endpoint that is affected by this change, and it will be enforced for POST requests exclusively. Removing orders (using a DELETE request) or changing an existing order (using a PATCH request) do not require the "ManualOrder" field to be specified. As such, clients using OpenAPI in read-only mode are not impacted.

To-do

Clients currently using OpenAPI for Excel for order placement ('write' mode) are advised to update their order placement process by checking their procedure against the provided definition and adding the "ManualOrder" field accordingly. The field can be added right away without affecting order placement. Once the field becomes mandatory, the updated VBA routines should continue working as they are.