Skip to content

Calculate swap

CalculateSwap

Description: Calculates the swap value for a trade based on trade parameters, user group, and symbol configuration.

Request Parameters

Name Type Required Description
login int Yes User login ID
cmd int Yes Trade command type (e.g., OP_BUY = 0, OP_SELL = 1)
open_price double Yes Opening price of the trade
open_time int Yes Opening time of the trade (epoch)
close_time int No Optional closing time (epoch)
volume int Yes Trade volume in minimal lots
symbol string Yes Trading symbol (e.g., "EURUSD")

Request Example

{
  "login": 123456,
  "cmd": 0,
  "open_price": 1.1050,
  "open_time": 1629981234,
  "close_time": 1630000000,
  "volume": 1000,
  "symbol": "EURUSD"
}

Response Parameters

Name Type Description
swap double Calculated swap value in units

Response Example

{
  "swap": -1.75
}