GetOrderSwap

Returns the swap value of the currently selected order.

Syntax

GetOrderSwap(): number

Return Value

Returns a number representing the swap value (in account currency) accumulated for the selected order.

Description

The GetOrderSwap method returns the swap value that has accumulated for the currently selected order. Swaps are interest charges or credits applied to positions held overnight, based on the interest rate differentials between the currencies in the pair.

Before using this method, you must first select an order using the SelectOrder method.

Example

// Select an order by ticket number
if (this.api.SelectOrder(12345, EOrderSelectMode.SELECT_ORDER_BY_TICKET)) {
  // Get the order swap
  const swap = this.api.GetOrderSwap();

  console.log(`Order #12345 swap: ${swap}`);
}

Notes

  • An order must be selected first using SelectOrder before calling this method.

Last updated