LogoLogo
TournamentsHedge FundDiscordGitHubForumDocs
  • Numerai Tournament
    • Overview
    • Data
    • Models
    • Submissions
      • Model Uploads
      • Compute Heavy
      • NGROK Example
      • CRON Example
    • Scoring
      • Definitions
      • Correlation (CORR)
      • Meta Model Contribution (MMC)
      • Feature Neutral Correlation (FNC)
      • Grandmasters & Seasons
    • Staking
    • Bounties
  • Numerai Signals
    • Overview
    • Data
    • Models
    • Submissions
    • Scoring
      • Definitions
    • Staking
    • Signals + QuantConnect
  • Numerai Crypto
    • Overview
    • Data
    • Submissions
    • Scoring
      • Definitions
    • Staking
  • Community
    • Discord
    • Forum
    • Twitter
    • Youtube
    • Apps & Content
      • Office Hours with Arbitrage
        • Office Hours Recaps: Season 1
          • OHwA S01E01
          • OHwA S01E02
          • OHwA S01E03
          • OHwA S01E04
          • OHwA S01E05
          • OHwA S01E06
          • OHwA S01E07
          • OHwA S01E08
          • OHwA S01E09
          • OHwA S01E10
          • OHwA S01E11
          • OHwA S01E12
        • Office Hours Recaps: Season 2
          • OHwA S02E01
          • OHwA S02E02
          • OHwA S02E03
          • OHwA S02E04
          • OHwA S02E05
          • OHwA S02E06
          • OHwA S02E07
          • OHwA S02E08
          • OHwA S02E09
          • OHwA S02E10
          • OHwA S02E11
        • Office Hours Recaps: Season 3
          • OHwA S03E01
          • OHwA S03E02
          • OHwA S03E03
          • OHwA S03E04
        • Office Hours Season 4
        • FAQ in Office Hours
        • Cited resources
      • Structure of Numerai by Wigglemuse
  • NMR
    • Coinbase
    • Uniswap
    • Etherscan
    • Github
  • Connect
    • Index
Powered by GitBook
On this page
  • Requirements
  • Connecting to Numerai Signals
  • Universe Selection
  • Portfolio Construction
  • Scheduling Signals
  • Deploying Live Algorithms
  • Next Steps
  • Demonstration Algorithm
  1. Numerai Signals

Signals + QuantConnect

PreviousStakingNextOverview

Last updated 1 year ago

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. The QuantConnect Cloud Platform enables more than 50,000 quants on a monthly basis to backtest, research, and trade various asset classes, including Equities, Options, Futures, Crypto, Forex, and CFDs.

Numerai Signals lets you use any dataset to generate your trading signals. By using QuantConnect, you can leverage or your own to generate unique trading signals. The QuantConnect team ensures the data is processed correctly and delivered on time. Their API provides simple and helpful methods to select universes of assets, define trading logic, and schedule submissions to Numerai Signals. When you deploy a live algorithm on QuantConnect, their team of engineers monitors the live trading infrastructure so that you can simply automate your Numerai Signals submissions and focus on other research.

Requirements

To run live algorithms on QuantConnect's co-located servers, you must be in an with an idle . The minimum cost to start live trading is $8/month for a seat in a Quant Researcher organization and $24/month for a live trading node.

Connecting to Numerai Signals

To export signals to Numerai from your algorithm on QuantConnect, add a Numerai signal export provider during .

self.SignalExport.AddSignalExportProviders(NumeraiSignalExport(publicId, secretId, modelId, fileName))

The NumeraiSignalExport constructor accepts the following arguments:

Argument
Data Type
Description
Default Value

publicId

string

Your Numerai API key.

secretId

string

Your Numerai API secret.

modelId

string

The Id of the Numerai model.

fileName

string

The name for the signal file. If you use a file name that already exists, the new file overwrites the old one.

"predictions.csv"

Universe Selection

The Numerai Signals stock market universe covers roughly the top 5,000 largest stocks in the world, but the QuantConnect Cloud Platform currently only supports live trading of US Equities. The universe available on QuantConnect that's the closest match to the Numerai Signals universe is the CRSP US Total Market Index, which represents approximately 100% of the investable US Equity market regularly traded on the New York Stock Exchange and Nasdaq. This Index doesn't contain all of the stocks in the Numerai Signals universe, but you don't need to submit signals for all the stocks in the Numerai Signals universe.

To get the constituents of the CRSP US Total Market Index, add an ETF constituents universe for the Vanguard Total Stock Market ETF, VTI.

self.etf_symbol = self.AddEquity("VTI").Symbol 
self.AddUniverse(self.Universe.ETF(self.etf_symbol))

When the universe constituents change, we notify your algorithm through the OnSecuritiesChanged event handler. If you add a securities list to your class, you can define the OnSecuritiesChanged event handler to maintain the list so you can use it later in your algorithm.

def OnSecuritiesChanged(self, changes: SecurityChanges) -> None:
    for security in changes.RemovedSecurities:
        if security in self.securities:
            self.securities.remove(security)
            
    self.securities.extend([security for security in changes.AddedSecurities if security.Symbol != self.etf_symbol])

Portfolio Construction

When you submit signals to Numerai Signals, abide by the following rules:

  • All signals must be between 0 and 1 (exclusive)

  • You must submit at least 10 different signals per submission

  • At least 1 signal value must be unique from the rest of the securities in the universe

To create signals, create PortfolioTarget objects.

targets = [PortfolioTarget(symbol, weight) for symbol, weight in weight_by_symbol.items()]

You don’t need to actually place any trades in your algorithm, but it may be helpful to visualize your algorithm activity. You just need to send signals to Numerai. To send the signals to Numerai, call the SetTargetPortfolio method. The method returns a boolean that represents whether the targets were successfully sent to Numerai.

success = self.SignalExport.SetTargetPortfolio(targets)

Scheduling Signals

self.Schedule.On(
    self.DateRules.EveryDay(self.etf_symbol),
    self.TimeRules.At(13, 0, TimeZones.Utc), 
    self.submit_signals)

In the preceding example, the submit_signals method will automatically run at 13:00 UTC every trading day.

Deploying Live Algorithms

Follow these steps to deploy a live algorithm on QuantConnect that submits signals to Numerai Signals:

self.etf_symbol = self.AddEquity("VTI").Symbol
self.AddUniverse(self.Universe.ETF(self.etf_symbol))
  1. In the Initialize method, add the Numerai Signal export provider.

self.SignalExport.AddSignalExportProviders(NumeraiSignalExport(publicId, secretId, modelId, fileName))
  1. In the Initialize method, add a Scheduled Event to submit signals for each round.

self.Schedule.On(
    self.DateRules.EveryDay(self.etf_symbol),
    self.TimeRules.At(13, 0, TimeZones.Utc), 
    self.submit_signals)
  1. Add a class member to track the securities in the universe.

securities = []
  1. Define the OnSecuritiesChanged event handler to update the securities list as the universe changes.

def OnSecuritiesChanged(self, changes: SecurityChanges) -> None:
    for security in changes.RemovedSecurities:
        if security in self.securities:
            self.securities.remove(security)
            
    self.securities.extend([security for security in changes.AddedSecurities if security.Symbol != self.etf_symbol])
  1. Define the Scheduled Event to create and send targets.

def submit_signals(self):
    # Select the subset of ETF constituents we can trade
    symbols = [security.Symbol for security in self.securities if security.HasData]
    if len(symbols) == 0:
        return

    # Get historical data
    # close_prices = self.History(symbols, 22, Resolution.Daily).close.unstack(0)
    
    # Create portfolio targets
    # weight_by_symbol = {} # Add your logic here
    targets = [PortfolioTarget(symbol, weight) for symbol, weight in weight_by_symbol.items()]

    # (Optional) Place trades
    self.SetHoldings(targets)

    # Send signals to Numerai
    success = self.SignalExport.SetTargetPortfolio(targets)
    if not success:
        self.Debug(f"Couldn't send targets at {self.Time}")
  1. At the top of the web IDE, click the Backtest icon.

QuantConnect doesn’t send targets to Numerai during backtests, but running a backtest is a quick way to test if the algorithm has coding errors before deploying live.

  1. Deploy the algorithm to live trading.

Next Steps

Demonstration Algorithm

If you use the design, we have many you can use to create your signals. The Equal Weighting model won’t work since it gives each security the same signal. In most cases, we recommend you use the Insight Weighting model, which weighs the assets according to the strength of the signal you create.

Every Tuesday, Wednesday, Thursday, Friday, and Saturday of the week, a new round is open for you to submit signals. Saturday rounds open at 18:00 UTC, and the submission window is open until Monday 14:30 UTC. Weekday rounds open at 13:00 UTC, and the submission window is open for 1 hour. For more information about the competition rounds, see .

To schedule your submissions, you can use a .

.

In the , add a US Equity universe.

For more information about requesting historical stock prices and alternative data, see .

If you don’t want to place real-money trades in your algorithm, . If you want to trade and submit signals to Numerai in the same algorithm, see the Deploy Live Algorithms documentation for one of .

To start using QuantConnect to automate your Numerai Signals submissions, review the and .

For a full example algorithm that submits signals to Numerai Signals, see the in the LEAN GitHub repository.

their rich library of alternative data
custom datasets
organization
live trading node
initialization
Algorithm Framework
pre-built Portfolio Construction models
Rounds
Scheduled Event
Create a new project
Initialize method
History Requests
deploy with the paper trading brokerage
QuantConnect’s supported brokerages
Numerai Signals Overview documentation
create a QuantConnect account
NumeraiSignalExportDemonstrationAlgorithm