Overall Statistics |
Total Orders 4 Average Win 0% Average Loss -0.02% Compounding Annual Return -80.246% Drawdown 2.600% Expectancy -1 Start Equity 100000 End Equity 97369.19 Net Profit -2.631% Sharpe Ratio -5.306 Sortino Ratio -7.218 Probabilistic Sharpe Ratio 0.382% Loss Rate 100% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.987 Beta -0.616 Annual Standard Deviation 0.142 Annual Variance 0.02 Information Ratio -1.172 Tracking Error 0.322 Treynor Ratio 1.224 Total Fees $3.33 Estimated Strategy Capacity $760000000.00 Lowest Capacity Asset SPY R735QTJ8XC9X Portfolio Turnover 16.66% |
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(2022, 7, 10) self.set_end_date(2022, 7, 15) 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)