CreateTradeMessageSubscription¶
-
class
saxo_openapi.endpoints.trading.messages.
CreateTradeMessageSubscription
(data)¶ Create a subscription on trade messages.
-
ENDPOINT
= 'openapi/trade/v1/messages/subscriptions'¶
-
EXPECTED_STATUS
= 201¶
-
METHOD
= 'POST'¶
-
__init__
(data)¶ Instantiate a CreateTradeMessageSubscription request.
Parameters: data (dict (required)) – dict representing the parameters of the data body. >>> import saxo_openapi >>> import saxo_openapi.endpoints.trading as tr >>> import json >>> client = saxo_openapi.API(access_token=...) >>> data = { "ContextId": "20190307094456781", "Format": "application/json", "ReferenceId": "TM90172", "RefreshRate": 5, "Tag": "PAGE1" }
>>> r = tr.messages.CreateTradeMessageSubscription(data=data) >>> client.request(r) >>> print(json.dumps(r.response, indent=4))
Output:
{ "ContextId": "20190307094456781", "Format": "application/json", "InactivityTimeout": 120, "ReferenceId": "TM90172", "RefreshRate": 800, "Snapshot": { "Data": [ { "DateTime": "2014-12-12T09:17:12Z", "DisplayName": "Price Alert", "DisplayType": "Default", "IsDiscardable": false, "MessageBody": "Price alert was triggered on EURUSD", "MessageHeader": "Price Alert", "MessageId": "345322", "MessageType": "PriceAlert" } ] }, "State": "Active", "Tag": "PAGE1" }
-
expected_status
¶
-
response
¶ response - get the response of the request.
-
status_code
¶
-