CreateSubscriptionForClientEvents

class saxo_openapi.endpoints.eventnotificationservices.clientactivities.CreateSubscriptionForClientEvents(data)

Set up an active subscription to listen client events.

ENDPOINT = 'openapi/ens/v1/activities/subscriptions'
EXPECTED_STATUS = 201
METHOD = 'POST'
__init__(data)

Instantiate a CreateSubscriptionForClientEvents request.

Parameters:data (dict (required)) – dict representing the data body, the subscription specification

body example:

data =
    {
      "Arguments": {
        "AccountKey": "mroYddvgiGqqudzBPn8daA==",
        "Activities": [
          "AccountFundings",
          "MarginCalls",
          "Orders",
          "Positions"
        ],
        "ClientKey": "URpoxLBgX2I33Af3IhCvHg==",
        "FieldGroups": [
          "DisplayAndFormat",
          "ExchangeInfo"
        ],
        "FromDateTime": "2015-02-02T01:02:03Z",
        "IncludeSubAccounts": false,
        "SequenceId": "37456"
      },
      "ContextId": "Context_20190503051756665",
      "ReferenceId": "M_344",
      "RefreshRate": 0
    }
>>> import saxo_openapi
>>> import saxo_openapi.endpoints.eventnotificationservices as ens
>>> import json
>>> client = saxo_openapi.API(access_token=...)
>>> data = ...
>>> r = ens.clientactivities.CreateSubscriptionForClientEvents(data)
>>> client.request(r)
>>> print(json.dumps(r.response, indent=4))

Output:

{
  "ContextId": "Context_20190503051756665",
  "InactivityTimeout": 30,
  "ReferenceId": "M_344",
  "RefreshRate": 0,
  "Snapshot": {
    "Data": []
  },
  "State": "Active"
}
expected_status
response

response - get the response of the request.

status_code