Order

class saxo_openapi.endpoints.trading.orders.Order(data)

Place a new order.

ENDPOINT = 'openapi/trade/v2/orders'
EXPECTED_STATUS = 200
METHOD = 'POST'
__init__(data)

Instantiate an Order request.

Parameters:data (dict (required)) – dict representing the data body, in this case an order spec.

OrderBody example:

data =
    {
      "AccountKey": "Cf4xZWiYL6W1nMKpygBLLA==",
      "ManualOrder": false,
      "Amount": "10000",
      "AssetType": "FxSpot",
      "BuySell": "Buy",
      "OrderType": "Market",
      "Uic": 31
    }
>>> import saxo_openapi
>>> import saxo_openapi.endpoints.trading as tr
>>> import json
>>> client = saxo_openapi.API(access_token=...)
>>> data = ...
>>> r = tr.orders.Order(data=data)
>>> client.request(r)
>>> print(json.dumps(r.response, indent=4))

Output:

{
  "OrderId": "76288494"
}
expected_status
response

response - get the response of the request.

status_code