Total noob here. I'm trying to get VIX close for the past 3 days and VIX current high and low but I'm getting 0's instead of the actual numbers. What am I doing wrong?
public override void Initialize()
{
SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage,
AccountType.Cash);//Brokerage model and account type
SetStartDate(2012, 10, 07); //Set Start Date
SetEndDate(2012, 10, 15); //Set End Date
SetCash(10000); //Set Strategy Cash
SetWarmUp(TimeSpan.FromDays(7)); //Warm up 7 days of data.
SetBenchmark("SPY"); // Defaults to Equity market
AddSecurity(SecurityType.Option, "VIX", Resolution.Minute);
// Schedule an event to fire at a specific date/time
Schedule.On(DateRules.EveryDay("TQQQ"), TimeRules.BeforeMarketClose("TQQQ", 10), () =>
{
Log("SpecificTime: Fired at : " + Time);
IEnumerable<TradeBar> bars = History("VIX", TimeSpan.FromDays(3));
Decimal total = 0;
foreach(TradeBar bar in bars){
Log("bar close: " + bar.Close);
total += bar.Close;
}
total /= 3;
var dailyVixHigh = Identity("VIX", Resolution.Daily, Field.High);
var dailyVixLow = Identity("VIX", Resolution.Daily, Field.Low);
Log("vix high: " + dailyVixHigh);
Log("vix low: " + dailyVixLow);
});
}