Profit table
AccountAuth RequiredGet the profit and loss history of closed contracts. The loginid parameter and app_id field are removed, and contract_type values changed.
3 Breaking Changes
loginid parameter and the app_id field are removed, and the contract_type filter accepts different values.Quick comparison
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 profit_table requests. Your token selects the account.
2. app_id removed from transactions
The Legacy API returned app_id, the ID of the app the contract was bought through, on each transaction. The New API does not return it.
Required change: Stop reading app_id from profit table transactions.
3. contract_type values changed
The contract_type filter no longer accepts CALLSPREAD, PUTSPREAD, LBFLOATCALL, LBFLOATPUT or LBHIGHLOW, and adds HIGHER and LOWER.
Required change: Remove the values the New API no longer accepts from contract_type.
Request structure
{
"profit_table": 1,
"contract_type": [
"CALL",
"CALLSPREAD"
],
"description": 1,
"limit": 25,
"loginid": "CR123456",
"req_id": 1
}{
"profit_table": 1,
"contract_type": [
"CALL",
"HIGHER"
],
"description": 1,
"limit": 25,
"req_id": 1
}Response structure
{
"echo_req": {
"profit_table": 1,
"contract_type": [
"CALL",
"CALLSPREAD"
],
"description": 1,
"limit": 25,
"loginid": "CR123456",
"req_id": 1
},
"msg_type": "profit_table",
"profit_table": {
"count": 1,
"transactions": [
{
"buy_price": 10,
"contract_id": 11542203588,
"contract_type": "CALL",
"duration_type": "minutes",
"longcode": "Win payout if Volatility 100 Index is strictly higher than entry spot at 5 minutes after contract start time.",
"payout": 19.55,
"purchase_time": 1760000000,
"sell_price": 19.55,
"sell_time": 1760000300,
"shortcode": "CALL_R_100_19.55_1760000000_1760000300_S0P_0",
"transaction_id": 11542203587,
"underlying_symbol": "R_100",
"app_id": 1089
}
]
},
"req_id": 1
}{
"echo_req": {
"profit_table": 1,
"contract_type": [
"CALL",
"HIGHER"
],
"description": 1,
"limit": 25,
"req_id": 1
},
"msg_type": "profit_table",
"profit_table": {
"count": 1,
"transactions": [
{
"buy_price": 10,
"contract_id": 11542203588,
"contract_type": "CALL",
"duration_type": "minutes",
"longcode": "Win payout if Volatility 100 Index is strictly higher than entry spot at 5 minutes after contract start time.",
"payout": 19.55,
"purchase_time": 1760000000,
"sell_price": 19.55,
"sell_time": 1760000300,
"shortcode": "CALL_R_100_19.55_1760000000_1760000300_S0P_0",
"transaction_id": 11542203587,
"underlying_symbol": "R_100"
}
]
},
"req_id": 1
}Code examples
function getProfitTable(loginId) {
ws.send(JSON.stringify({ profit_table: 1, description: 1, limit: 25, loginid: loginId }));
ws.onmessage = (event) => {
const response = JSON.parse(event.data);
if (response.msg_type !== "profit_table") return;
if (response.profit_table) {
response.profit_table.transactions?.forEach((tx) => {
console.log(tx.contract_id, tx.sell_price - tx.buy_price, tx.app_id);
});
}
};
}Any other questions? Get in touch