CreateInfoPriceSubscription¶
-
class
saxo_openapi.endpoints.trading.infoprices.
CreateInfoPriceSubscription
(data)¶ Sets up a subscription and returns an initial snapshot of an info price list specified by the parameters in the request.
-
ENDPOINT
= 'openapi/trade/v1/infoprices/subscriptions'¶
-
EXPECTED_STATUS
= 201¶
-
METHOD
= 'POST'¶
-
__init__
(data)¶ Instantiate a CreateInfoPriceSubscription 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 = { "Arguments": { "AccountKey": "LZTc7DdejXODf-WSl2aCyQ==", "AssetType": "FxSpot", "FieldGroups": [ "DisplayAndFormat", "HistoricalChanges", "InstrumentPriceDetails", "PriceInfo", "PriceInfoDetails", "Quote" ], "Uics": "22,23" }, "ContextId": "20190307094456688", "ReferenceId": "IP17820", "RefreshRate": 1000 }
>>> r = tr.infoprices.CreateInfoPriceSubscription(data=data) >>> client.request(r) >>> print(json.dumps(r.response, indent=4))
Output:
{ "ContextId": "20190307094456688", "Format": "application/json", "InactivityTimeout": 60, "ReferenceId": "IP17820", "RefreshRate": 1000, "Snapshot": { "Data": [ { "AssetType": "FxSpot", "DisplayAndFormat": { "Currency": "AUD", "Decimals": 4, "Description": "British Pound/Australian Dollar", "Format": "AllowDecimalPips", "OrderDecimals": 4, "Symbol": "GBPAUD" }, "HistoricalChanges": { "PercentChange1Month": 1.21, "PercentChange2Months": 2.95, "PercentChange3Months": 1.85, "PercentChange6Months": -1.83, "PercentChangeWeekly": 1.67 }, "InstrumentPriceDetails": { "IsMarketOpen": true, "ShortTradeDisabled": false, "ValueDate": "2017-05-19" }, "LastUpdated": "0001-01-01T00:00:00Z", "PriceInfo": { "High": 1.09117, "Low": 1.08853, "NetChange": 0.00048, "PercentChange": 0.04 }, "PriceInfoDetails": { "AskSize": 1000000.0, "BidSize": 1000000.0, "LastClose": 1.08932, "LastTraded": 0.0, "LastTradedSize": 0.0, "Open": 0.0, "Volume": 0.0 }, "Quote": { "Amount": 100000, "Ask": 1.74948, "Bid": 1.74858, "DelayedByMinutes": 15, "ErrorCode": "None", "Mid": 1.74903, "PriceTypeAsk": "Indicative", "PriceTypeBid": "Indicative" }, "Uic": 22 }, { "AssetType": "FxSpot", "DisplayAndFormat": { "Currency": "CAD", "Decimals": 4, "Description": "British Pound/Canadian Dollar", "Format": "AllowDecimalPips", "OrderDecimals": 4, "Symbol": "GBPCAD" }, "InstrumentPriceDetails": { "IsMarketOpen": true, "ShortTradeDisabled": false, "ValueDate": "2017-05-19" }, "LastUpdated": "0001-01-01T00:00:00Z", "Quote": { "Amount": 100000, "Ask": 1.76278, "Bid": 1.76198, "DelayedByMinutes": 15, "ErrorCode": "None", "Mid": 1.76238, "PriceTypeAsk": "Indicative", "PriceTypeBid": "Indicative" }, "Uic": 23 } ] }, "State": "Active" }
-
expected_status
¶
-
response
¶ response - get the response of the request.
-
status_code
¶
-