Overall Statistics |
Total Orders 87 Average Win 2.12% Average Loss -2.69% Compounding Annual Return -22.361% Drawdown 40.000% Expectancy -0.149 Start Equity 100000 End Equity 88146.14 Net Profit -11.854% Sharpe Ratio 0.03 Sortino Ratio 0.035 Probabilistic Sharpe Ratio 20.635% Loss Rate 52% Win Rate 48% Profit-Loss Ratio 0.79 Alpha -0.216 Beta 1.011 Annual Standard Deviation 0.646 Annual Variance 0.417 Information Ratio -0.336 Tracking Error 0.636 Treynor Ratio 0.019 Total Fees $153.54 Estimated Strategy Capacity $85000000.00 Lowest Capacity Asset TSLA UNU3P8Y3WFAD Portfolio Turnover 15.96% |
from AlgorithmImports import * from QuantConnect.DataSource import * class USEquityCoarseUniverseConstituentsDataAlgorithm(QCAlgorithm): _number_of_symbols = 3 _changes = None def initialize(self) -> None: self.set_start_date(2021, 1, 1) self.set_end_date(2021, 7, 1) self.set_cash(100000) # Set Asynchronous to True to improve speed performance self.universe_settings.asynchronous = True # Requesting data self.add_universe(self.fundamental_selection_function) def fundamental_selection_function(self, fundamental: List[Fundamental]) -> List[Symbol]: sortedByDollarVolume = sorted(fundamental, key=lambda x: x.dollar_volume, reverse=True) return [ x.symbol for x in sortedByDollarVolume[:self._number_of_symbols] ] def on_data(self, slice: Slice) -> None: # if we have no changes, do nothing if self._changes is None: return # liquidate removed securities for security in self._changes.removed_securities: if security.invested: self.liquidate(security.symbol) # we want 1/N allocation in each security in our universe for security in self._changes.added_securities: self.set_holdings(security.symbol, 1 / self._number_of_symbols) self._changes = None def on_securities_changed(self, changes: SecurityChanges) -> None: self._changes = changes for security in changes.added_securities: # Historical data history = self.history(security.symbol, 7, Resolution.DAILY) self.debug(f"We got {len(history)} from our history request for {security.symbol}")