Class
caplin.fx.trademodel

FxTradeLeg

FXTradeLeg is a concrete implementation of {@link caplin.trading.trademodel.TradeLeg TradeLeg} that aims to provide most of the fields typically used for FX Trades. Spot/Forward {@link caplin.fx.trademodel.FxTrade FxTrade} instances contain a single trade leg, whereas swap instances contain two.

Constructor Summary

Attributes Name and Description
caplin.fx.trademodel.FxTradeLeg(caplin.trading.trademodel.Trade oTrade, int nLegId)

Constructs an instance of caplin.fx.trademodel.FxTradeLeg.

Method Summary

Attributes Name and Description
String getAskFwdPrice()

Returns the price at which the dealer is willing to sell one unit of the base currency on the defined settlement date.

float getAskPoints()

Returns the number of Forward Points for the Ask Rate.

String getAskPrice()

Returns the price at which the dealer is willing to sell one unit of the base currency on the defined settlement date.

String getAskSpotPrice()

Returns the price at which the dealer is willing to buy one unit of the base currency on the spot date.

String getAskSwapPoints()

Returns the difference between the near and the far legs ask price

String getBaseCurrency()

Returns the base currency from the currency pair — this is the first currency within the instrument name.

String getBidFwdPrice()

Returns the price at which the dealer is willing to buy one unit of the base currency on the defined settlement date.

float getBidPoints()

Returns the number of Forward Points for the Bid Rate.

String getBidPrice()

Returns the price at which the dealer is willing to buy one unit of the base currency on the defined settlement date.

String getBidSpotPrice()

Returns the price at which the dealer is willing to sell one unit of the base currency on the spot date.

String getBidSwapPoints()

Returns the difference between the near and the far legs bid price

String getBuySell()

Whether the user has requested only buy side prices, only sell side prices, or prices on both sides.

String getDealtCurrency()

Returns the currency that relates to the amount within the amount field, and which the trade will be performed in.

String getFXInstrument()

Returns the complete RTTP subject name that this instrument can be requested with.

void getFxInstrument()

int getMaxTierLimit()

Returns the highest tier limit — this is effectively the highest amount the user can trade.

String getNotDealtCurrency()

A convenience method that returns the currency from the pair that is not being used as the dealt currency.

String getOppositeCurrency(String sCurrency)

A convenience method that returns the other currency in a currency pair, given one of the two currencies.

int getPointsScaleFactor()

Returns the decimal point scaling factor that can be used to help determine the number of decimal places of data that should be shown in the pip segment of the display.

String getPrice()

Returns either the bid price or the ask price, dependent on the side previously set with #setSide.

String getSettlementDate()

Returns the date the currencies will be exchanged &mdash also known as the delivery date.

String getSide()

Returns the side of the trade that the user has chosen to trade on.

String getTenor()

Returns the tenor, which is a standarized code that can be used to determine the settlement date.

String getTermCurrency()

Returns the term currency from the currency pair — this is the second currency within the instrument name.

int getTierLimit()

Returns the tier limit up to which the currently quoted prices will continue to be valid.

boolean isAskSide()

Returns true if the user is trading on the ask side — i.e.

boolean isBidSide()

Returns true if the user is trading on the bid side — i.e.

boolean isDealtCurrencyBought()

Returns true if the dealt currency is being bought.

boolean isDealtCurrencySold()

Returns true if the dealt currency is being sold.

void setDealtCurrency(String sValue)

Sets the currency that relates to the amount within the amount field, and which the trade will be performed in.

void setFXInstrument(String sValue)

Sets the instrument name, which consists of two concatenated 3-digit ISO currency codes (e.g.

void setInstrument(String sValue)

Sets the instrument name, which consists of two concatenated 3-digit ISO currency codes (e.g.

void setSettlementDate(String sValue)

Set the settlement date for the trade leg.

void setSide(String sSide)

Sets whether the user wants to trade at the bid or the ask price.

void setTenor(String sTenor)

Sets the tenor that logically denotes when the trade will be performed.

void setTradedPrice(String sTradePrice)

Sets the price the user wishes to trade on — this may be different from the last price received from the server due to the latency in displaying updates to the screen.

void stop()

void toggleDealtCurrency()

Switches the dealt currency between the base and the term currency.

Methods inherited from class caplin.trading.trademodel.TradeLeg:
addDataFieldChangedListener, addDataFieldsChangedListener, appendTraceData, dataFieldsUpdatedBySubscriber, getAmount, getAssetClass, getFieldValue, getInstrument, getTrade, isPermissioned, removeDataFieldChangedListener, removeDataFieldsChangedListener, removeInstrumentDataSubscriber, resume, setAmount, setAssetClass, setFieldValue, setInstrumentDataSubscriber, suspend

Constructor Detail

caplin.fx.trademodel.FxTradeLeg(caplin.trading.trademodel.Trade oTrade, int nLegId)

Constructs an instance of caplin.fx.trademodel.FxTradeLeg.

Parameters
caplin.trading.trademodel.Trade oTrade The trade of which this leg is a part.
int nLegId The (one based) leg index of this trade leg.

Method Detail

String getAskFwdPrice()

Returns the price at which the dealer is willing to sell one unit of the base currency on the defined settlement date.

Returns
A string formatted decimal.

float getAskPoints()

Returns the number of Forward Points for the Ask Rate. The number of forward points on a given exchange rate will be determined by the prevailing interest rates, the time period between the spot and forward rate, and other market factors.

Returns
{FLOAT} askPoints

String getAskPrice()

Returns the price at which the dealer is willing to sell one unit of the base currency on the defined settlement date.

When the settlement date returned by #getSettlementDate is the spot date then this method returns the same value as #getAskSpotPrice.

Returns
The price as a string formatted decimal.

String getAskSpotPrice()

Returns the price at which the dealer is willing to buy one unit of the base currency on the spot date.

This method will not return a value when this TradeLeg is the second leg within the parent {@link caplin.trading.trademodel.Trade Trade} object.

Returns
A string formatted decimal.

String getAskSwapPoints()

Returns the difference between the near and the far legs ask price

Returns
A string formatted decimal.

String getBaseCurrency()

Returns the base currency from the currency pair — this is the first currency within the instrument name.

Returns
3-digit ISO currency code.

String getBidFwdPrice()

Returns the price at which the dealer is willing to buy one unit of the base currency on the defined settlement date.

Returns
A string formatted decimal.

float getBidPoints()

Returns the number of Forward Points for the Bid Rate. The number of forward points on a given exchange rate will be determined by the prevailing interest rates, the time period between the spot and forward rate, and other market factors.

Returns
{FLOAT} bidPoints

String getBidPrice()

Returns the price at which the dealer is willing to buy one unit of the base currency on the defined settlement date.

When the settlement date returned by #getSettlementDate is the spot date then this method returns the same value as #getBidSpotPrice.

Returns
A string formatted decimal.

String getBidSpotPrice()

Returns the price at which the dealer is willing to sell one unit of the base currency on the spot date.

This method will not return a value when this TradeLeg is the second leg within the parent {@link caplin.trading.trademodel.Trade Trade} object.

Returns
A string formatted decimal.

String getBidSwapPoints()

Returns the difference between the near and the far legs bid price

Returns
A string formatted decimal.

String getBuySell()

Whether the user has requested only buy side prices, only sell side prices, or prices on both sides.

This value will be disambiguated and given a specific side, once the user executes the trade using #setSide.

Returns
"BUY", "SELL", "2-WAY"

String getDealtCurrency()

Returns the currency that relates to the amount within the amount field, and which the trade will be performed in.

This can be either the dealt currency or the term currency, but initially defaults to being the base currency.

Returns
3-digit ISO currency code.
See
#setDealtCurrency
#getNotDealtCurrency

String getFXInstrument()

Returns the complete RTTP subject name that this instrument can be requested with.

void getFxInstrument()

Deprecated
Please use #getFXInstrument instead.

int getMaxTierLimit()

Returns the highest tier limit — this is effectively the highest amount the user can trade.

See
#getTierLimit

String getNotDealtCurrency()

A convenience method that returns the currency from the pair that is not being used as the dealt currency.

If the dealt currency is the base currency, then this method will return the term currency, whereas if the dealt currency is the term currency then this method will return the base currency.

Returns
3-digit ISO currency code.
See
#getDealtCurrency

String getOppositeCurrency(String sCurrency)

A convenience method that returns the other currency in a currency pair, given one of the two currencies.

Parameters
String sCurrency A string representation of the currency code (e.g GBP).
Returns
3-digit ISO currency code.

int getPointsScaleFactor()

Returns the decimal point scaling factor that can be used to help determine the number of decimal places of data that should be shown in the pip segment of the display.

String getPrice()

Returns either the bid price or the ask price, dependent on the side previously set with #setSide.

If the user has clicked the bid button, and hence #setSide has been called with "BUY", then the bid price is returned, otherwise the "SELL" price will be returned.

Returns
A string formatted decimal.
See
#setSide

String getSettlementDate()

Returns the date the currencies will be exchanged &mdash also known as the delivery date.

Returns
Date in YYYYMMDD format.

String getSide()

Returns the side of the trade that the user has chosen to trade on.

Returns
Either "Bid" or "Ask".
See
#setSide

String getTenor()

Returns the tenor, which is a standarized code that can be used to determine the settlement date.

Example tenors are:

  • SPOT &mdash generally two trading days in the future
  • SPOT NEXT &mdash one trading day after the spot date

See
#setTenor

String getTermCurrency()

Returns the term currency from the currency pair — this is the second currency within the instrument name.

Returns
3-digit ISO currency code.

int getTierLimit()

Returns the tier limit up to which the currently quoted prices will continue to be valid.

The prices quoted are dependent on the amount traded; generally, the greater the amount, the greater the unit price becomes since it requires the dealer to take a greater exposure to change within the market. The tier limit is the largest amount at which the current price will continue to be valid — if an amount larger than this is set (using #setAmount), then the quoted prices will update to reflect the new pricing tier.

See
#getMaxTierLimit

boolean isAskSide()

Returns true if the user is trading on the ask side — i.e. buying the base currency.

boolean isBidSide()

Returns true if the user is trading on the bid side — i.e. selling the base currency.

boolean isDealtCurrencyBought()

Returns true if the dealt currency is being bought.

Whether this is a buy or sell from the traders perspective, rather than a bid or ask, as it is from the dealers perspective.

boolean isDealtCurrencySold()

Returns true if the dealt currency is being sold.

Whether this is a buy or sell from the traders perspective, rather than a bid or ask, as it is from the dealers perspective.

void setDealtCurrency(String sValue)

Sets the currency that relates to the amount within the amount field, and which the trade will be performed in.

Parameters
String sValue A string representation of the currency code (e.g GBP).
See
#getDealtCurrency

void setFXInstrument(String sValue)

Sets the instrument name, which consists of two concatenated 3-digit ISO currency codes (e.g. GBPUSD or EURSEK).

The first code within the instrument name is called the base currency (retrievable via #getBaseCurrency), while the second currency in the instrument name is called the term currency (retrievable via #getTermCurrency).

Parameters
String sValue 6 digit currency pair code.

void setInstrument(String sValue)

Sets the instrument name, which consists of two concatenated 3-digit ISO currency codes (e.g. GBPUSD or EURSEK).

The first code within the instrument name is called the base currency (retrievable via #getBaseCurrency), while the second currency in the instrument name is called the term currency (retrievable via #getTermCurrency).

Parameters
String sValue 6 digit currency pair code.
Deprecated
Please use #setFXInstrument instead.

void setSettlementDate(String sValue)

Set the settlement date for the trade leg.

Parameters
String sValue Date in YYYYMMDD format.
See
#setTenor
#getSettlementDate

void setSide(String sSide)

Sets whether the user wants to trade at the bid or the ask price.

If the side is "Bid", then the user is selling the base currency, and buying the term currency. If the side is "Ask", then the user is buying the base currency, and selling the term currency.

Parameters
String sSide A string representation of the side (either "Bid" or "Ask").

void setTenor(String sTenor)

Sets the tenor that logically denotes when the trade will be performed.

The trade leg uses the {@link caplin.services.date.BusinessDateProvider BusinessDateProvider} service to calculate the actual settlement date based on the given tenor code.

Parameters
String sTenor The tenor.
See
#getTenor
#getSettlementDate

void setTradedPrice(String sTradePrice)

Sets the price the user wishes to trade on — this may be different from the last price received from the server due to the latency in displaying updates to the screen.

Parameters
String sTradePrice Decimal formatted string.

void stop()

See

void toggleDealtCurrency()

Switches the dealt currency between the base and the term currency.