Overall Statistics
Total Trades
6
Average Win
4.91%
Average Loss
-2.88%
Compounding Annual Return
12.194%
Drawdown
10.300%
Expectancy
0.354
Net Profit
12.194%
Sharpe Ratio
0.767
Loss Rate
50%
Win Rate
50%
Profit-Loss Ratio
1.71
Alpha
0.039
Beta
0.782
Annual Standard Deviation
0.135
Annual Variance
0.018
Information Ratio
0.208
Tracking Error
0.101
Treynor Ratio
0.132
Total Fees
$8.56
#
#   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):
		self.SetCash(100000)
		
		self.SetStartDate(2016,1,1)
		self.SetEndDate(2017,1,1)
		
		self.AddSecurity(SecurityType.Equity, "IBM", Resolution.Daily)
		self.AddSecurity(SecurityType.Equity, "GOOG", Resolution.Daily)
		self._count = 0


	def OnData(self, slice):
		if not self.Portfolio.Invested:
			self.SetHoldings(self.Securities["IBM"].Symbol, 0.5)
			self.SetHoldings(self.Securities["GOOG"].Symbol, 0.5)
		self._count += 1
		self.Log(str(self._count))
		if self._count == 100:
			self.SetHoldings(self.Securities["IBM"].Symbol, 0)
		if self._count == 130:
			self.SetHoldings(self.Securities["GOOG"].Symbol, 0)