Overall Statistics
Total Trades
4
Average Win
0.01%
Average Loss
-4.16%
Compounding Annual Return
-3.679%
Drawdown
15.000%
Expectancy
-0.499
Net Profit
-1.519%
Sharpe Ratio
-0.048
Loss Rate
50%
Win Rate
50%
Profit-Loss Ratio
0.00
Alpha
-0.171
Beta
1.411
Annual Standard Deviation
0.204
Annual Variance
0.042
Information Ratio
-0.904
Tracking Error
0.137
Treynor Ratio
-0.007
Total Fees
$43.03
#
#   QuantConnect Basic Template:
#	Fundamentals to using a QuantConnect algorithm.
#
#	You can view the QCAlgorithm base class on Github: 
#	https://github.com/QuantConnect/Lean/tree/master/Algorithm
#

import numpy as np

class BasicTemplateAlgorithm(QCAlgorithm):

	def Initialize(self):
		# Set the cash we'd like to use for our backtest
		# This is ignored in live trading 
		self.SetCash(100000)
		
		# Start and end dates for the backtest.
		# These are ignored in live trading.
		self.SetStartDate(2016,5,5)
		self.SetEndDate(2016,10,2)
		
		# Add assets you'd like to see
		self.gs = self.AddEquity("GS", Resolution.Daily).Symbol
		self.ms = self.AddEquity("MS", Resolution.Daily).Symbol
		self.goog = self.AddEquity("GOOG",Resolution.Daily).Symbol
		
		self.count = 0
		

	def OnData(self, slice):
		# Simple buy and hold template
		if self.count == 1:
			self.SetHoldings(self.gs, 1)
			self.SetHoldings(self.ms, -1)
		elif self.count == 10:
			# self.SetHoldings(self.ms,0)
			self.Liquidate(self.ms)
			self.SetHoldings(self.gs, 1)
			self.SetHoldings(self.goog, -1)
		self.count += 1