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 21 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.
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
from AlgorithmImports import *
from QuantConnect.DataSource import *
class BrainMLRankingDataAlgorithm(QCAlgorithm):
def initialize(self) -> None:
self.set_start_date(2021, 1, 1)
self.set_end_date(2021, 7, 8)
self.set_cash(100000)
# We cherry picked 5 largest stocks, high trading volume provides better information and credibility for ML ranking
tickers = ["AAPL", "TSLA", "MSFT", "F", "KO"]
self.symbol_by_dataset_symbol = {}
for ticker in tickers:
# Requesting data to get 2 days estimated relative ranking
symbol = self.add_equity(ticker, Resolution.DAILY).symbol
dataset_symbol = self.add_data(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 on_data(self, slice: Slice) -> None:
# Collect rankings for all selected symbols for ranking them
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 for positional sizing
if len(ranks) == 0:
return
ranks = [sorted(ranks).index(rank) + 1 for rank in ranks]
# Place orders according to the ML ranking, the better the rank, the higher the estimated return and hence weight
for i, rank in enumerate(ranks):
weight = rank / sum(ranks)
self.set_holdings(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:
- Constructing a portfolio of securities with each security's weight in the portfolio reflecting its Brain ML Stock Ranking
- Buying stocks with the largest Brain ML Stock Ranking
- Building a market-neutral strategy based on the top N and bottom N stocks in the Brain ML Stock Ranking
Pricing
Cloud Access
Harness Brain ML ranking data in the QuantConnect Cloud for your backtesting and live trading purposes.
Cloud Access Universe
Harness Brain ML ranking Universe data in the QuantConnect Cloud for your backtesting and live trading purposes.
On Premise Download
Brain ML Ranking archived in LEAN format for on premise backtesting and research. One file per month, per ticker.
Explore Other Datasets
US Equity Option Universe
Dataset by QuantConnect
Binance Crypto Future Margin Rate Data
Dataset by QuantConnect
NFT Sales
Dataset by CryptoSlam!