Overall Statistics Total Trades 996 Average Win 0% Average Loss 0.00% Compounding Annual Return -5.588% Drawdown 1.000% Expectancy -1 Net Profit -1.050% Sharpe Ratio -31.951 Loss Rate 100% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.061 Beta 0.347 Annual Standard Deviation 0.002 Annual Variance 0 Information Ratio -41.905 Tracking Error 0.002 Treynor Ratio -0.157 Total Fees \$1049.88
```import numpy as np
import datetime

class BasicTemplateAlgorithm(QCAlgorithm):

def Initialize(self):

self.SetStartDate(2013,1,1)  #Set Start Date
self.SetEndDate(2013,3,10)    #Set End Date
self.SetCash(100000)           #Set Strategy Cash

self.UniverseSettings.Resolution = Resolution.Daily

self.__numberOfSymbols = 30
self.w = 1.0/self.__numberOfSymbols

self.entry_minute = 30
self.exit_minute = 15
self.bigStocks = None

self.Schedule.On(self.DateRules.EveryDay("SPY"),
self.TimeRules.AfterMarketOpen("SPY",self.entry_minute),
Action(self.EnterPosition))

self.Schedule.On(self.DateRules.EveryDay("SPY"),
self.TimeRules.BeforeMarketClose("SPY",self.exit_minute),
Action(self.ExitPosition))

def CoarseSelectionFunction(self, coarse):
selected = [x for x in coarse if (x.HasFundamentalData) and (float(x.Price) > 2)]
sortedByDollarVolume = sorted(selected, key=lambda x: x.DollarVolume, reverse=True)
self.bigStocks = [ x.Symbol for x in sortedByDollarVolume[:self.__numberOfSymbols] ]
return self.bigStocks

def EnterPosition(self):
self.entry_price = {}
for stock in self.bigStocks:
history = self.History(stock, self.entry_minute, Resolution.Minute)
if 'close' in history.columns:
delta = (history['close'][-1] - history['close'][0])/history['close'][-1]
self.direction = np.sign(delta)
if self.direction > 0:
self.SetHoldings(stock, self.direction * self.w)
self.entry_price[stock] = history['close'][-1]

def ExitPosition(self):
self.Debug("end of day.\n")
for stock in self.entry_price:
self.Liquidate(stock)

def OnData(self, data):
pass                        ```