Overall Statistics |
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio 0 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio -5.95 Tracking Error 0.134 Treynor Ratio 0 Total Fees $0.00 |
namespace QuantConnect.Algorithm.CSharp { /// <summary> /// Test dynamic adjustment to the option universe to try to improve options algo backtest performance /// Test the following sequence: /// 1. Add option universe using underlying symbol /// 2. Set universe filter to required strike range and expiration /// 3. Select option from the Slice OptionChain (eg. by Expiration, Delta) /// 4. Reduce the option universe using SetFilter to the minimum subscribed set /// 5. Add the selected option to the subscription /// 6. For next trade: /// 7. Close the current option position and unsubscribe the selected option /// 8. Repeat process from step 2 /// /// This sequence shows an issue that the minimised option universe filter is only applied after the /// monthly options expiration has occurred, instead of being applied immediately from the next Slice. /// /// </summary> public class OptionUniverseTestAlgorithm : QCAlgorithm { Symbol spy; public override void Initialize() { SetStartDate(2020, 6, 15); spy = AddEquity("SPY", Resolution.Daily).Symbol; var fiveDayConsolidator = new TradeBarConsolidator(5); fiveDayConsolidator.DataConsolidated += FiveBarHandler; SubscriptionManager.AddConsolidator("SPY", fiveDayConsolidator); } private void FiveBarHandler(object sender, TradeBar bar) { Debug((bar.EndTime - bar.Time).ToString() + " " + bar.ToString()); } } }