Interface
caplin.trading.trademodel

TradeFactory

The class is still in Beta and is subject to API changes.
The trade factory is used to create fresh caplin.trading.trademodel.Trade objects, or to restore trade objects based on the contents of a Map. It also informs any caplin.trading.trademodel.TradeFactoryListener registered via #addListener whenever it creates a new trade.

Constructor Summary

Attributes Name and Description
caplin.trading.trademodel.TradeFactory( oTradeMessageService)

The TradeFactory interface should be implemented by objects that create caplin.trading.trademodel.Trade objects.

Method Summary

Attributes Name and Description
void createNewTrade(Map mTradeFields)

Create a Trade object for a new trade.

void restoreExistingTrade(caplin.trading.trademodel.Trade oTrade, Map mFieldMap)

Restores a trade that is currently known on the client.

caplin.trading.trademodel.Trade restoreNewTrade(Map mFieldMap)

Restores a trade that is not known on the client, then returns the newly created trade.

Constructor Detail

caplin.trading.trademodel.TradeFactory( oTradeMessageService)

The TradeFactory interface should be implemented by objects that create caplin.trading.trademodel.Trade objects.

Parameters
oTradeMessageService

Method Detail

void createNewTrade(Map mTradeFields)

Create a Trade object for a new trade.

Parameters
Map mTradeFields 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").

void restoreExistingTrade(caplin.trading.trademodel.Trade oTrade, Map mFieldMap)

Restores a trade that is currently known on the client.

Parameters
caplin.trading.trademodel.Trade oTrade The trade object to restore.
Map mFieldMap The trade data to restore the trade with.

caplin.trading.trademodel.Trade restoreNewTrade(Map mFieldMap)

Restores a trade that is not known on the client, then returns the newly created trade.

Parameters
Map mFieldMap The data to restore the trade with.
Returns
{caplin.trading.trademodel.Trade} The newly created trade.