CreatePriceAlert

class saxo_openapi.endpoints.valueadd.pricealerts.CreatePriceAlert(data)

Create a new price alert definition. The created definition is returned with a couple of more properties, the price alert definition ID being one of them.

ENDPOINT = 'openapi/vas/v1/pricealerts/definitions/'
EXPECTED_STATUS = 201
METHOD = 'POST'
__init__(data)

Instantiate a CreatePriceAlert request.

Parameters:data (dict (required)) – dict representing the body parameters.
>>> import saxo_openapi
>>> import saxo_openapi.endpoints.valueadd as va
>>> import json
>>> client = saxo_openapi.API(access_token=...)
>>> data =
        {
          "AccountId": "13457INET",
          "AssetType": "FxSpot",
          "Comment": "I believe EURUSD will go up within the next few years!",
          "ExpiryDate": "2016-09-30T12:00:00Z",
          "IsRecurring": true,
          "Operator": "GreaterOrEqual",
          "PriceVariable": "AskTick",
          "State": "Enabled",
          "TargetValue": 1.34595,
          "Uic": 21
        }
>>> r = va.pricealerts.CreatePriceAlert(AlertDefinitionId)
>>> rv = client.request(r)
>>> print(json.dumps(rv, indent=2))
{
  "AccountId": "13457INET",
  "AlertDefinitionId": "30834",
  "AssetType": "FxSpot",
  "Comment": "I believe EURUSD will go up within the next few years!",
  "ExpiryDate": "2016-09-30T12:00:00Z",
  "IsRecurring": true,
  "Operator": "GreaterOrEqual",
  "PriceVariable": "AskTick",
  "State": "Enabled",
  "TargetValue": 1.34595,
  "Uic": 21,
  "UserId": "2361528"
}
expected_status
response

response - get the response of the request.

status_code