Add CoveredPut and ProtectivePut strategies helper factory methods (#7297)

This commit is contained in:
Jhonathan Abreu
2023-06-07 10:01:49 -04:00
committed by GitHub
parent 5d148683b7
commit cb0661c79e
6 changed files with 397 additions and 0 deletions
@@ -58,6 +58,9 @@ class CoveredAndProtectiveCallStrategiesAlgorithm(QCAlgorithm):
raise Exception(f"Expected position group to have 2 positions. Actual: {len(positions)}")
optionPosition = [position for position in positions if position.Symbol.SecurityType == SecurityType.Option][0]
if optionPosition.Symbol.ID.OptionRight != OptionRight.Call:
raise Exception(f"Expected option position to be a call. Actual: {optionPosition.Symbol.ID.OptionRight}")
underlyingPosition = [position for position in positions if position.Symbol.SecurityType == SecurityType.Equity][0]
expectedOptionPositionQuantity = -2
expectedUnderlyingPositionQuantity = 2 * self.Securities[self._option_symbol].SymbolProperties.ContractMultiplier