Overall Statistics |
Total Orders 859 Average Win 0.18% Average Loss -0.21% Compounding Annual Return -0.993% Drawdown 7.900% Expectancy -0.038 Start Equity 100000 End Equity 99007.38 Net Profit -0.993% Sharpe Ratio -0.58 Sortino Ratio -0.689 Probabilistic Sharpe Ratio 9.442% Loss Rate 48% Win Rate 52% Profit-Loss Ratio 0.84 Alpha -0.045 Beta 0.065 Annual Standard Deviation 0.057 Annual Variance 0.003 Information Ratio -1.936 Tracking Error 0.113 Treynor Ratio -0.512 Total Fees $918.97 Estimated Strategy Capacity $2500000.00 Lowest Capacity Asset CONE VDDR8KLRD36T Portfolio Turnover 6.86% |
from AlgorithmImports import * from QuantConnect.DataSource import * class ExtractAlphaTrueBeatsDataAlgorithm(QCAlgorithm): def initialize(self) -> None: self.set_start_date(2019, 1, 1) self.set_end_date(2020, 1, 1) 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], key=lambda x: x.dollar_volume, reverse=True) selected = [x.symbol for x in sorted_by_dollar_volume[:100]] return selected def on_data(self, slice: Slice) -> None: if self.time > self.time: return # Retrieve Data points = slice.Get(ExtractAlphaTrueBeats) if not points: return true_beats = {point.Key: trueBeat for point in points for trueBeat in point.Value} sorted_by_true_beat = sorted(true_beats.items(), key=lambda x: x[1].true_beat) long_symbols = [x[0].underlying for x in sorted_by_true_beat[-10:]] short_symbols = [x[0].underlying for x in sorted_by_true_beat[:10]] for symbol in self.portfolio.Keys: if self.portfolio[symbol].invested \ and symbol not in long_symbols \ and symbol not in 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_DAY(self.time) def on_securities_changed(self, changes: SecurityChanges) -> None: for security in changes.added_securities: # Requesting data extract_alpha_true_beats_symbol = self.add_data(ExtractAlphaTrueBeats, security.symbol).symbol # Historical Data history = self.history(extract_alpha_true_beats_symbol, 10, Resolution.DAILY) self.log(f"We got {len(history)} items from our history request for {security.symbol} ExtractAlpha True Beats data")