NetPositionListSubscription¶
-
class
saxo_openapi.endpoints.portfolio.netpositions.
NetPositionListSubscription
(data)¶ Create a subscription on a list of net positions and make it active.
Sets up a subscription and returns an initial snapshot of list of net positions specified by the parameters in the request.
-
ENDPOINT
= 'openapi/port/v1/netpositions/subscriptions'¶
-
EXPECTED_STATUS
= 201¶
-
METHOD
= 'POST'¶
-
__init__
(data)¶ Instantiate a NetPositionListSubscription request.
Parameters: data (dict (required)) – dict representing the data body 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_1551702571343", "ReferenceId": "F_20" }
>>> r = pf.netpositions.NetPositionListSubscription(data=data) >>> client.request(r) >>> print(json.dumps(r.response, indent=4))
Output:
{ "ContextId": "explorer_1551702571343", "Format": "application/json", "InactivityTimeout": 30, "ReferenceId": "F_20", "RefreshRate": 1000, "Snapshot": { "Data": [ { "NetPositionBase": { "Amount": 100000, "AssetType": "FxSpot", "CanBeClosed": true, "ClientId": "9226397", "IsMarketOpen": true, "NumberOfRelatedOrders": 0, "PositionsAccount": "9226397", "SinglePositionId": "212550210", "SinglePositionStatus": "Open", "Uic": 23, "ValueDate": "2019-03-06T00:00:00.000000Z" }, "NetPositionId": "GBPCAD__FxSpot", "NetPositionView": { "AverageOpenPrice": 1.75824, "CalculationReliability": "Ok", "CurrentPrice": 1.75313, "CurrentPriceDelayMinutes": 0, "CurrentPriceType": "Bid", "Exposure": 100000, "ExposureCurrency": "GBP", "ExposureInBaseCurrency": 116179, "InstrumentPriceDayPercentChange": -0.17, "PositionCount": 1, "PositionsNotClosedCount": 1, "ProfitLossOnTrade": -511, "ProfitLossOnTradeInBaseCurrency": -338.57, "Status": "Open", "TradeCostsTotal": -17.56, "TradeCostsTotalInBaseCurrency": -11.63 } }, { "NetPositionBase": { "Amount": 500000, "AssetType": "FxSpot", "CanBeClosed": true, "ClientId": "9226397", "IsMarketOpen": true, "NumberOfRelatedOrders": 0, "PositionsAccount": "9226397", "SinglePositionId": "212550212", "SinglePositionStatus": "Open", "Uic": 22, "ValueDate": "2019-03-06T00:00:00.000000Z" }, "NetPositionId": "GBPAUD__FxSpot", "NetPositionView": { "AverageOpenPrice": 1.86391, "CalculationReliability": "Ok", "CurrentPrice": 1.85805, "CurrentPriceDelayMinutes": 0, "CurrentPriceType": "Bid", "Exposure": 500000, "ExposureCurrency": "GBP", "ExposureInBaseCurrency": 580895, "InstrumentPriceDayPercentChange": -0.36, "PositionCount": 1, "PositionsNotClosedCount": 1, "ProfitLossOnTrade": -2930, "ProfitLossOnTradeInBaseCurrency": -1831.62, "Status": "Open", "TradeCostsTotal": -93.05, "TradeCostsTotalInBaseCurrency": -58.17 } }, { "NetPositionBase": { "Amount": 0, "AssetType": "FxSpot", "CanBeClosed": false, "ClientId": "9226397", "IsMarketOpen": true, "NumberOfRelatedOrders": 0, "PositionsAccount": "9226397", "Uic": 21, "ValueDate": "2019-03-06T00:00:00.000000Z" }, "NetPositionId": "EURUSD__FxSpot", "NetPositionView": { "AverageOpenPrice": 0, "CalculationReliability": "Ok", "CurrentPrice": 1.13416, "CurrentPriceDelayMinutes": 0, "CurrentPriceType": "Bid", "Exposure": 0, "ExposureCurrency": "EUR", "ExposureInBaseCurrency": 0, "InstrumentPriceDayPercentChange": -0.2, "PositionCount": 2, "PositionsNotClosedCount": 2, "ProfitLossOnTrade": 5, "ProfitLossOnTradeInBaseCurrency": 4.41, "Status": "Open", "TradeCostsTotal": -11.38, "TradeCostsTotalInBaseCurrency": -10.03 } }, { "NetPositionBase": { "Amount": 10000, "AssetType": "FxSpot", "CanBeClosed": true, "ClientId": "9226397", "IsMarketOpen": true, "NumberOfRelatedOrders": 0, "PositionsAccount": "9226397", "SinglePositionId": "212675868", "SinglePositionStatus": "Open", "Uic": 31, "ValueDate": "2019-03-06T00:00:00.000000Z" }, "NetPositionId": "GBPUSD__FxSpot", "NetPositionView": { "AverageOpenPrice": 1.31849, "CalculationReliability": "Ok", "CurrentPrice": 1.3176, "CurrentPriceDelayMinutes": 0, "CurrentPriceType": "Bid", "Exposure": 10000, "ExposureCurrency": "GBP", "ExposureInBaseCurrency": 11617.9, "InstrumentPriceDayPercentChange": -0.23, "PositionCount": 1, "PositionsNotClosedCount": 1, "ProfitLossOnTrade": -8.9, "ProfitLossOnTradeInBaseCurrency": -7.85, "Status": "Open", "TradeCostsTotal": -6, "TradeCostsTotalInBaseCurrency": -5.29 } } ] }, "State": "Active" }
-
expected_status
¶
-
response
¶ response - get the response of the request.
-
status_code
¶
-