Overall Statistics |
Total Trades 18 Average Win 0.01% Average Loss -0.01% Compounding Annual Return -1.167% Drawdown 0.000% Expectancy -0.636 Net Profit -0.045% Sharpe Ratio -10.367 Probabilistic Sharpe Ratio 0.541% Loss Rate 78% Win Rate 22% Profit-Loss Ratio 0.64 Alpha -0.009 Beta -0.007 Annual Standard Deviation 0.001 Annual Variance 0 Information Ratio -5.81 Tracking Error 0.057 Treynor Ratio 1.537 Total Fees $45.00 Estimated Strategy Capacity $1000.00 Lowest Capacity Asset SPY 31O8Q8CJ4BUQU|SPY R735QTJ8XC9X |
using System; using QuantConnect.Data; using QuantConnect.Securities; using QuantConnect.Securities.Option; using QuantConnect.Securities.Option.StrategyMatcher; namespace QuantConnect { public class ConstantFeeTest: QCAlgorithm { const int INITIAL_CAPITAL = 100000; private List<Symbol> symbols; private Symbol spySymbol; private List<OptionContract> put_Contracts; public override void Initialize() { SetStartDate(2021, 6, 1); SetEndDate(2021, 6, 11); SetCash(INITIAL_CAPITAL); SetWarmUp(TimeSpan.FromDays(30), Resolution.Minute); put_Contracts = null; symbols = new List<Symbol>(); Option option = (Option) null; option = AddOption("SPY", Resolution.Minute); option.SetFilter(universe => from symbol in universe .WeeklysOnly() .Strikes(-20, 10) .Expiration(TimeSpan.Zero, TimeSpan.FromDays(21)) where symbol.ID.OptionRight == OptionRight.Put select symbol); spySymbol = option.Symbol; //Tried both of these. Securities[spySymbol].FeeModel = new ConstantFeeModel(.06M); //option.FeeModel = new ConstantFeeModel(.06M); option.PriceModel = OptionPriceModels.BjerksundStensland(); var optionMuliplier = option.ContractMultiplier; Schedule.On( DateRules.EveryDay(), TimeRules.At(9,35), () => ExecuteTrade() ); Schedule.On( DateRules.EveryDay(), TimeRules.At(10,00), () => Liquidate() ); } public void ExecuteTrade() { Symbol s = put_Contracts.First().Symbol; //Buy and sell 10 contracts each day. Order(s,10); } public override void OnData(Slice slice) { OptionChain chain; List<OptionContract> putContracts = new List<OptionContract>(); if ( slice.OptionChains.TryGetValue(spySymbol, out chain) ) { if (chain.Count() == 0) return; put_Contracts = chain .Where(c => c.Right == OptionRight.Put ) .ToList(); if (put_Contracts.Count() == 0) return; } else { return; } } } }