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 
{   
    /*
    *   Basic Template Algorithm
    *
    *   The underlying QCAlgorithm class has many methods which enable you to use QuantConnect.
    *   We have explained some of these here, but the full base class can be found at:
    *   https://github.com/QuantConnect/Lean/tree/master/Algorithm
    */
    public class FururesTickConsoludatorQuestion : QCAlgorithm
    {
        Slice lastSlice = null;
        OrderTicket lastOrder = null;
        private Tick lastTick = null;

        public override void Initialize()
        {
            SetStartDate(2015, 1, 1);
            SetEndDate(2015, 2, 25);
            SetCash(250000);

            //Add Future Contract
            var futureBond30Yr = AddFuture(Futures.Financials.Y30TreasuryBond, Resolution.Tick);
            futureBond30Yr.SetFilter(TimeSpan.Zero, TimeSpan.FromDays(182));


            //var oneMinute = new TickConsolidator(TimeSpan.FromMinutes(1));

            ////bind event handler to data consolidated event.
            //oneMinute.DataConsolidated += OnMinuteBar;

            ////register the consolidator for data.
            //SubscriptionManager.AddConsolidator(Futures.Financials.Y30TreasuryBond, oneMinute);
            //SubscriptionManager.AddConsolidator(futureBond30Yr.Symbol, oneMinute);

        }

        public void OnMinuteBar(object sender, TradeBar bar)
        {
            Debug(Time.ToString("u") + " " + bar);
        }

        public void OnData(Ticks data)
        {

            if (data.Count > 0)
            {
                if (data[data.Keys.First()].Count > 0)
                  lastTick = data[data.Keys.First()].Last();
            }

            if (lastTick != null)
            {
                Debug(String.Format("{0} Tick {1:C2}", Time, lastTick.Price));
            }
            
        }

        public void OnData(Slice data)
        {
            if (data == null)
            {
                return;
            }
            if (data.Bars == null)
            {
                return;
            }
            lastSlice = data;
        }


        
    }
}