Deriv API
Documentation

Contract update history

TradingAuth Required

Retrieves the historical and most recent update status of a contract, including all changes made to contract parameters such as stop loss and take profit values.

Quick comparison

AspectLegacy APINew APIAction
Endpointcontract_update_historycontract_update_historyNone
Auth RequiredYesYesNone
loginid ParameterOptionalRemovedRemove from requests
Response contract_update_historyOptionalRequiredUpdate response handling

Breaking changes

1. LoginID parameter removed

The loginid parameter used for multi-token authorization scenarios has been removed. Account context must now be managed through the authorization flow.

2. Response field contract_update_history now required

The contract_update_history array in the response is now a required field.

Required change: Update response handling code. You can now rely on this field being present without null checks for the array itself.

3. Response array items have required fields

Each item in the contract_update_history array now requires four fields: display_name, order_amount, order_date, and order_type.

Required change: You can simplify your code by removing defensive null checks for these now-required fields.

Request structure

Legacy APIrequest example
{
  "contract_update_history": 1,
  "contract_id": 123,
  "limit": 500,  // Optional: defaults to 500, min 1, max 999
  "loginid": "CR123456"  // ❌ Removed in New
}
New APIrequest example
{
  "contract_update_history": 1,
  "contract_id": 123,
  "limit": 500
}

Response structure

Legacy APIresponse example
// contract_update_history: OPTIONAL
// All array item fields: OPTIONAL
{
  "contract_update_history": [
    {
      "display_name": "Stop Loss",
      "order_amount": "10.50",
      "order_date": 1699564800,
      "order_type": "stop_loss",
      "value": "1234.56"
    }
  ],
  "msg_type": "contract_update_history"
}
New APIresponse example
// contract_update_history: ✅ REQUIRED
// Required fields: display_name, order_amount, order_date, order_type
{
  "contract_update_history": [
    {
      "display_name": "Stop Loss",
      "order_amount": "10.50",
      "order_date": 1699564800,
      "order_type": "stop_loss",
      "value": "1234.56"
    }
  ],
  "msg_type": "contract_update_history"
}

Code examples

async function getContractUpdateHistory(contractId) {
  const request = {
    contract_update_history: 1,
    contract_id: contractId,
    limit: 500,
    loginid: "CR123456"
  };
  
  ws.send(JSON.stringify(request));
  
  ws.onmessage = (event) => {
    const response = JSON.parse(event.data);
    if (response.msg_type === "contract_update_history") {
      const updates = response.contract_update_history;
      updates?.forEach(update => {
        console.log(update.display_name + ": " + update.order_amount);
      });
    }
  };
}
Click to open live chat support. Get instant help from our support team.