Overall Statistics |
Total Trades 2073 Average Win 0.01% Average Loss -0.02% Compounding Annual Return 32.023% Drawdown 13.100% Expectancy -0.196 Net Profit 14.807% Sharpe Ratio 1.458 Probabilistic Sharpe Ratio 57.018% Loss Rate 49% Win Rate 51% Profit-Loss Ratio 0.57 Alpha -0.143 Beta 1.464 Annual Standard Deviation 0.24 Annual Variance 0.057 Information Ratio 0.089 Tracking Error 0.148 Treynor Ratio 0.239 Total Fees $2073.00 Estimated Strategy Capacity $2600000.00 Lowest Capacity Asset IBM R735QTJ8XC9X |
class FocusedTanChicken(QCAlgorithm): def Initialize(self): self.SetStartDate(2021, 1, 26) self.SetCash(100000) tickers = ["AAPL","MSFT","IBM","TSLA","GOOG","IBM"] symbols = [ Symbol.Create(ticker, SecurityType.Equity, Market.USA) for ticker in tickers ] self.AddUniverseSelection( ManualUniverseSelectionModel(symbols) ) self.AddAlpha(ConstantAlphaModel(InsightType.Price, InsightDirection.Up, timedelta(minutes = 20), 0.025, None)) self.SetPortfolioConstruction( EqualWeightingPortfolioConstructionModel() ) self.SetExecution( ModifiedImmediateExecutionModel() ) def OnData(self, data): pass class ModifiedImmediateExecutionModel(ExecutionModel): '''Provides an implementation of IExecutionModel that immediately submits market orders to achieve the desired portfolio targets''' def __init__(self): '''Initializes a new instance of the ImmediateExecutionModel class''' self.targetsCollection = PortfolioTargetCollection() def Execute(self, algorithm, targets): '''Immediately submits orders for the specified portfolio targets. Args: algorithm: The algorithm instance targets: The portfolio targets to be ordered''' # for performance we check count value, OrderByMarginImpact and ClearFulfilled are expensive to call self.targetsCollection.AddRange(targets) if self.targetsCollection.Count > 0: for target in self.targetsCollection.OrderByMarginImpact(algorithm): # calculate remaining quantity to be ordered quantity = OrderSizing.GetUnorderedQuantity(algorithm, target) if quantity != 0: close = algorithm.Securities[target.Symbol].Close algorithm.StopMarketOrder(target.Symbol, quantity, close * 0.99) self.targetsCollection.ClearFulfilled(algorithm)