Overall Statistics
namespace QuantConnect.Algorithm.CSharp
{
    public class UncoupledNadionCoil : QCAlgorithm
    {

        public override void Initialize()
        {
            SetStartDate(2019, 1, 20);  //Set Start Date
            SetCash(100000);             //Set Strategy Cash
            
            // AddEquity("SPY", Resolution.Minute);
			AddData<DividendData>("Div_Data", Resolution.Daily);
			

        }

        public void OnData(DividendData data)
        {
            if (data.Symbol == "IBM" || data.Symbol == "ABBV") {
            	Plot("Dividend", data.Symbol, data.Dividend);
            }
        }

    }
    public class DividendData : BaseData
    {
    	public DateTime ExDate;
    	public DateTime RecDate;
    	public DateTime PayDate;
    	public decimal Dividend = 0;
    	public string Frequency = "";
    	public int OnDate = 1;
    	
    	public override SubscriptionDataSource GetSource(
	        SubscriptionDataConfig config,
	        DateTime date,
	        bool isLive)
	    {
	        var source = "https://raw.githubusercontent.com/shilewenuw/FileHost/master/DividendDataFixed.csv";
	
	          return new SubscriptionDataSource(source,
	              SubscriptionTransportMedium.RemoteFile);
	    }
	    
	    
	    public override BaseData Reader(
	        SubscriptionDataConfig config,
	        string line,
	        DateTime date,
	        bool isLive)
	    {
	        if (string.IsNullOrWhiteSpace(line))
	            return null;
	
	        var data = line.Split(',');
	        //var data = line.Split('\t');
	       
	    	var i = 0.0;
	        if (!Double.TryParse(data[1], out i))
	        	return null;
	
	        return new DividendData()
	        {
	            // Make sure we only get this data AFTER trading day - don't want forward bias.
	            Symbol = data[0].Trim(),
	            Time = ParseDate(data[2]),  // we choose the ex-date to be the time
	            Dividend = Convert.ToDecimal(data[1]),
	            RecDate = ParseDate(data[3]),
	            PayDate = ParseDate(data[4]),
	            Frequency = data[5],
	            OnDate = 1,
	        };
	    }
	    
	    public static DateTime ParseDate(string date)
	    {
	    	var data = date.Split('/');
	    	return new DateTime(Convert.ToInt16(data[2]), 
	    		Convert.ToInt16(data[0]),
	    		Convert.ToInt16(data[1]));
	    }
	    
    }
}