Overall Statistics |
Total Orders 42 Average Win 0.53% Average Loss -0.20% Compounding Annual Return -1.238% Drawdown 4.400% Expectancy -0.611 Start Equity 100000 End Equity 97536.62 Net Profit -2.463% Sharpe Ratio -1.882 Sortino Ratio -1.346 Probabilistic Sharpe Ratio 0.189% Loss Rate 89% Win Rate 11% Profit-Loss Ratio 2.63 Alpha -0.023 Beta -0.017 Annual Standard Deviation 0.014 Annual Variance 0 Information Ratio -0.929 Tracking Error 0.214 Treynor Ratio 1.47 Total Fees $43.92 Estimated Strategy Capacity $180000000.00 Lowest Capacity Asset ZM X3RPXTZRW09X Portfolio Turnover 0.39% |
from AlgorithmImports import * from QuantConnect.DataSource import * class ExtractAlphaEstimizeAlgorithm(QCAlgorithm): def initialize(self) -> None: self.set_start_date(2019, 1, 1) self.set_end_date(2020, 12, 31) self.set_cash(100000) self.last_time = datetime.min self.add_universe(self.my_coarse_filter_function) self.universe_settings.resolution = Resolution.MINUTE def my_coarse_filter_function(self, coarse: List[CoarseFundamental]) -> List[Symbol]: sorted_by_dollar_volume = sorted([x for x in coarse if x.has_fundamental_data and x.price > 4], key=lambda x: x.dollar_volume, reverse=True) selected = [x.symbol for x in sorted_by_dollar_volume[:500]] return selected def on_data(self, slice: Slice) -> None: if self.last_time > self.time: return # Accessing Data consensus = slice.Get(EstimizeConsensus) estimate = slice.Get(EstimizeEstimate) release = slice.Get(EstimizeRelease) if not estimate: return sorted_by_eps_estimate = sorted([x for x in estimate.items() if x[1].eps], key=lambda x: x[1].eps) long_symbols = [x[0].underlying for x in sorted_by_eps_estimate[-10:]] short_symbols = [x[0].underlying for x in sorted_by_eps_estimate[:10]] for symbol in [x.symbol for x in self.portfolio.Values if x.invested]: if symbol not in long_symbols + short_symbols: self.liquidate(symbol) long_targets = [PortfolioTarget(symbol, 0.05) for symbol in long_symbols] short_targets = [PortfolioTarget(symbol, -0.05) for symbol in short_symbols] self.set_holdings(long_targets + short_targets) self.last_time = Expiry.END_OF_MONTH(self.time) def on_securities_changed(self, changes: SecurityChanges) -> None: for security in changes.added_securities: # Requesting Data estimize_consensus_symbol = self.add_data(EstimizeConsensus, security.symbol).symbol estimize_estimate_symbol = self.add_data(EstimizeEstimate, security.symbol).symbol estimize_release_symbol = self.add_data(EstimizeRelease, security.symbol).symbol # Historical Data history = self.history([estimize_consensus_symbol, estimize_estimate_symbol, estimize_release_symbol ], 10, Resolution.DAILY) self.debug(f"We got {len(history)} items from our history request")