About Brain ML Stock Ranking

The Brain ML Stock Ranking dataset by Brain generates a daily ranking for US Equities based on their predicted ranking of future returns relative to the universe median across four-time horizons: next 2, 3, 5, 10, and 30 days (one trading month). The data covers 1,000 US Equities (universe updated yearly by including the largest 1,000 US companies of the previous year), starts in January 2010, and is delivered on a daily frequency. This dataset is created by a voting scheme of machine learning classifiers that non-linearly combine a variety of features with a series of techniques aimed at mitigating the well-known overfitting problem for financial data with a low signal-to-noise ratio. Examples of features are time-varying stock-specific features like price and volume-related metrics or fundamentals; time-fixed stock-specific features like the sector and other database information; market regime features such as volatility and other financial stress indicators; calendar features representing possible anomalies, for example, the month of the year.

More precisely the ML Stock Ranking score is related to the confidence of a Machine Learning classifier in predicting top or bottom quintile returns for the next N trading days (e.g. next 21 trading days) for a stock with the respect to the median of the universe and ranges from -1 to +1.

A negative score means that the system is more confident that the stock belongs to the lower returns quintile, a positive score means that the system is more confident that the stock belongs to the higher returns quintile. It is important to note that the score has a meaning only if used to compare different stocks to perform a ranking.

Typical use is to download the score for a large stock universe for a given day, e.g. 500 stocks or the full universe of 1000 stocks, order the stocks by mlAlpha score and go long the top K stocks, or build a long-short strategy going long the top K and short the bottom K stocks.

For more information, refer to Brain's summary paper.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.


About Brain

Brain is a Research Company that creates proprietary datasets and algorithms for investment strategies, combining experience in financial markets with strong competencies in Statistics, Machine Learning, and Natural Language Processing. The founders share a common academic background of research in Physics as well as extensive experience in Financial markets.

Add Brain ML Stock Ranking

Add Dataset Create Free QuantConnect Account

About QuantConnect

QuantConnect was founded in 2012 to serve quants everywhere with the best possible algorithmic trading technology. Seeking to disrupt a notoriously closed-source industry, QuantConnect takes a radically open-source approach to algorithmic trading. Through the QuantConnect web platform, more than 50,000 quants are served every month.


Algorithm Example

class BrainMLRankingDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2021, 1, 1)
        self.SetEndDate(2021, 7, 8)
        self.SetCash(100000) 
        
        tickers = ["AAPL", "TSLA", "MSFT", "F", "KO"]
        self.symbol_by_dataset_symbol = {}
        for ticker in tickers:
            
            # Requesting data
            symbol = self.AddEquity(ticker, Resolution.Daily).Symbol
            dataset_symbol = self.AddData(BrainStockRanking2Day, symbol).Symbol
            self.symbol_by_dataset_symbol[dataset_symbol] = symbol
            
            # Historical data
            history = self.History(dataset_symbol, 365, Resolution.Daily)
            self.Debug(f"We got {len(history)} items from our history request for {symbol}")
        
    def OnData(self, slice: Slice) -> None:
        
        # Collect rankings for all symbols
        points = slice.Get(BrainStockRanking2Day)
        if points is None:
            return
        symbols = []
        ranks = []
        for point in points.Values:
            symbols.append(self.symbol_by_dataset_symbol[point.Symbol])
            ranks.append(point.Rank)
        
        # Rank each symbol's Brain ML ranking relative to each other
        if len(ranks) == 0:
            return
        ranks = [sorted(ranks).index(rank) + 1 for rank in ranks]
        
        # Place orders
        for i, rank in enumerate(ranks):
            weight = rank / sum(ranks)
            self.SetHoldings(symbols[i], weight)

Example Applications

The Brain ML Stock Ranking dataset enables you to test strategies using the machine learning ranking provided by Brain. Examples include the following strategies: