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 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio 0 Tracking Error 0 Treynor Ratio 0 Total Fees $0.00 |
namespace QuantConnect.Algorithm.CSharp { /// <summary> /// This example demonstrates how to add options for a given underlying equity security. /// It also shows how you can prefilter contracts easily based on strikes and expirations, and how you /// can inspect the option chain to pick a specific option contract to trade. /// </summary> /// <meta name="tag" content="using data" /> /// <meta name="tag" content="options" /> /// <meta name="tag" content="filter selection" /> public class MyBasicTemplateAlgorithm : QCAlgorithm { private DateTime StartDay = new DateTime(2017, 6, 29); private DateTime EndDay = new DateTime(2017, 7, 29); private const string EquityTicker = "GOOG"; public Security _equity; public readonly Symbol _equitySymbol = QuantConnect.Symbol.Create(EquityTicker, SecurityType.Equity, Market.USA); private NodaTime.DateTimeZone _equityTZ; private TradeBarConsolidator _equityDayConsolidator = new TradeBarConsolidator(TimeSpan.FromDays(1)); private Chart _equityChart; public override void Initialize() { SetStartDate(StartDay); SetEndDate(EndDay); SetCash(100000); //------ Underlying Equity _equity = AddEquity(_equitySymbol.Value, Resolution.Minute); //match options _equity.SetDataNormalizationMode(DataNormalizationMode.Raw); _equityTZ = _equity.Exchange.TimeZone; SubscriptionManager.AddConsolidator(_equity.Symbol, _equityDayConsolidator); // chart underlying equity _equityChart = new Chart(EquityTicker); _equityChart.AddSeries(new Series("Candle", SeriesType.Candle)); AddChart(_equityChart); // Final end of day processing Schedule.On(DateRules.EveryDay(_equitySymbol), TimeRules.BeforeMarketClose(_equitySymbol, 0), onFinalMarketClose); } private void onFinalMarketClose(String name, DateTime utcTime) { var t = utcTime.ConvertFromUtc(_equityTZ); t += TimeSpan.FromSeconds((double)t.DayOfWeek); //work around bug in QC charting var equityBar = _equityDayConsolidator.WorkingData as TradeBar; // Candle _equityChart.Series["Candle"].AddPoint(t + TimeSpan.FromMinutes(1), equityBar.Open); _equityChart.Series["Candle"].AddPoint(t + TimeSpan.FromMinutes(2), equityBar.High); _equityChart.Series["Candle"].AddPoint(t + TimeSpan.FromMinutes(3), equityBar.Low); _equityChart.Series["Candle"].AddPoint(t + TimeSpan.FromMinutes(4), equityBar.Close); } } }