Overall Statistics
using System;
using System.Net;

namespace QuantConnect 
    *   QuantConnect University: Full Basic Template:
    *   The underlying QCAlgorithm class is full of helper methods which enable you to use QuantConnect.
    *   We have explained some of these here, but the full algorithm can be found at:
    *   https://github.com/QuantConnect/QCAlgorithm/blob/master/QuantConnect.Algorithm/QCAlgorithm.cs
    public class BasicTemplateAlgorithm : QCAlgorithm
        //Initialize the data and resolution you require for your strategy:
        public override void Initialize() 
            //Start and End Date range for the backtest:
            SetStartDate(2015, 1, 1);         
            SetEndDate(2015, 1, 2);
            //Cash allocation
            //Add as many securities as you like. All the data will be passed into the event handler:
            AddSecurity(SecurityType.Equity, "SPY", Resolution.Minute);

        //Data Event Handler: New data arrives here. "TradeBars" type is a dictionary of strings so you can access it by symbol.
        public void OnData(TradeBars data) 
			//Asking for the current price example. I believe data has a 15m delay. 
			decimal price;
			// Ask for current VIX price !
            price = GetPrice("^VIX");
        //Takes a string ticker as input and returns its current value as decimal
            public static decimal GetPrice(string ticker)
            // Build the URL.
            string url = ticker;
            decimal pricetemp;
            if (url != "")

                // Prepend the base URL.
                const string base_url =
                url = base_url.Replace("@", url);

                // Get the response.
                    // Get the web response.
                    WebClient client = new WebClient();
                    string result = client.DownloadString(url);

                    // Pull out the current prices.
                    string[] lines = result.Split(
                        new char[] { '\r', '\n' },
                    pricetemp = decimal.Parse(lines[0].Split(',')[1]);
                    return pricetemp;
                catch (Exception ex)
                    return 0;
            return 0;