Constructor
new module:caplin/trading/trademodel/LegManager()
Constructs an instance of
caplin.trading.trademodel.LegManager
.
Methods
-
addLeg(oLeg, sEventSource) → {module:caplin/trading/trademodel/StructureChangedEvent}
-
Adds a TradeLeg to this LegManager.
Parameters:
Name Type Description oLeg
module:caplin/trading/trademodel/TradeLeg the TradeLeg to add. May not be null. sEventSource
String the source of this add event. Should be one of TransitionSource
Throws:
-
-
if the sEventSource is not a valid
TransitionSource
-
-
-
if the oLeg is not being managed by this LegManager.
-
Returns:
the add event for this action. -
-
clearPendingStructureChanges()
-
Clears the pending structure changes.
-
getLegById(the) → {module:caplin/trading/trademodel/TradeLeg}
-
Gets the leg by its Id
Parameters:
Name Type Description the
Number id of the trade leg. Returns:
the leg corresponding to the passed id, or undefined. -
getLegByIndex(legIndex) → {module:caplin/trading/trademodel/TradeLeg}
-
Gets the leg by its index.
Parameters:
Name Type Description legIndex
Number the index of the trade leg within its trade. Returns:
the leg at the corresponding index, or undefined. -
getLegCount() → {int}
-
Gets the number of legs
Returns:
the number of legs this LegManager is holding.- Type
- int
-
getLegs() → {Array}
-
Gets an array of the legs.
Returns:
The TradeLegs managed by this LegManager.- Type
- Array
-
getNextLegId() → {int}
-
Gets the next free leg id.
Returns:
the next free leg id.- Type
- int
-
getPendingStructureChanges() → {Array}
-
Gets an array of the pending structure changes.
Returns:
The StructureChangedEvents representing all the changes to this LegManager since clearPendingStructureChanges was last called or the class was constructed. Will return an empty array if there have been no events. The array is not a copy.- Type
- Array
-
removeLeg(oLeg, sEventSource) → {module:caplin/trading/trademodel/StructureChangedEvent}
-
Removes a TradeLeg from this LegManager.
Parameters:
Name Type Description oLeg
module:caplin/trading/trademodel/TradeLeg the TradeLeg to remove. May not be null. sEventSource
String the source of this add event. Should be one of TransitionSource
.Throws:
-
-
if the sEventSource is a valid
TransitionSource
-
-
-
if the oLeg is not being managed by this LegManager
-
Returns:
the remove event for this action. -
-
revertStructureChanges() → {Array}
-
Reverts all changes that took place since the last clearPendingStructureChanges call. After this call, there will be no pendingStructureChanges.
Returns:
The StructureChangeEvents for all the events that took place during the reversion.- Type
- Array