2.5.4FXB.Instrument helper functions

The FXB.Instrument provides some helper functions to assist with common conversion and calculation tasks in relation to a market.

FXB.Instrument.

Description

ConvertVolumeToLots(x)

Converts a cash/unit amount x to lots: simply divides by the contract size

ConvertLotsToVolume(x)

Converts a lots amount x to cash/units: simply multiplies by the contract size

RoundPrice(x)

Rounds a price x (or a price differential, such as 0.0020) to the nearest multiple of the tickSize, i.e. closest valid price

GetPriceMovementValue(x, volume)

For a price movement, such as 0.0020, and a volume (in cash/units, not lots), calculates the value of the move in the account's deposit currency. The volume parameter can be omitted, and defaults to the contractSize. For example, for EUR/USD on a GBP account, a price movement of 0.0020 with a volume of 100,000 is worth USD 200, and this function will return the current GBP equivalent of USD 200.