Constructor
new module:ct-trading /trademodel /Trade Factory Repository()
Constructs a new TradeFactoryRepository
with the specified arguments.
- Implements:
Methods
add Listener()
- See:
-
- module:ct-trading/trademodel/TradeFactory#addListener
get Trade Factory(mField Map) → {module:ct-trading /trademodel /Trade Factory}
Gets a TradeFactory that can create a module:ct-trading/trademodel/Trade
for the given field map.
For a TradeFactory to be returned one must have been registered with a map that has elements that
match the parameter mFieldMap
.
The ordering of the elements within the map is not important. For example, if a TradeFactory is registered using
module:ct-trading/trademodel/TradeFactoryRepository#registerTradeFactory
with the map:
{
"TradeProtocol": "ESP",
"AssetClass": "FX"
}
And the module:ct-trading/trademodel/TradeFactoryRepository#getTradeFactory
method is called with a map
with the element order reversed the match will succeed and a TradeFactory will be returned.
{
"AssetClass": "FX"
"TradeProtocol": "ESP",
}
In addition, the requirement is that all map elements from the registered map must be present in the field map.
There is no requirement that the map passed to module:ct-trading/trademodel/TradeFactoryRepository#getTradeFactory
cannot contain additional elements. For example, the following would also match because it contains "TradeProtocol" and
"AssetClass" with the expected values:
{
"Account": "AccountOne",
"AssetClass": "FX"
"BaseCurrency": "USD",
"TradeProtocol": "ESP",
"UserName": "Fred"
}
It is possible to register multiple trade factory objects with maps that may match. In this scenario
the factory that has been registered first will be retrieved by module:ct-trading/trademodel/TradeFactoryRepository#getTradeFactory
.
Parameters:
Name | Type | Description |
---|---|---|
mFieldMap |
Map | The map to be matched against maps registered with a TradeFactory. |
Returns:
A TradeFactory that can create a
module:ct-trading/trademodel/Trade
for the given field map.
register Trade Factory(mField Map, oTrade Factory)
Creates an association between a Map
and a TradeFactory.
Trade factories can later be retrieved using module:ct-trading/trademodel/TradeFactoryRepository#getTradeFactory
and are used
in calls to module:ct-trading/trademodel/TradeFactoryRepository#restoreExistingTrade
.
It is possible to register multiple trade factory objects with maps that may match. In this scenario the factory
that has been registered first will be retrieved by module:ct-trading/trademodel/TradeFactoryRepository#getTradeFactory
and used by module:ct-trading/trademodel/TradeFactoryRepository#restoreExistingTrade
.
Parameters:
Name | Type | Description |
---|---|---|
mFieldMap |
Map | The field map to be used in matches following calls to |
oTradeFactory |
module:ct-trading |
The TradeFactory. |