| Overall Statistics |
|
Total Trades 3 Average Win 0% Average Loss 0% Compounding Annual Return 77.696% Drawdown 0.200% Expectancy 0 Net Profit 0.632% Sharpe Ratio 5.082 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 28.923 Annual Standard Deviation 0.063 Annual Variance 0.004 Information Ratio 4.912 Tracking Error 0.063 Treynor Ratio 0.011 Total Fees $3.00 |
import numpy as np
from clr import AddReference
AddReference("System.Core")
AddReference("System.Collections")
AddReference("QuantConnect.Common")
AddReference("QuantConnect.Algorithm")
from System import *
from System.Collections.Generic import List
from QuantConnect import *
from QuantConnect.Algorithm import QCAlgorithm
from QuantConnect.Data.UniverseSelection import *
### <summary>
### Basic template algorithm simply initializes the date range and cash. This is a skeleton
### framework you can use for designing an algorithm.
### </summary>
class LongShortEquityExposure(QCAlgorithm):
'''Basic template algorithm simply initializes the date range and cash'''
def Initialize(self):
'''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''
self.SetStartDate(2013,10, 7) #Set Start Date
self.SetEndDate(2013,10,10) #Set End Date
self.SetCash(100000) #Set Strategy Cash
self.UniverseSettings.Resolution = Resolution.Daily
self.AddUniverse(self.VolumeFilter)
def VolumeFilter(self, coarse):
sortedByDollarVolume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True)
self.Debug("{0}: Submitted: {1}".format(self.UtcTime, "volumefiltercreated"))
return [ x.Symbol for x in sortedByDollarVolume[:1]]
def OnData(self, data):
self.Debug("{0}: Submitted: {1}".format(self.UtcTime, "Ondatacalled"))
for kvp in self.ActiveSecurities:
symbol = kvp.Key
security = kvp.Value
self.MarketOrder(symbol, 100)
return
def OnSecuritiesChanged(self, changes):
self.Debug("{0}: Submitted: {1}".format(self.UtcTime, "Onsecuritiescalled"))
return
def OnOrderEvent(self, OrderEvent):
self.Debug("ordereventcalled")
self.Debug(OrderEvent.UtcTime)
return