This is in beta and therefore subject to API changes.
The TradeFactory interface should be implemented by objects that create module:caplin/trading/trademodel/Trade
objects.
The trade factory is used to create fresh module:caplin/trading/trademodel/Trade
objects, or to restore trade
objects based on the contents of a Map
. It also informs any
module:caplin/trading/trademodel/TradeFactoryListener
registered via module:caplin/trading/trademodel/TradeFactory#addListener
whenever it
creates a new trade.
Methods
-
createNewTrade(mTradeFields)
-
Create a
Trade
object for a new trade.Parameters:
Name Type Description mTradeFields
Map The map of fields required to create a trade. This should at least include AssetClass (e.g "FX"), TradingProtocol (e.g "RFS") and InstrumentName (e.g "/FX/GBPUSD"). -
restoreExistingTrade(oTrade, mFieldMap)
-
Restores a trade that is currently known on the client.
Parameters:
Name Type Description oTrade
module:caplin/trading/trademodel/Trade The trade object to restore. mFieldMap
Map The trade data to restore the trade with. -
restoreNewTrade(mFieldMap) → {module:caplin/trading/trademodel/Trade}
-
Restores a trade that is not known on the client, then returns the newly created trade.
Parameters:
Name Type Description mFieldMap
Map The data to restore the trade with. Returns:
The newly created trade.