SubscriptionCreate

class saxo_openapi.endpoints.portfolio.accounts.SubscriptionCreate(data)

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

ENDPOINT = 'openapi/port/v1/accounts/subscriptions/'
EXPECTED_STATUS = 201
HEADERS = {'Content-Type': 'application/json'}
METHOD = 'POST'
__init__(data)

Instantiate a SubscriptionCreate request.

Parameters:data (dict (required)) – dict representing the requestbody.
>>> import saxo_openapi
>>> import saxo_openapi.endpoints.portfolio as pf
>>> import json
>>> client = saxo_openapi.API(access_token=...)
>>> data =
        {
          "Arguments": {
            "ClientKey": "Cf4xZWiYL6W1nMKpygBLLA=="
          },
          "ContextId": "explorer_1551455553043",
          "ReferenceId": "I_213"
        }
>>> r = pf.accounts.SubscriptionCreate(data=data)
>>> client.request(r)
>>> print(json.dumps(r.response, indent=2))

Output:

{
  "ContextId": "explorer_1551455553043",
  "Format": "application/json",
  "InactivityTimeout": 30,
  "ReferenceId": "I_213",
  "RefreshRate": 5000,
  "Snapshot": {
    "Data": [
      {
        "AccountGroupKey": "Cf4xZWiYL6W1nMKpygBLLA==",
        "AccountId": "9226397",
        "AccountKey": "Cf4xZWiYL6W1nMKpygBLLA==",
        "AccountType": "Normal",
        "Active": true,
        "CanUseCashPositionsAsMarginCollateral": true,
        "ClientId": "9226397",
        "ClientKey": "Cf4xZWiYL6W1nMKpygBLLA==",
        "CreationDate": "2019-02-02T10:47:42.313000Z",
        "Currency": "EUR",
        "CurrencyDecimals": 2,
        "DirectMarketAccess": false,
        "DisplayName": "bram",
        "IndividualMargining": false,
        "IsCurrencyConversionAtSettlementTime": true,
        "IsMarginTradingAllowed": true,
        "IsShareable": false,
        "IsTrialAccount": true,
        "LegalAssetTypes": [
          "FxSpot",
          "FxForwards",
          "FxVanillaOption",
          "FxKnockInOption",
          "FxKnockOutOption",
          "FxOneTouchOption",
          "FxNoTouchOption"
        ],
        "Sharing": [
          "NoSharing"
        ],
        "SupportsAccountValueProtectionLimit": false,
        "UseCashPositionsAsMarginCollateral": true
      }
    ]
  },
  "State": "Active"
}
expected_status
response

response - get the response of the request.

status_code