Overall Statistics |
Total Orders 13 Average Win 1.60% Average Loss -0.63% Compounding Annual Return 22.210% Drawdown 2.400% Expectancy 1.030 Start Equity 100000 End Equity 103797.78 Net Profit 3.798% Sharpe Ratio 1.34 Sortino Ratio 1.507 Probabilistic Sharpe Ratio 68.309% Loss Rate 43% Win Rate 57% Profit-Loss Ratio 2.55 Alpha -0.151 Beta 0.819 Annual Standard Deviation 0.074 Annual Variance 0.005 Information Ratio -4.827 Tracking Error 0.043 Treynor Ratio 0.12 Total Fees $12.82 Estimated Strategy Capacity $310000000.00 Lowest Capacity Asset SPY R735QTJ8XC9X Portfolio Turnover 13.30% |
from AlgorithmImports import * from QuantConnect.DataSource import * class RegalyticsDataAlgorithm(QCAlgorithm): negative_sentiment_phrases = ["emergency rule", "proposed rule change", "development of rulemaking"] def initialize(self) -> None: self.set_start_date(2024, 4, 25) self.set_cash(100000) self.spy = self.add_equity("SPY", Resolution.DAILY).symbol # Requesting data self.regalytics_symbol = self.add_data(RegalyticsRegulatoryArticles, "REG").symbol # Historical data history = self.history(self.regalytics_symbol, 7, Resolution.DAILY) self.debug(f"We got {len(history)} items from our history request") def on_data(self, slice: Slice) -> None: data = slice.Get(RegalyticsRegulatoryArticles) if data: for articles in data.values(): self.log(articles.to_string()) if any([p in article.title.lower() for p in self.negative_sentiment_phrases for article in articles]): self.set_holdings(self.spy, -1) else: self.set_holdings(self.spy, 1)