Documentation

Proposal open contract

TradingAuth Required

Get the details of an open contract. The loginid parameter is removed, price and spot fields are strings, underlying is renamed to underlying_symbol, and tick, display and Snowball fields are removed.

Quick comparison

AspectLegacy APINew APIAction
Endpointproposal_open_contractproposal_open_contractNone
Auth RequiredYesYesNone
loginid parameterOptionalRemovedRemove from requests
Price and spot fieldsNumbersStringsParse as numbers
Symbol fieldunderlyingunderlying_symbolRename in your code
Tick fieldsentry_tick, exit_tickentry_spot, exit_spotRead the spot fields

Breaking changes

1. loginid parameter removed

In the Legacy API, loginid selected the account when you authorised several accounts. The New API does not accept it.

Required change: Remove loginid from your proposal_open_contract requests. Your token selects the account.

2. Price and spot fields are now strings

These fields were numbers in the Legacy API and are strings in the New API:

  • Strings: bid_price, buy_price, current_spot, payout and profit.
  • Strings that can be null, as before: commission and entry_spot.
  • Strings that can now be null: selected_spot and sell_price.

cancellation.ask_price is still a number, but can now be null.

Required change: Convert these fields to numbers before you calculate with them, and handle null.

3. underlying renamed to underlying_symbol

The contract returns its symbol as underlying_symbol instead of underlying.

Required change: Read underlying_symbol instead of underlying.

4. Tick fields replaced by spot fields

entry_tick, entry_tick_time, exit_tick and exit_tick_time are no longer returned. Use entry_spot, entry_spot_time, exit_spot and exit_spot_time instead.

Required change: Read the spot fields instead of the tick fields.

5. sell_spot and sell_spot_time removed

sell_spot and sell_spot_time are no longer returned.

Required change: Read exit_spot and exit_spot_time instead.

6. Display fields removed

display_name, display_value, current_spot_display_value, entry_spot_display_value, entry_tick_display_value, exit_tick_display_value and sell_spot_display_value are no longer returned. Neither is commision, a misspelt duplicate of commission.

Required change: Format prices and spots from the string fields yourself, for example bid_price in place of display_value.

7. is_forward_starting removed

is_forward_starting is no longer returned.

Required change: Stop reading is_forward_starting.

8. Snowball fields removed

caution_price, coupon_collection_epochs, coupon_rate, num_of_coupons, profit_price and trade_risk_profile, which described Snowball contracts, are no longer returned.

Required change: Stop reading these fields.

Request structure

Legacy APIrequest example
{
  "proposal_open_contract": 1,
  "contract_id": 11542203588,
  "subscribe": 1,
  "loginid": "CR123456",
  "req_id": 1
}
New APIrequest example
{
  "proposal_open_contract": 1,
  "contract_id": 11542203588,
  "subscribe": 1,
  "req_id": 1
}

Response structure

Legacy APIresponse example
{
  "echo_req": {
    "proposal_open_contract": 1,
    "contract_id": 11542203588,
    "subscribe": 1,
    "loginid": "CR123456",
    "req_id": 1
  },
  "msg_type": "proposal_open_contract",
  "proposal_open_contract": {
    "contract_id": 11542203588,
    "contract_type": "CALL",
    "currency": "USD",
    "date_expiry": 1760000300,
    "date_start": 1760000000,
    "id": "c84a793b-8a87-7999-ce10-9b22f7ceead3",
    "is_expired": 0,
    "is_sold": 0,
    "is_valid_to_sell": 1,
    "longcode": "Win payout if Volatility 100 Index is strictly higher than entry spot at 5 minutes after contract start time.",
    "status": "open",
    "bid_price": 12.34,
    "buy_price": 10,
    "current_spot": 1235.12,
    "display_name": "Volatility 100 Index",
    "display_value": "12.34",
    "entry_spot": 1234.56,
    "entry_tick": 1234.56,
    "entry_tick_time": 1760000002,
    "is_forward_starting": 0,
    "payout": 19.55,
    "profit": 2.34,
    "underlying": "R_100"
  },
  "req_id": 1,
  "subscription": {
    "id": "c84a793b-8a87-7999-ce10-9b22f7ceead3"
  }
}
New APIresponse example
{
  "echo_req": {
    "proposal_open_contract": 1,
    "contract_id": 11542203588,
    "subscribe": 1,
    "req_id": 1
  },
  "msg_type": "proposal_open_contract",
  "proposal_open_contract": {
    "contract_id": 11542203588,
    "contract_type": "CALL",
    "currency": "USD",
    "date_expiry": 1760000300,
    "date_start": 1760000000,
    "id": "c84a793b-8a87-7999-ce10-9b22f7ceead3",
    "is_expired": 0,
    "is_sold": 0,
    "is_valid_to_sell": 1,
    "longcode": "Win payout if Volatility 100 Index is strictly higher than entry spot at 5 minutes after contract start time.",
    "status": "open",
    "bid_price": "12.34",
    "buy_price": "10.00",
    "current_spot": "1235.12",
    "entry_spot": "1234.56",
    "entry_spot_time": 1760000002,
    "payout": "19.55",
    "profit": "2.34",
    "sell_price": null,
    "underlying_symbol": "R_100"
  },
  "req_id": 1,
  "subscription": {
    "id": "c84a793b-8a87-7999-ce10-9b22f7ceead3"
  }
}

Code examples

function watchContract(contractId, loginId) {
  ws.send(JSON.stringify({ proposal_open_contract: 1, contract_id: contractId, subscribe: 1, loginid: loginId }));

  ws.onmessage = (event) => {
    const response = JSON.parse(event.data);
    if (response.msg_type !== "proposal_open_contract" || !response.proposal_open_contract) return;

    const contract = response.proposal_open_contract;
    console.log(contract.underlying, contract.display_value);
    console.log("Profit:", contract.profit.toFixed(2));
    console.log("Entry tick:", contract.entry_tick);
  };
}

Any other questions? Get in touch

Click to open live chat support. Get instant help from our support team.