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
using System;
using System.Collections.Generic;
using System.Diagnostics;

namespace QuantConnect
{


    public class BasicTemplateAlgorithm : QCAlgorithm
    {
    	
    	private List<CoarseFundamental> lst = new List<CoarseFundamental>(); // in order to save prices when adding universe

        public override void Initialize()
        {
            SetCash(100000);
            SetStartDate(2017, 9, 6);
            SetEndDate(2017, 9, 7);

            AddUniverse(coarse => {
            	
                List<string> testSymbolSet = new List<string>();
                testSymbolSet.Add("A");
                testSymbolSet.Add("AA");
                
                lst = coarse.Where(c => testSymbolSet.Contains(c.Symbol.Value)).ToList(); // save prices
                Debug(" ----  Adding universe, " + Time + " ----"); // output prices
                foreach (CoarseFundamental x in lst) {
                    Debug(x.Symbol.ToString() 
                        + ", price: " + x.Price.ToString() 
                        + ", volume: " + x.Volume.ToString()
                        + " at " + Time.ToString()
                        );
                }
                
                var selected_coarse = lst.Select(c => c.Symbol).ToList();
                return selected_coarse;
            });
            

            var spy = AddEquity("SPY", Resolution.Minute).Symbol;

            Schedule.On(DateRules.EveryDay("SPY"),
                        TimeRules.AfterMarketOpen("SPY", 5), 
                        showData);

        }

        
        private void showData() {
        	
        	if (lst.Count() == 0)
        	    return; // somewhy, on the first day AddUniverse is called after this function is finished

            Debug(" ----  Scheduled function, " + Time + " ----");

            foreach (var x in Portfolio.Values) {
            	
                if (x.Symbol.ToString() == "SPY")
                   continue;
                
                var hist = History(x.Symbol, 6); // take price at last minute of previous day

                Debug(x.Symbol.ToString() 
                    + ", history price for " + hist.First().EndTime.ToString()  + ": " + hist.First().Price.ToString()
                    + ", AddUniverse price: " + lst.Where(y => y.Symbol.ToString() == x.Symbol.ToString()).First().Price.ToString());
                Debug(x.Symbol.ToString() 
                    + ", history volume for " + hist.First().EndTime.ToString()  + ": " + hist.First().Volume.ToString()
                    + ", AddUniverse volume: " + lst.Where(y => y.Symbol.ToString() == x.Symbol.ToString()).First().Volume.ToString());

            }
            
            
        }




        
    }
}