Overall Statistics
using System;
using System.Collections.Generic;
using QuantConnect;
using QuantConnect.Algorithm;
using QuantConnect.Data;
using QuantConnect.Data.Consolidators;
using QuantConnect.Data.Market;
using QuantConnect.Securities.Future;

public class FuturesAlgorithm : QCAlgorithm
{
    private Future future;
    private TradeBarConsolidator consolidator;

    public override void Initialize()
    {
        SetStartDate(2018, 05, 12);
        SetEndDate(2018, 05, 17);
        SetCash(100000);

        consolidator = new TradeBarConsolidator(TimeSpan.FromMinutes(30));
        consolidator.DataConsolidated += OnDataConsolidated;

        future = AddFuture("GC", Resolution.Minute);
        AddFuture("ES", Resolution.Minute);
        AddFuture("BTC", Resolution.Minute);
        future.SetFilter(TimeSpan.Zero, TimeSpan.FromDays(180));
    }

    private void OnDataConsolidated(object sender, TradeBar e) { }


    public override void OnData(Slice data)
    {
        if (!(Time.Hour==12 && Time.Minute==0)) return;
        foreach (var chain in data.FutureChains)
        {
            foreach (var cc in chain.Value)
            {
                var func = FuturesExpiryFunctions.FuturesExpiryFunction(cc.Symbol.Value);
                Log($"cc.Symbol.Value {cc.Symbol.Value}");
                Log($"cc.Symbol.ID.Date {cc.Symbol.ID.Date}");
                Log($"FuturesExpiryFunction {func(cc.Symbol.ID.Date)}");
                Log($"symbol: {cc.Symbol.Value} exp: {cc.Expiry:d}\n\n");
            }
        }
    }
}