PrecheckOrder

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

Precheck an order.

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

Instantiate a PrecheckOrder request.

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

data example:

data =
    {
      "AccountKey": "Cf4xZWiYL6W1nMKpygBLLA==",
      "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.PrecheckOrder(data=data)
>>> client.request(r)
>>> print(json.dumps(r.response, indent=4))

Output:

{
  "EstimatedCashRequired": 296.275,
  "EstimatedCashRequiredCurrency": "EUR",
  "InstrumentToAccountConversionRate": 0.88239,
  "PreCheckResult": "Ok"
}
expected_status
response

response - get the response of the request.

status_code