Overall Statistics |
Total Orders 3 Average Win 49.10% Average Loss 0% Compounding Annual Return 0% Drawdown 100.500% Expectancy -1 Start Equity 10000 End Equity -76 Net Profit -100.760% Sharpe Ratio -0.109 Sortino Ratio 0 Probabilistic Sharpe Ratio 0% Loss Rate 100% Win Rate 0% Profit-Loss Ratio 0 Alpha 43.565 Beta 57.628 Annual Standard Deviation 9.237 Annual Variance 85.33 Information Ratio -0.025 Tracking Error 9.077 Treynor Ratio -0.017 Total Fees $0.00 Estimated Strategy Capacity $190000.00 Lowest Capacity Asset SPXW 31UKA22P964XA|SPX 31 Portfolio Turnover 25.26% |
#region imports using System; using System.Collections.Generic; using System.Linq; using QuantConnect.Util; using QuantConnect.Data; using QuantConnect.Orders; using QuantConnect.Orders.Fees; using QuantConnect.Orders.Fills; using QuantConnect.Securities; using QuantConnect.Securities.Option; #endregion namespace QuantConnect.Algorithm.CSharp { class MySecurityInitializer : BrokerageModelSecurityInitializer { public MySecurityInitializer(Brokerages.IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder) : base(brokerageModel, securitySeeder) { } public override void Initialize(Security security) { base.Initialize(security); if (security.Type is SecurityType.IndexOption) { // Uncomment next line to fix //(security as Option).SetOptionAssignmentModel(new NullOptionAssignmentModel()); } } } public class LogicalBlueLemur : QCAlgorithm { private Symbol _spxw; private bool _done; public override void Initialize() { SetSecurityInitializer(new MySecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices))); SetStartDate(2022, 1, 21); SetEndDate(2022, 1, 26); SetCash(10000); var index = AddIndex("SPX", Resolution.Minute).Symbol; var option = AddIndexOption(index, "SPXW", Resolution.Minute); option.SetFilter((x) => x.IncludeWeeklys().Strikes(-5, 5).Expiration(1, 4)); _spxw = option.Symbol; } public override void OnData(Slice slice) { if (_done) return; if (!slice.OptionChains.TryGetValue(_spxw, out var chain)) return; var spread = OptionStrategies.BullPutSpread(_spxw, 4490, 4485, new DateTime(2022, 1, 24)); Buy(spread, 1); _done = true; } } }