Constructor
new module:ct-trading /trademodel /Leg Manager()
Constructs an instance of LegManager
.
Methods
add Leg(oLeg, sEvent Source) → {module:ct-trading /trademodel /Structure Changed Event}
Adds a TradeLeg to this LegManager.
Parameters:
Name | Type | Description |
---|---|---|
oLeg |
module:ct-trading |
the TradeLeg to add. May not be null. |
sEventSource |
String | the source of this add event. Should be one of |
Throws:
-
-
if the sEventSource is not a valid
TransitionSource
- Type
-
module:ct-core
/Error
-
-
-
if the oLeg is not being managed by this LegManager.
- Type
-
module:ct-core
/Error
-
Returns:
the add event for this action.
clear Pending Structure Changes()
Clears the pending structure changes.
get Leg ById(the) → {module:ct-trading /trademodel /Trade Leg}
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.
get Leg ByIndex(leg Index) → {module:ct-trading /trademodel /Trade Leg}
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.
get Leg Count() → {int}
Gets the number of legs
Returns:
the number of legs this LegManager is holding.
- Type
- int
get Legs() → {Array}
Gets an array of the legs.
Returns:
The TradeLegs managed by this LegManager.
- Type
- Array
get Next Leg Id() → {int}
Gets the next free leg id.
Returns:
the next free leg id.
- Type
- int
get Pending Structure Changes() → {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
remove Leg(oLeg, sEvent Source) → {module:ct-trading /trademodel /Structure Changed Event}
Removes a TradeLeg from this LegManager.
Parameters:
Name | Type | Description |
---|---|---|
oLeg |
module:ct-trading |
the TradeLeg to remove. May not be null. |
sEventSource |
String | the source of this add event. Should be one of |
Throws:
-
-
if the sEventSource is a valid
TransitionSource
- Type
-
module:ct-core
/Error
-
-
-
if the oLeg is not being managed by this LegManager
- Type
-
module:ct-core
/Error
-
Returns:
the remove event for this action.
revert Structure Changes() → {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