Overall Statistics |
Total Trades 8138 Average Win 0.01% Average Loss 0.00% Compounding Annual Return 19.358% Drawdown 14.800% Expectancy 1.878 Net Profit 38.354% Sharpe Ratio 1.177 Loss Rate 21% Win Rate 79% Profit-Loss Ratio 2.66 Alpha 0.164 Beta 1.253 Annual Standard Deviation 0.161 Annual Variance 0.026 Information Ratio 1.054 Tracking Error 0.161 Treynor Ratio 0.151 Total Fees $8188.77 |
from datetime import timedelta, datetime class hourlyRebalanceExample(QCAlgorithmFramework): def Initialize(self): self.SetStartDate(2017,1,1) # Set Start Date self.SetEndDate(2018,11,1) # Set End Date self.SetCash(1000000) # Set Strategy Cash # Define tickers tickers = ["IBM","AAPL","MSFT"] # Add securities to the universe symbols = [Symbol.Create(ticker, SecurityType.Equity, Market.USA) for ticker in tickers] # Set universe data resolution self.UniverseSettings.Resolution = Resolution.Hour # Use Manual Universe Selection Model self.SetUniverseSelection(ManualUniverseSelectionModel(symbols)) # Use Constant Alpha Model for insights self.SetAlpha(ConstantAlphaModel(InsightType.Price, InsightDirection.Up, timedelta(hours = 1), 0.001, None)) # Use EqualWeightingPortfolioConstructionModel to rebalance the portfolio self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel())