i want build OptionStrategyDefinition by myself with python code implment

here is C# example code

        /// <summary>
        /// Strangle strategy consists of buying a call option and a put option with the same expiration date.
        /// The strike price of the call is above the strike of the put.
        /// </summary>
        public static OptionStrategyDefinition Strangle { get; }
            = OptionStrategyDefinition.Create("Strangle",
                OptionStrategyDefinition.CallLeg(+1),
                OptionStrategyDefinition.PutLeg(+1, (legs, p) => p.Strike <= legs[0].Strike,
                                                    (legs, p) => p.Expiration == legs[0].Expiration)
            );

then python code will throw No method matches given arguments

from QuantConnect.Securities.Option.StrategyMatcher import *
OptionStrategyDefinition.CallLeg(1)
OptionStrategyDefinition.PutLeg(1, lambda legs, p: p.Expiration == legs[0].Expiration and p.Strike <= legs[0].Strike)

 

 

 

 

Author