CalculateProfit
Description: Calculates a trade's raw instrument profit from its symbol settings, prices, and volume.
Request Parameters
| Name |
Type |
Required |
Description |
login |
int |
Yes |
Account login used to verify that the account exists. |
open_price |
double |
Yes |
Trade opening price. |
close_price |
double |
Yes |
Closing or valuation price. |
volume |
int |
Yes |
Trade volume in internal units. |
symbol |
string |
Yes |
Exact configured trading symbol. |
Request Example
{
"login": 123456,
"open_price": 1.1000,
"close_price": 1.1050,
"volume": 1000,
"symbol": "EURUSD"
}
Response Parameters
| Name |
Type |
Description |
margin |
double |
Raw calculated trade profit in the symbol's quote/profit currency. Despite the field name, this response value is not margin. |
Response Example
Calculation limits
- The command does not accept a
cmd/side field. The current handler leaves the trade command at its default value (0, OP_BUY), so the calculation follows the BUY price-difference branch.
- It verifies the login exists, but does not read the account group currency or convert the result into that currency.
- The result is raw instrument PnL. It does not include commission, storage, account-currency conversion, or final money rounding.
- For quote-based floating P/L in the terminal and Backoffice, see Profit valuation and currency conversion. This command does not provide a per-position quote-update stream.