Overall Statistics
Total Trades
6
Average Win
4.91%
Average Loss
-2.33%
Compounding Annual Return
13.080%
Drawdown
10.300%
Expectancy
0.553
Net Profit
13.080%
Sharpe Ratio
0.769
Loss Rate
50%
Win Rate
50%
Profit-Loss Ratio
2.11
Alpha
0.037
Beta
0.905
Annual Standard Deviation
0.144
Annual Variance
0.021
Information Ratio
0.296
Tracking Error
0.097
Treynor Ratio
0.123
Total Fees
$8.62
#
#   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)