Overall Statistics |
Total Orders 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Start Equity 100000 End Equity 100000 Net Profit 0% Sharpe Ratio 0 Sortino Ratio 0 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio -2.502 Tracking Error 0.095 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset Portfolio Turnover 0% |
# region imports from AlgorithmImports import * # endregion class LiquidUniverseSelection(QCAlgorithm): filtered_by_price = None def initialize(self): self.set_start_date(2019, 1, 11) self.set_end_date(2019, 7, 1) self.set_cash(100000) self.add_universe(self.coarse_selection_filter) # Ignore this for now, we'll cover it in the next task. self.universe_settings.resolution = Resolution.DAILY self.SetWarmup(timedelta(days=30)) # Warm up with 30 days of data def coarse_selection_filter(self, coarse): sorted_by_dollar_volume = sorted(coarse, key=lambda x: x.dollar_volume, reverse=True) filtered_by_price = [x.symbol for x in sorted_by_dollar_volume if x.has_fundamental_data and x.price > 10] return filtered_by_price[:8] def on_securities_changed(self, changes): self.changes = changes self.log(f"on_securities_changed({self.time}):: {changes}") #1. Liquidate removed securities for security in changes.removed_securities: if security.invested: self.liquidate(security.symbol) #2. We want 10% allocation in each security in our universe # for security in self.changes.added_securities: # self.set_holdings(security.symbol, 0.1) def OnData(self, data): for symbol in set(data.Keys).intersection(self.changes.added_securities): self.set_holdings(security.symbol, 0.1)