Overall Statistics
Total Orders
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Start Equity
100000
End Equity
100000
Net Profit
0%
Sharpe Ratio
0
Sortino Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
-0.655
Tracking Error
0.179
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
Portfolio Turnover
0%
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(2020, 1, 1)
        self.set_cash(100000)
        
        self.spy = self.add_equity("SPY", Resolution.DAILY).symbol
            
        # Requesting data
        self.regalytics_symbol = self.add_data(RegalyticsRegulatoryArticles, "REG").symbol
        self.cum_articles = 0

    def on_data(self, slice: Slice) -> None:
        data = slice.Get(RegalyticsRegulatoryArticles)
        if data:
            data_points = len(data.values()[0].Data)
            self.Log(f"Articles data: {data_points}")
            self.plot("Data points","Daily", data_points)
            self.cum_articles += data_points
            self.plot("Data points","Cummulative", self.cum_articles)
    
    def on_end_of_algorithm(self):
        self.log(f"Total Data Points: {self.cum_articles}")