Overall Statistics
Total Trades
1
Average Win
87.26%
Average Loss
0%
Compounding Annual Return
4.29%
Drawdown
55.100%
Expectancy
0
Net Profit
87.255%
Sharpe Ratio
0.308
Loss Rate
0%
Win Rate
100%
Profit-Loss Ratio
0
Alpha
0.067
Beta
-0.07
Annual Standard Deviation
0.205
Annual Variance
0.042
Information Ratio
0
Tracking Error
0.3
Treynor Ratio
-0.897
using System;
using System.Collections;
using System.Collections.Generic; 
using QuantConnect.Securities;  
using QuantConnect.Models;   

namespace QuantConnect 
{   
    // Name your algorithm class anything, as long as it inherits QCAlgorithm
    public class CustomDataYahooQuandl : QCAlgorithm
    {   
        //Initialize the data and resolution you require for your strategy:
        public override void Initialize()
        {
            SetStartDate(2000, 1, 1);
            SetEndDate(2014, 12, 3);
            SetCash(25000);
            
            AddSecurity(SecurityType.Equity, "SPY", Resolution.Minute);
            AddData<Yahoo>("SPY_DAILY", Resolution.Minute);
        }

        public void OnData(TradeBars data) 
        {  
            //QuantConnect SPY Minute Events here:
        }
        
        public void OnData(Yahoo data)
        {
            //Yahoo/Quandl SPY_Daily Events here:
            if (!Portfolio.Invested) 
            {
                var quantity = (int) (Portfolio.Cash / data.Value); 
                Order("SPY_DAILY", quantity);
            }
        }
    }
}                        
using System;
using System.Collections;
using System.Collections.Generic;
using QuantConnect.Securities;
using QuantConnect.Models;
using System.Globalization;

namespace QuantConnect {

    public class Yahoo : BaseData
    {
        public decimal Open = 0;
        public decimal High = 0;
        public decimal Low = 0;
        public decimal Close = 0;
        public decimal AdjustedClose = 0;
        public decimal Volume = 0;

        public Yahoo()
        {
            this.Symbol = "SPY_DAILY";
        }
        
        public override string GetSource(SubscriptionDataConfig config, DateTime date, DataFeedEndpoint datafeed)
        {
            var startDate = new DateTime(2000, 1, 1).ToString("yyyy-MM-dd");
            var endDate = DateTime.Now.ToString("yyyy-MM-dd");
            
            //QUANDL WRAPPER ON YAHOO FINANCE API TO SORT DATA:
            //https://www.quandl.com/api/v1/datasets/YAHOO/INDEX_SPY.csv?trim_start=2000-01-01&trim_end=2014-12-03&sort_order=asc
            
            return "https://www.quandl.com/api/v1/datasets/YAHOO/INDEX_SPY.csv?trim_start=" + startDate + "&trim_end=" + endDate + "&sort_order=asc&exclude_headers=true";;
        }
        
        public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, DataFeedEndpoint datafeed)
        {
            Yahoo yBar = new Yahoo();

            try
            {
                string[] data = line.Split(',');
                //Required.
                yBar.Symbol = this.Symbol;
                yBar.Time = DateTime.ParseExact(data[0], "yyyy-MM-dd", CultureInfo.InvariantCulture);
                
                //User configured / optional data on each bar:
                yBar.Open = Convert.ToDecimal(data[1]);
                yBar.High = Convert.ToDecimal(data[2]);
                yBar.Low = Convert.ToDecimal(data[3]);
                yBar.Close = Convert.ToDecimal(data[4]);
                yBar.Volume = Convert.ToDecimal(data[5]);
                yBar.AdjustedClose = Convert.ToDecimal(data[6]);
                
                //This is the value the engine uses for portfolio calculations
                yBar.Value = yBar.AdjustedClose;
            }
            catch {
                
            }

            return yBar;
        }
    }
}