new module:ct-fx /trademodel /FxTrade Leg(oTrade, nLeg Id)
Constructs an instance of FxTradeLeg
.
Extends:
Parameters:
Name | Type | Description |
---|---|---|
oTrade |
module:ct-trading |
The trade of which this leg is a part. |
nLegId |
int |
The (one based) leg index of this trade leg.
|
Extends
Methods
add Data Field Changed Listener(listener, field Name, notify Immediateopt)
Adds a listener that is called when the specified field is updated.
If it's more convenient it's also possible to add leg field listeners directly on the associated
module:ct-trading/trademodel/Trade
instance, where the given field names must have the leg prefix prepended,
e.g. 'L1_Amount' rather than 'Amount'.
N.b. If the notifyImmediate
flag is set to true
and there is a
possibility that the field in question does not have a value at the point the listener is registered, then the first
call to the module:ct-trading/trademodel/DataFieldChangedListener#dataFieldChanged
method may be with an
undefined
value.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
listener |
module:ct-trading |
The listener object to add. |
|
fieldName |
String | The field to listen to. |
|
notifyImmediate |
boolean |
<optional> |
if set to |
- Inherited From:
- See:
add Data Fields Changed Listener(listener, field Names)
Adds a listener object that is called when any of the specified fields are updated.
Parameters:
Name | Type | Description |
---|---|---|
listener |
module:ct-trading |
The listener object to add. |
fieldNames |
Array | The list of fields to send updates for. |
- Inherited From:
- See:
append Trace Data(mTrace Data)
Append trace data into the internal data structure, so it can be sent to the server for analysis. This does not fire any listeners or run any derivations.
Parameters:
Name | Type | Description |
---|---|---|
mTraceData |
Map | Data to be traced. |
- Inherited From:
data Fields Updated BySubscriber(field Data)
This method is a callback method used by the subscriber to notify the leg when new data is received from the server. The field names arriving from the server are not prefixed with the leg number.
Parameters:
Name | Type | Description |
---|---|---|
fieldData |
module:ct-trading |
The new data from the server. |
get Amount() → {String}
Returns the number of units of the underlying financial instrument to be traded.
- Inherited From:
- See:
Returns:
The number of units
- Type
- String
get Ask Fwd Price()
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.
get Ask Points() → {FLOAT}
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:
askPoints
- Type
- FLOAT
get Ask Price()
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 module:ct-fx/trademodel/FxTradeLeg#getSettlementDate
is the spot date then this method returns the same
value as module:ct-fx/trademodel/FxTradeLeg#getAskSpotPrice
.
Returns:
The price as a string formatted decimal.
get Ask Spot Price()
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
Trade
object.
Returns:
A string formatted decimal.
get Ask Swap Points()
Returns the difference between the near and the far legs ask price
Returns:
A string formatted decimal.
get Asset Class() → {String}
Returns the type of the financial instrument(s) to be traded — e.g FX, FI, EQUITY or COMMODITIES.
- Inherited From:
- See:
Returns:
The instrument type
- Type
- String
get Base Currency() → {String}
Returns the base currency from the currency pair — this is the first currency within the instrument name.
Returns:
3-digit ISO currency code.
- Type
- String
get Bid Fwd Price()
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.
get Bid Points() → {FLOAT}
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:
bidPoints
- Type
- FLOAT
get Bid Price()
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 module:ct-fx/trademodel/FxTradeLeg#getSettlementDate
is the spot date then this method returns the same
value as module:ct-fx/trademodel/FxTradeLeg#getBidSpotPrice
.
Returns:
A string formatted decimal.
get Bid Spot Price()
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
Trade
object.
Returns:
A string formatted decimal.
get Bid Swap Points()
Returns the difference between the near and the far legs bid price
Returns:
A string formatted decimal.
get Buy Sell() → {String}
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
module:ct-fx/trademodel/FxTradeLeg#setSide
.
Returns:
'BUY', 'SELL', '2-WAY'
- Type
- String
get Dealt Currency() → {String}
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.
- See:
Returns:
3-digit ISO currency code.
- Type
- String
get Field Value(field Name)
Returns the field value with the specified name.
The field name follows the java beans naming convention. For any methods
getXxx()
/setXxx()
there should be a field with the corresponding name, 'xxx'.
Parameters:
Name | Type | Description |
---|---|---|
fieldName |
String | The unique identifier for the field. |
- Inherited From:
get FXInstrument()
Returns the complete RTTP subject name that this instrument can be requested with.
get FxInstrument()
- Deprecated:
- Please use
module:ct-fx/trademodel/FxTradeLeg#getFXInstrument
instead.
- Please use
get Instrument() → {String}
Returns the financial instrument that is currently being traded on this leg.
The format of the name is dependent on the asset class. Any processing for specific asset classes should be added
to subclasses of TradeLeg
. The instrument name is generally not understood by Liberator. Liberator
requires a subject name that consists of a concatenation of asset class and instrument name.
- Inherited From:
- See:
Returns:
The instrument
- Type
- String
get Max Tier Limit()
Returns the highest tier limit — this is effectively the highest amount the user can trade.
get Not Dealt Currency() → {String}
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.
- Type
- String
get Opposite Currency(sCurrency) → {String}
A convenience method that returns the other currency in a currency pair, given one of the two currencies.
Parameters:
Name | Type | Description |
---|---|---|
sCurrency |
String | A string representation of the currency code (e.g GBP). |
Returns:
3-digit ISO currency code.
- Type
- String
get Points Scale Factor()
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.
get Price() → {String}
Returns either the bid price or the ask price, dependent on the side previously set with module:ct-fx/trademodel/FxTradeLeg#setSide
.
If the user has clicked the bid button, and hence module:ct-fx/trademodel/FxTradeLeg#setSide
has been called with 'BUY', then the bid price
is returned, otherwise the 'SELL' price will be returned.
Returns:
A string formatted decimal.
- Type
- String
get Settlement Date() → {String}
Returns the date the currencies will be exchanged &mdash also known as the delivery date.
Returns:
Date in YYYYMMDD format.
- Type
- String
get Side() → {String}
Returns the side of the trade that the user has chosen to trade on.
Returns:
Either 'Bid' or 'Ask'.
- Type
- String
get Tenor()
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
get Term Currency() → {String}
Returns the term currency from the currency pair — this is the second currency within the instrument name.
Returns:
3-digit ISO currency code.
- Type
- String
get Tier Limit()
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 module:ct-fx/trademodel/FxTradeLeg#setAmount
), then the quoted prices will update to reflect the new pricing tier.
get Trade() → {module:ct-trading /trademodel /Trade}
Returns the module:ct-trading/trademodel/Trade
object that this leg is a part of.
- Inherited From:
Returns:
The trade
is Ask Side()
Returns true
if the user is trading on the ask side — i.e. buying the base currency.
is Bid Side()
Returns true
if the user is trading on the bid side — i.e. selling the base currency.
is Dealt Currency Bought()
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.
is Dealt Currency Sold()
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.
is Permissioned()
Returns whether the user is permissioned to trade on this leg, based on the results of querying the
module:ct-services/security/PermissionService
singleton.
The permission service is queried based on the instrument that is being traded within the leg
(retrieved via module:ct-trading/trademodel/TradeLeg#getInstrument
) and the the trading protocol being used to perform the trade (retrieved via
module:ct-trading/trademodel/Trade#getTradingProtocol
).
- Inherited From:
remove Data Field Changed Listener(listener, field Name)
Removes the previously registered DataFieldChangedListener
.
Parameters:
Name | Type | Description |
---|---|---|
listener |
module:ct-trading |
The listener to remove. |
fieldName |
String | The data field that the listener should be removed from. |
- Inherited From:
- See:
remove Data Fields Changed Listener(listener, field Names)
Removes a listener object from each of the passed fields.
Parameters:
Name | Type | Description |
---|---|---|
listener |
module:ct-trading |
The listener object to remove. |
fieldNames |
Array | The list of fields to send updates for. |
- Inherited From:
- See:
remove Instrument Data Subscriber()
Removes and unsubscribes the leg from the previously registered
module:ct-trading/trademodel/InstrumentDataSubscriber
.
- Inherited From:
- See:
resume()
Resume a previously suspended indicative data subscription on the trade leg. If there is no indicative data subscription, it does nothing. If this trade leg is not suspended it does nothing.
- Inherited From:
set Amount(amount)
Sets the number of units of the underlying financial instrument to be traded.
Parameters:
Name | Type | Description |
---|---|---|
amount |
String | The number of units of the underlying financial instrument to be traded. |
- Inherited From:
- See:
set Asset Class(asset Class)
Sets the type of the instrument to be traded — e.g FX, FI, EQUITY or COMMODITIES.
Parameters:
Name | Type | Description |
---|---|---|
assetClass |
String | The asset class that is being traded. |
- Inherited From:
- See:
set Dealt Currency(sValue)
Sets the currency that relates to the amount within the amount field, and which the trade will be performed in.
Parameters:
Name | Type | Description |
---|---|---|
sValue |
String | A string representation of the currency code (e.g GBP). |
set Field Value(field Name, sValue)
Sets the value within the trade leg. Initial the trade instance is asked to validate the change. If all is well then the change is made within the leg and the data change listeners are notified (called in response to user input).
Parameters:
Name | Type | Description |
---|---|---|
fieldName |
String | The field name of the field that has changed. |
sValue |
String | The new value of the field |
- Inherited From:
set FXInstrument(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 module:ct-fx/trademodel/FxTradeLeg#getBaseCurrency
),
while the second currency in the instrument name is called the term currency (retrievable via
module:ct-fx/trademodel/FxTradeLeg#getTermCurrency
).
Parameters:
Name | Type | Description |
---|---|---|
sValue |
String | 6 digit currency pair code. |
set Instrument(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 module:ct-fx/trademodel/FxTradeLeg#getBaseCurrency
),
while the second currency in the instrument name is called the term currency (retrievable via
module:ct-fx/trademodel/FxTradeLeg#getTermCurrency
).
Parameters:
Name | Type | Description |
---|---|---|
sValue |
String | 6 digit currency pair code. |
- Overrides:
- Deprecated:
- Please use
instead.module:ct-fx/trademodel/FxTradeLeg#setFXInstrument
- Please use
set Instrument Data Subscriber(instrument Data Subscriber)
Sets the InstrumentDataSubscriber
used to be obtain the prices for the instrument.
For certain trade protocols (e.g. ESP) the prices are pre-populated. In this case, when the user initiates the trade the existing price is used.
Parameters:
Name | Type | Description |
---|---|---|
instrumentDataSubscriber |
module:ct-trading |
The subscriber that will retrieve all instrument data for this trade leg. |
- Inherited From:
- See:
set Settlement Date(sValue)
Set the settlement date for the trade leg.
Parameters:
Name | Type | Description |
---|---|---|
sValue |
String | Date in YYYYMMDD format. |
- See:
set Side(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:
Name | Type | Description |
---|---|---|
sSide |
String | A string representation of the side (either 'Bid' or 'Ask'). |
set Tenor(sTenor)
Sets the tenor that logically denotes when the trade will be performed.
The trade leg uses the BusinessDateProvider
service to calculate
the actual settlement date based on the given tenor code.
Parameters:
Name | Type | Description |
---|---|---|
sTenor |
String | The tenor. |
- See:
set Traded Price(sTrade Price)
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:
Name | Type | Description |
---|---|---|
sTradePrice |
String | Decimal formatted string. |
stop()
- Overrides:
- See:
-
module:ct-trading/trademodel/TradeLeg.prototype.stop
suspend()
Temporarily suspends the indicative data subscription on the trade leg.
If there is no indicative data subscription, or if the trade leg is already suspended, calling this method has no effect.
- Inherited From:
toggle Dealt Currency()
Switches the dealt currency between the base and the term currency.