Upcoming API Changes to proposal_open_contract API

Dear developers,

We will be making changes to the proposal_open_contract response on 17 June 2020 at 1:00 AM GMT.

 We are adding the subscription ID for the cases when there are no open contracts and you will be able to unsubscribe the same using the Forget call.

Before the change

API call:

{
  "proposal_open_contract": 1,
  "subscribe": 1
}

Response:

{
  "echo_req": {
    "proposal_open_contract": 1,
    "subscribe": 1
  },
  "msg_type": "proposal_open_contract",
  "proposal_open_contract": {}
  }
 }

After the change

While the API call remains the same, we will be including the subscription ID as an additional attribute to the response for the first API call:

{
  "echo_req": {
    "proposal_open_contract": 1,
    "subscribe": 1
  },
  "msg_type": "proposal_open_contract",
  "proposal_open_contract": {}
  },
  "subscription": {
    "id": "cb82de21-b99a-3362-1399-cd42fo734ff4"
  }
 }

For subsequent API calls, we’ll send the following response if you have already subscribed:

{
  "echo_req": {
    "proposal_open_contract": 1,
    "subscribe": 1
  },
  "error": {
    "message": "proposal_open_contract",
    "code": "AlreadySubscribed"
  },
  "msg_type": "proposal_open_contract"
}

To cancel the existing subscription, you may use the Forget API call with the subscription ID:

{
  "forget": "cb82de21-b99a-3362-1399-cd42fo734ff4"
}

Please make the necessary changes to your code.

Thank you.
Team Deriv.com
[email protected]

Sign In or Register to comment.