API changes - account balance response
Dear developers,
We will be making changes to the balance
API response in the second half of the week starting the 29th of June.
We’re updating the account: all
attribute to give you the balances of all associated accounts in a single response.
Note: account: all
requires a login token, and doesn't work with a regular API token.
Before the change
API call: { "balance": 1, "account": "all" } Response: Our API currently returns a response like the one below for every associated account. For example, if there are four associated accounts, there will be four corresponding responses. { "balance": { "balance": 100, "currency": "USD", "loginid": "CR90000000", "total": { "mt5": { "amount": 100, "currency": "USD" }, "real": { "amount": 0, "currency": "USD" } } }, "echo_req": { "account": "all", "balance": 1 }, "msg_type": "balance", "passthrough": {} }
After the change
While the API call remains the same, the single response will include the balances of all the associated accounts. Also, the name of 'total/real' attribute will be changed to 'total/deriv'.
{ "balance": { "accounts": { "CR90000000": { "balance": 0, "converted_amount": 100, "currency": "USD", "demo_account": 0, "type": "deriv" }, "VRTC90000000": { "balance": 10000, "converted_amount": 10000, "currency": "USD", "demo_account": 1, "type": "deriv" }, "MTR000000": { "balance": 0, "converted_amount": 100, "currency": "USD", "demo_account": 0, "type": "mt5" }, "MTD000000": { "balance": 10000, "converted_amount": 10000, "currency": "USD", "demo_account": 1, "type": "mt5" } }, "balance": 100, "currency": "USD", "loginid": "CR90000000", "total": { "deriv": { "amount": 100, "currency": "USD" }, "deriv_demo": { "amount": 10000, "currency": "USD" }, "mt5": { "amount": 100, "currency": "USD" }, "mt5_demo": { "amount": 10000, "currency": "USD" } } }, "echo_req": { "account": "all", "balance": 1 }, "msg_type": "balance" }
Please make the necessary changes to your code.
Thank you.
Team Deriv.com
[email protected]