CreateOpenOrdersSubscription

class saxo_openapi.endpoints.portfolio.orders.CreateOpenOrdersSubscription(data)

Set up a subscription and returns an initial snapshot of list of orders specified by the parameters in the request.

ENDPOINT = 'openapi/port/v1/orders/subscriptions'
EXPECTED_STATUS = 201
METHOD = 'POST'
__init__(data)

Instantiate a CreateOpenOrdersSubscription request.

Parameters:data (dict (optional)) – dict representing the body with request parameters
>>> import saxo_openapi
>>> import saxo_openapi.endpoints.portfolio as pf
>>> import json
>>> client = saxo_openapi.API(access_token=...)
>>> data =
        {
          "Arguments": {
            "ClientKey": "Cf4xZWiYL6W1nMKpygBLLA=="
          },
          "ContextId": "explorer_1552035128308",
          "ReferenceId": "C_582"
        }
>>> r = pf.orders.CreateOpenOrdersSubscription(data=data)
>>> client.request(r)
>>> print(json.dumps(r.response, indent=2))

Output:

{
  "ContextId": "explorer_1552035128308",
  "Format": "application/json",
  "InactivityTimeout": 30,
  "ReferenceId": "C_582",
  "RefreshRate": 1000,
  "Snapshot": {
    "Data": [
      {
        "AccountId": "9226397",
        "AccountKey": "Cf4xZWiYL6W1nMKpygBLLA==",
        "Amount": 100000,
        "AssetType": "FxSpot",
        "BuySell": "Buy",
        "CalculationReliability": "Ok",
        "ClientKey": "Cf4xZWiYL6W1nMKpygBLLA==",
        "CorrelationKey": "925ab7aa-998b-4f4b-af26-7c1b3f4eee27",
        "CurrentPrice": 7.46175,
        "CurrentPriceDelayMinutes": 0,
        "CurrentPriceType": "Ask",
        "DistanceToMarket": 0.46175,
        "Duration": {
          "DurationType": "GoodTillCancel"
        },
        "IsMarketOpen": false,
        "MarketPrice": 7.46175,
        "OpenOrderType": "Limit",
        "OrderAmountType": "Quantity",
        "OrderId": "76332324",
        "OrderRelation": "StandAlone",
        "OrderTime": "2019-03-07T14:54:17.423333Z",
        "Price": 7,
        "RelatedOpenOrders": [],
        "Status": "Working",
        "Uic": 16
      },
      {
        "AccountId": "9226397",
        "AccountKey": "Cf4xZWiYL6W1nMKpygBLLA==",
        "Amount": 100000,
        "AssetType": "FxSpot",
        "BuySell": "Buy",
        "CalculationReliability": "Ok",
        "ClientKey": "Cf4xZWiYL6W1nMKpygBLLA==",
        "CorrelationKey": "e684a2e2-f9f9-4b10-91ad-a50e2f8b80ae",
        "CurrentPrice": 7.46175,
        "CurrentPriceDelayMinutes": 0,
        "CurrentPriceType": "Ask",
        "DistanceToMarket": 0.46175,
        "Duration": {
          "DurationType": "GoodTillCancel"
        },
        "IsMarketOpen": false,
        "MarketPrice": 7.46175,
        "OpenOrderType": "Limit",
        "OrderAmountType": "Quantity",
        "OrderId": "76328908",
        "OrderRelation": "StandAlone",
        "OrderTime": "2019-03-07T12:04:13.493333Z",
        "Price": 7,
        "RelatedOpenOrders": [],
        "Status": "Working",
        "Uic": 16
      },
      {
        "AccountId": "9226397",
        "AccountKey": "Cf4xZWiYL6W1nMKpygBLLA==",
        "Amount": 10000,
        "AssetType": "FxSpot",
        "BuySell": "Buy",
        "CalculationReliability": "Ok",
        "ClientKey": "Cf4xZWiYL6W1nMKpygBLLA==",
        "CorrelationKey": "ec6ca0f4-8380-4068-a32d-538b7b06208e",
        "CurrentPrice": 1.30179,
        "CurrentPriceDelayMinutes": 0,
        "CurrentPriceType": "Ask",
        "DistanceToMarket": 0.20179,
        "Duration": {
          "DurationType": "GoodTillCancel"
        },
        "IsMarketOpen": false,
        "MarketPrice": 1.30179,
        "OpenOrderType": "Limit",
        "OrderAmountType": "Quantity",
        "OrderId": "76289260",
        "OrderRelation": "StandAlone",
        "OrderTime": "2019-03-04T17:55:59.503333Z",
        "Price": 1.1,
        "RelatedOpenOrders": [],
        "Status": "Working",
        "Uic": 31
      }
    ]
  },
  "State": "Active"
}
expected_status
response

response - get the response of the request.

status_code