From f0a8256bf92ca0830aca0ef992222bf3140e7065 Mon Sep 17 00:00:00 2001 From: GitHub Date: Fri, 1 Mar 2024 10:23:50 +0000 Subject: [PATCH] Code generated by SinglePageDocGenerator.py --- single-page/Quantconnect-Cloud-Platform.html | 16764 ++++++++-------- single-page/Quantconnect-Lean-Cli.html | 589 +- single-page/Quantconnect-Local-Platform.html | 186 +- .../Quantconnect-Research-Environment.html | 16 +- .../Quantconnect-Writing-Algorithms.html | 60 +- 5 files changed, 9201 insertions(+), 8414 deletions(-) diff --git a/single-page/Quantconnect-Cloud-Platform.html b/single-page/Quantconnect-Cloud-Platform.html index 27bb296ab1..97db787a89 100644 --- a/single-page/Quantconnect-Cloud-Platform.html +++ b/single-page/Quantconnect-Cloud-Platform.html @@ -87,6 +87,20 @@

Table of Content

  • 9.4 Misconceptions
  • 9.5 Licensing
  • 9.6 Vendors
  • +
  • 9.7 QuantConnect
  • +
  • 9.7.1 US Equities
  • +
  • 9.7.2 Crypto
  • +
  • 9.7.3 Crypto Futures
  • +
  • 9.7.4 CFD
  • +
  • 9.7.5 Forex
  • +
  • 9.7.6 Futures
  • +
  • 9.7.7 Future Options
  • +
  • 9.7.8 Alternative Data
  • +
  • 9.8 Interactive Brokers
  • +
  • 9.9 Polygon
  • +
  • 9.10 Samco
  • +
  • 9.11 Tradier
  • +
  • 9.12 Zerodha
  • 10 Live Trading
  • 10.1 Getting Started
  • 10.2 Brokerages
  • @@ -107,26 +121,12 @@

    Table of Content

  • 10.2.15 Bloomberg EMSX
  • 10.2.16 FIX Connections
  • 10.2.17 Unsupported Brokerages
  • -
  • 10.3 Data Providers
  • -
  • 10.3.1 QuantConnect
  • -
  • 10.3.1.1 US Equities
  • -
  • 10.3.1.2 Crypto
  • -
  • 10.3.1.3 Crypto Futures
  • -
  • 10.3.1.4 CFD
  • -
  • 10.3.1.5 Forex
  • -
  • 10.3.1.6 Futures
  • -
  • 10.3.1.7 Future Options
  • -
  • 10.3.1.8 Alternative Data
  • -
  • 10.3.2 Interactive Brokers
  • -
  • 10.3.3 Samco
  • -
  • 10.3.4 Tradier
  • -
  • 10.3.5 Zerodha
  • -
  • 10.4 Deployment
  • -
  • 10.5 Notifications
  • -
  • 10.6 Results
  • -
  • 10.7 Algorithm Control
  • -
  • 10.8 Reconciliation
  • -
  • 10.9 Risks
  • +
  • 10.3 Deployment
  • +
  • 10.4 Notifications
  • +
  • 10.5 Results
  • +
  • 10.6 Algorithm Control
  • +
  • 10.7 Reconciliation
  • +
  • 10.8 Risks
  • 11 Optimization
  • 11.1 Getting Started
  • 11.2 Parameters
  • @@ -436,7 +436,7 @@

    The - + live results page displays your algorithm’s live trading performance. @@ -921,7 +921,7 @@

    Team Tier

    Trading Technologies brokerage and our - + live Futures data provider are available. Each live algorithm in a Team organization can send up to 60 Telegram, Email, or Webhook notifications per hour for free. @@ -7055,7 +7055,7 @@

    Parameters

    to remove hard-coded values from your code files and to perform parameter optimizations @@ -7903,7 +7903,7 @@

    Keyboard Shortcuts

    1. Open a project @@ -10987,7 +10987,7 @@

      Rename Notebooks

      .
    - Warning: Undefined variable $videoLink in /tmp/docs/6697a086e832ee7dc062090e26478fd4b30ac8de/Resources/getting-started/projects/rename-files.php on line 10 + Warning: Undefined variable $videoLink in /tmp/docs/e4cd878f7bb065188c7dcbda70f739c63a499865/Resources/getting-started/projects/rename-files.php on line 10 @@ -15361,95 +15361,41 @@

    Datasets

    -
    -
    -

    - Datasets are a stream of data points you use in your algorithms to make trading decisions and fill orders. Our Dataset Market is a portal where we aggregate datasets for you to use in your algorithms. Our Dataset Market includes price, fundamental, and alternative datasets. Consider using fundamental and alternative datasets to incorporate more information in your trading decisions. Fundamental and alternative datasets contain information that is not present in the price. Price data is commonly researched for trading ideas, so you may find it easier to discover alpha in other types of datasets. -

    -

    - The Dataset Market enables you to easily load datasets into your trading algorithms for use in the cloud or locally. The datasets come configured ready to integrate into your research and backtesting without any need for cleaning. The datasets in our market are vetted by the QuantConnect team to be high-quality, contain actionable information, and be free of survivorship-bias. Our Dataset Market is growing quickly. New datasets are added frequently. -

    -
    - - -
    +

    + { + "type" : "landing", + "heading" : "Datasets", + "subHeading" : "", + "content" : " +

    +

    + Datasets are a stream of data points you use in your algorithms to make trading decisions and fill orders. Our Dataset Market is a portal where we aggregate datasets for you to use in your algorithms. Our Dataset Market includes price, fundamental, and alternative datasets. Consider using fundamental and alternative datasets to incorporate more information in your trading decisions. Fundamental and alternative datasets contain information that is not present in the price. Price data is commonly researched for trading ideas, so you may find it easier to discover alpha in other types of datasets. +

    +

    + The Dataset Market enables you to easily load datasets into your trading algorithms for use in the cloud or locally. The datasets come configured ready to integrate into your research and backtesting without any need for cleaning. The datasets in our market are vetted by the QuantConnect team to be high-quality, contain actionable information, and be free of survivorship-bias. Our Dataset Market is growing quickly. New datasets are added frequently. +

    + ", + "alsoLinks" : [ + { "text" : "Dataset Market" , "href" : "/datasets" }, + { "text" : "Purchasing Datasets" , "href" : "/docs/v2/cloud-platform/datasets/licensing" }, + { "text" : "Contributing Datasets" , "href" : "/docs/v2/lean-engine/contributions/datasets/key-concepts" } + ], + "featureShortDescription": { + "01" : "The lay of the land", + "02" : "Diverse types of datasets available", + "03" : "Data isn't always perfect", + "04" : "It might not be a data issue", + "05" : "Ways to access the data", + "06" : "People who provide datasets", + + "07" : "Data Provider", + "08" : "Brokerage Data Provider", + "09" : "Data Provider", + "10" : "Brokerage Data Provider", + "11" : "Brokerage Data Provider", + "12" : "Brokerage Data Provider", + } +} @@ -16547,7 +16493,7 @@

    Download

    If you have a Download license, you can store datasets on your local machine. This download is for the licensed organization's internal LEAN use only and cannot be redistributed or converted in any format. If you study the data and produce some charts, you may share images of the charts online if the original data can't be to reconstructed from the image. The cost of the license depends on the dataset and it's calculated on a per-file or per-day basis. For more information about downloading datasets, see - + Downloading Data . If you bulk download datasets, you can download historical data packages or daily updates. In most cases, you need both. @@ -16716,2144 +16662,2055 @@

    Contacting Our Team

     

    - +
    -
    -

    Live Trading

    - +
    +

    Datasets

    +

    QuantConnect

    - - -
    -
    -

    - A live algorithm is an algorithm that trades in real-time with real market data. QuantConnect enables you to run your algorithms in live mode with real-time market data. Deploy your algorithms using QuantConnect because our infrastructure is battle-tested. We have successfully hosted more than 200,000 live algorithms and have had more than $15B in volume traded on our servers since 2015. The algorithms that our members create are run on co-located servers and the trading infrastructure is maintained at all times by our team of engineers. It's common for members to achieve 6-months of uptime with no interruptions. -

    -
    - - -
    - - - -

     

    - +
    -
    -

    Live Trading

    -

    Getting Started

    +
    +

    QuantConnect

    +

    US Equities

    +

    Introduction

    -
    - -
    - -
    -
    +

    + The QuantConnect data provider provides a stream of US Equity trades and quotes to your trading algorithm during live execution. Live data enables you to make real-time trades and update the value of the securities in your portfolio. +

    +

    + The QuantConnect data provider also provides a live stream of corporate actions (US Equity Security Master), daily updates on company fundamentals (US Fundamentals), and the number of shares that are available for short sellers to borrow (US Equities Short Availability). +

    -

    Introduction

    +

    Sourcing

    - A live algorithm is an algorithm that trades in real-time with real market data. QuantConnect enables you to run your algorithms in live mode with real-time market data. Deploy your algorithms using QuantConnect because our infrastructure is battle-tested. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015. The algorithms that our members create are run on co-located servers and the trading infrastructure is maintained at all times by our team of engineers. It's common for members to achieve 6-months of uptime with no interruptions. + The QuantConnect data provider consolidates US Equity market data across all of the exchanges. Over-the-Counter (OTC) trades are excluded. The data is powered by the Securities Information Processor (SIP), so it has 100% market coverage. In contrast, free platforms that display data feeds like the Better Alternative Trading System (BATS) only have + + about 6-7% market coverage + + . +

    +

    + We provide live splits, dividends, and corporate actions for US companies. We deliver them to your algorithm before the trading day starts.

    -

    Deploy Live Algorithms

    +

    Universe Selection

    - The following video demonstrates how to deploy live paper trading algorithms: -

    - Deploy a live algorithm -

    - You must have an available - - live trading node - - for each live trading algorithm you deploy. + The QuantConnect data provider enables you to create a dynamic universe of US Equities.

    +

    + Fundamental Universe +

    - Follow these steps to deploy a live paper trading algorithm: -

    -
      -
    1. - - Open the project - - that you want to deploy. -
    2. -
    3. - Click the - Deploy live icon - - Deploy Live - - icon. -
    4. -
    5. - On the Deploy Live page, click the - - Brokerage - - field and then click - - Paper Trading - - from the drop-down menu. -
    6. -
    7. - Click the - - Node - - field and then click the live trading node that you want to use from the drop-down menu. -
    8. -
    9. - - (Optional) - - Follow these steps to start the algorithm with existing cash holdings ( - - see video - - ): -
    10. -
        -
      1. - In the - - Algorithm Cash State - - section, click - - Show - - . -
      2. -
      3. - Click - - Add Currency - - . -
      4. -
      5. - Enter the currency ticker (for example, USD or BTC) and a quantity. -
      6. -
      -
    11. - - (Optional) - - Follow these steps to start the algorithm with existing position holdings ( - - see video - - ): -
    12. -
        -
      1. - In the - - Algorithm Holdings State - - section, click - - Show - - . -
      2. -
      3. - Click - - Add Holding - - . -
      4. -
      5. - Enter the symbol ID, symbol, quantity, and average price. -
      6. -
      -
    13. - - (Optional) - - - Set up notifications - - . -
    14. -
    15. - Configure the - - Automatically restart algorithm - - setting. -
    16. -

      - By enabling - - automatic restarts - - , the algorithm will use best efforts to restart the algorithm if it fails due to a runtime error. This can help improve the algorithm's resilience to temporary outages such as a brokerage API disconnection. -

      -
    17. - Click - - Deploy - - . -
    18. -
    -

    - The deployment process can take up to 5 minutes. When the algorithm deploys, the - - live results page - - displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings. + The live data for fundamental universe selection arrives at 6/7 AM Eastern Time (ET), so fundamental universe selection runs for live algorithms between 7 and 8 AM ET. This timing allows you to place trades before the market opens. Don't schedule anything for midnight because the universe selection data isn't ready yet.

    +
    +
    UniverseSettings.Asynchronous = true;
    +AddUniverse(SelectFundamental);
    +
    self.UniverseSettings.Asynchronous = True
    +self.AddUniverse(self.SelectFundamental)
    +
    +

    + ETF Constituent Universe +

    - To deploy a live algorithm with a different brokerage, see the - - Deploy Live Algorithms - - section of the - - brokerage integration documentation + The QuantConnect data provider enables you to create a universe of securities to match the constituents of an ETF. For more information about ETF universes, see + + ETF Constituents Selection .

    +
    +
    UniverseSettings.Asynchronous = true;
    +var spy = AddEquity("SPY").Symbol;
    +AddUniverse(Universe.ETF(spy, UniverseSettings, ETFConstituentsFilter));
    +
    self.UniverseSettings.Asynchronous = True
    +spy = self.AddEquity("SPY").Symbol
    +self.AddUniverse(self.Universe.ETF(spy, self.UniverseSettings, self.ETFConstituentsFilter))
    +
    -

    Stop Live Algorithms

    +

    Bar Building

    - The live trading results page has a - - Stop - - button to immediately stop your algorithm from executing. -When you stop a live algorithm, your portfolio holdings are retained. Stop your algorithm if you want to perform any of the following actions: + We aggregate ticks to build bars.

    - +

    + Discrepancies +

    - Furthermore, if you receive new securities in your portfolio because of a reverse merger, you also need to stop and redeploy the algorithm. + In live trading, bars are built using the exchange timestamps with microsecond accuracy. This microsecond-by-microsecond processing + of the ticks can mean that the individual bars between live trading and backtesting can have slightly different ticks. As a result, it's possible for a + tick to be counted in different bars between backtesting and live trading, which can lead to bars having slightly different open, high, low, close, and volume values.

    +

    + Opening and Closing Auctions +

    - LEAN actively terminates live algorithms when it detects interference outside of the algorithm's control to avoid conflicting race conditions between the owner of the account and the algorithm, so avoid manipulating your brokerage account and placing manual orders on your brokerage account while your algorithm is running. If you need to adjust your brokerage account holdings, stop the algorithm, manually place your trades, and then redeploy the algorithm. + The opening and closing price of the day is set by very specific opening and closing auction ticks. When a stock like Apple is + listed, it’s listed on Nasdaq. The open auction tick on Nasdaq is the price that’s used as the official open of the + day. NYSE, BATS, and other exchanges also have opening auctions, but the only official opening price for Apple is the + opening auction on the exchange where it was listed.

    - Follow these steps to stop your algorithm: + We set the opening and closing prices of the first and last bars of the day to the official auction prices. This + process is used for second, minute, hour, and daily bars for the 9:30 AM and 4:30 PM Eastern Time (ET) prices. + In contrast, other platforms might not be using the correct opening and closing prices.

    -
      +

      + The official auction prices are usually emitted 2-30 seconds after the market open and close. We do our best + to use the official opening and closing prices in the bars we build, but the delay can be so large that there + isn't enough time to update the opening and closing price of the bar before it's injected into your algorithms. For example, + if you subscribe to second resolution data, we wait until the end of the second for the opening price but most + second resolution data won’t get the official opening price. If you subscribe to minute resolution data, we wait until + the end of the minute for the opening auction price. Most of the time, you’ll get the actual opening auction price + with minute resolution data, but there are always exceptions. Nasdaq and NYSE can have delays in publishing the + opening auction price, but we don’t have control over those issues and we have to emit the data on time so that you + get the bar you are expecting. +

      +

      + Excluded Ticks +

      +

      + The bar-building process can exclude ticks. If a tick is excluded, its volume is aggregated in the bar but its price is not aggregated in the bar. Ticks are excluded if any of the following statements are true: +

      +
    - - - -

    Liquidate Live Algorithms

    - - -

    - The live results page has a - - Liquidate - - button that acts as a "kill switch" to sell all of your portfolio holdings. If your algorithm has a bug in it that caused it to purchase a lot of securities that you didn't want, this button let's you easily liquidate your portfolio instead of placing many manual trades. When you click the - - Liquidate - - button, if the market is open for an asset you hold, the algorithm liquidates it with market orders. If the market is not open, the algorithm places market on open orders. After the algorithm submits the liquidation orders, it stops executing. -

    -

    - Follow these steps to liquidate your positions: -

    -
      -
    1. - Open your algorithm's - - live results page - - . + The trade has none of the following included + + TradeConditionFlags + + and at least one of the following excluded + + TradeConditionFlags + + :
    2. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + TradeConditionFlags + + + Status + + Description +
      + + Regular + + + Included + + A trade made without stated conditions is deemed the regular way for settlement on the third business day following the transaction date. +
      + + FormT + + + Included + + Trading in extended hours enables investors to react quickly to events that typically occur outside regular market hours, such as earnings reports. However, liquidity may be constrained during such Form T trading, resulting in wide bid-ask spreads. +
      + + Cash + + + Included + + A transaction that requires delivery of securities and payment on the same day the trade takes place. +
      + + ExtendedHours + + + Included + + Identifies a trade that was executed outside of regular primary market hours and is reported as an extended hours trade. +
      + + NextDay + + + Included + + A transaction that requires the delivery of securities on the first business day following the trade date. +
      + + OfficialClose + + + Included + + Indicates the "official" closing value determined by a Market Center. This transaction report will contain the market center generated closing price. +
      + + OfficialOpen + + + Included + + Indicates the 'Official' open value as determined by a Market Center. This transaction report will contain the market center generated opening price. +
      + + ClosingPrints + + + Included + + The transaction that constituted the trade-through was a single priced closing transaction by the Market Center. +
      + + OpeningPrints + + + Included + + The trade that constituted the trade-through was a single priced opening transaction by the Market Center. +
      + + IntermarketSweep + + + Excluded + + The transaction that constituted the trade-through was the execution of an order identified as an Intermarket Sweep Order. +
      + + TradeThroughExempt + + + Excluded + + Denotes whether or not a trade is exempt (Rule 611). +
      + + OddLot + + + Excluded + + Denotes the trade is an odd lot less than a 100 shares. +
    3. - Click - - Liquidate - - . + The quote has a size of less than 100 shares.
    4. - Click - - Liquidate - - again. + The quote has one of the following + + QuoteConditionFlags + + :
    5. -
    - - - -

    On-Premise Live Algorithms

    - - -

    - For information about on-premise live trading with - - Local Platform - - , see - - Getting Started - - . -

    - - - -

     

    - -
    -
    -

    Live Trading

    -

    Brokerages

    -
    -
    - - -
    -
    -

    - Brokerages supply a connection to the exchanges so that you can automate orders using LEAN. -

    -
    - - -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + QuoteConditionFlags + + + Description +
    + + Closing + + + Indicates that this quote was the last quote for a security for that Participant. +
    + + NewsDissemination + + + Denotes a regulatory trading halt when relevant news influencing the security is being disseminated. Trading is + suspended until the primary market determines that an adequate publication or disclosure of information has occurred. +
    + + NewsPending + + + Denotes a regulatory Trading Halt due to an expected news announcement, which may influence the security. An Opening Delay or Trading Halt may be continued once the news has been disseminated. +
    + + TradingRangeIndication + + + Denotes the probable trading range (Bid and Offer prices, no sizes) of a security that is not Opening Delayed or Trading Halted. The Trading Range Indication is used prior to or after the opening of a security. +
    + + OrderImbalance + + + Denotes a non-regulatory halt condition where there is a significant imbalance of buy or sell orders. +
    + + Resume + + + Indicates that trading for a Participant is no longer suspended in a security that had been Opening Delayed or Trading Halted. +
    +
  • + The quote has none of the following + + QuoteConditionFlags + + : +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + QuoteConditionFlags + + + Description +
    + + Regular + + + This condition is used for the majority of quotes to indicate a normal trading environment. +
    + + Slow + + + This condition is used to indicate that the quote is a Slow Quote on both the bid and offer sides due to a Set Slow List that includes high price securities. +
    + + Gap + + + While in this mode, auto-execution is not eligible, the quote is then considered manual and non-firm in the bid and offer, and either or both sides can be traded through as per Regulation NMS. +
    + + OpeningQuote + + + This condition can be disseminated to indicate that this quote was the opening quote for a security for that Participant. +
    + + FastTrading + + + For extremely active periods of short duration. While in this mode, the UTP Participant will enter quotations on a best efforts basis. +
    + + Resume + + + Indicate that trading for a Participant is no longer suspended in a security which had been Opening Delayed or Trading Halted. +
    + +

    + In the preceding tables, + + Participant + + refers to the entities on page 19 of the + + Consolidated Tape System Multicast Output Binary Specification + + . +

    -

     

    - -
    -
    -

    Brokerages

    -

    QuantConnect Paper Trading

    -
    -
    -

    Introduction

    +

    Suspicious Ticks

    - QuantConnect enables you to run your algorithms in live mode with real-time market data. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015. + Tick price data is raw and unfiltered, so it can contain a lot of noise. If a tick is not tradable, we flag it as suspicious. This process makes the bars a more realistic representation of what you could execute in live trading. If you use tick data, avoid using suspicious ticks in your algorithms as informative data points. We recommend only using tick data if you understand the risks and are able to perform your own tick filtering. Ticks are flagged as suspicious in the following situations: +

    + + + + +

    Delivery

    + + +

    + Most live trading algorithms run on co-located servers racked in Equinix. Co-location reduces several factors that can interfere with your algorithm, including downtime from internet outages, equipment repairs, and natural disasters.

    - QuantConnect Paper Trading lets you run - - live, real-time data - - into your algorithm but execute trades using fictional capital. Instead of your orders being routed to an exchange when you're paper trading, your order fills are simulated. Use paper trading to test your algorithm without risking real money and to ensure your backtest wasn't overfit before deploying with real money. You can use the paper trading brokerage without needing to sign up for a real brokerage account. If you don't set a brokerage model in your algorithm with the - - SetBrokerageModel - - method, the paper trading brokerage uses the - - DefaultBrokerageModel - - to simulate trades. + Live data takes time to travel from the source to your algorithm. The QuantConnect data provider has a latency of 20-50 milliseconds. QuantConnect is not designed for high-frequency trading.

    + + + +

    Historical Data

    + +

    - To view the implementation of the QuantConnect Paper Trading brokerage, see - - PaperBrokerage.cs + When you + + request historical data - in the LEAN GitHub repository. To view the implementation of the backtesting brokerage, see - - BacktestingBrokerage.cs + or run + + warm-up - in the LEAN GitHub repository. + , the amount of historical data you can access depends on the resolution of your data subscriptions. The following table shows the amount of trailing historical data you can access for each data resolution:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Resolution + + Available History +
    + Daily + + All historical data +
    + Hour + + All historical data +
    + Minute + + 1 year +
    + Second + + 2 months +
    + Tick + + 1 month +
    -

    Account Types

    +

    Pricing

    - The QuantConnect Paper Trading brokerage supports cash and margin accounts. To set the account type in an algorithm, see the - - paper trading brokerage model documentation - - . + The QuantConnect data provider serves US Equities data for free.

    -

    - If you pass a different - - BrokerageName - - to the - - SetBrokerageModel - - method, the new brokerage model defines the account types that are available. + + + +

     

    + +
    +
    +

    QuantConnect

    +

    Crypto

    +
    +
    +

    Introduction

    + + +

    + The QuantConnect data provider provides a stream of Crypto trades and quotes to your trading algorithm during live execution. Live data enables you to make real-time trades and update the value of the securities in your portfolio.

    -

    Asset Classes

    +

    Sourcing

    - The QuantConnect Paper Trading brokerage supports the following asset classes: + The QuantConnect data provider uses WebSockets to gather Crypto market data from the following sources:

    + + + +

    Universe Selection

    + +

    - If you set the - - brokerage model - - to a model other than the - - DefaultBrokerageModel + The QuantConnect data provider enables you to create a dynamic universe of Crypto securities. The live data for Crypto universe selection arrives at 4 PM Coordinated Universal Time (UTC), so universe selection runs for live algorithms between 4 PM and 4:30 PM. Don't schedule anything for midnight because the universe selection data isn't ready yet. +

    +
    +
    UniverseSettings.Asynchronous = true;
    +AddUniverse(CryptoCoarseFundamentalUniverse(Market.Bitfinex, UniverseSettings, UniverseSelectionFilter));
    +
    self.UniverseSettings.Asynchronous = True
    +self.AddUniverse(CryptoCoarseFundamentalUniverse(Market.Bitfinex, self.UniverseSettings, self.UniverseSelectionFilter))
    +
    +

    + To view an example for each Crypto market, see the + + Universe Selection + + section of the Crypto market in the + + Dataset Market - , the new brokerage model defines the asset classes you can trade. + .

    -

    Data Feeds

    +

    Bar Building

    - We can only provide paper trading on the assets for which we have a - - live data provider - - . + We aggregate ticks to build bars. +

    +

    + In live trading, bars are built using the exchange timestamps with microsecond accuracy. This microsecond-by-microsecond processing + of the ticks can mean that the individual bars between live trading and backtesting can have slightly different ticks. As a result, it's possible for a + tick to be counted in different bars between backtesting and live trading, which can lead to bars having slightly different open, high, low, close, and volume values.

    -

    Orders

    +

    Delivery

    - The following sections describe how the - - DefaultBrokerageModel - - handles orders. If you set the brokerage model to a different model, the new brokerage model defines how orders are handled. + Most live trading algorithms run on co-located servers racked in Equinix. Co-location reduces several factors that can interfere with your algorithm, including downtime from internet outages, equipment repairs, and natural disasters.

    -

    - Order Types -

    - The following table describes the available order types for each asset class that the - - DefaultBrokerageModel - - supports: + Live data takes time to travel from the source to your algorithm. The QuantConnect data provider has a latency of 20-50 milliseconds. QuantConnect is not designed for high-frequency trading.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + +

    Historical Data

    + + +

    + When you + + request historical data + + or run + + warm-up + + , the amount of historical data you can access depends on the resolution of your data subscriptions. The following table shows the amount of trailing historical data you can access for each data resolution: +

    +
    - Order Type - - US Equity - - Crypto - - Crypto Futures - - Forex - - CFD - - Futures - - Futures Options -
    - - MarketOrder - - - green check - - green check - - green check - - green check - - green check - - green check - - green check -
    - - LimitOrder - - - green check - - green check - - green check - - green check - - green check - - green check - - green check -
    - - LimitIfTouchedOrder - - - green check - - green check - - green check - - green check - - green check - - green check - - green check -
    - - StopMarketOrder - - - green check - - green check - - green check - - green check - - green check - - green check - - green check -
    + + + + + + - - - - + + + + + + + + +
    + Resolution + + Available History +
    - - StopLimitOrder - - - green check - - green check - - green check - - green check + Daily - green check + All historical data
    - green check + Hour - green check + All historical data
    - - MarketOnOpenOrder - + Minute - green check + 1 year
    - green check + Second + 2 months
    - green check + Tick - green check + 1 month
    + + + +

    Pricing

    + + +

    + The QuantConnect data provider serves Crypto data for free. +

    + + + +

     

    + +
    +
    +

    QuantConnect

    +

    Crypto Futures

    +
    +
    +

    Introduction

    + + +

    + The QuantConnect data provider provides a stream of Crypto Futures trades and quotes to your trading algorithm during live execution. Live data enables you to make real-time trades and update the value of the securities in your portfolio. +

    + + + +

    Sourcing

    + + +

    + The QuantConnect data provider uses WebSockets to gather Crypto Futures market data from Binance. +

    + + + +

    Bar Building

    + + +

    + We aggregate ticks to build bars. +

    +

    + In live trading, bars are built using the exchange timestamps with microsecond accuracy. This microsecond-by-microsecond processing + of the ticks can mean that the individual bars between live trading and backtesting can have slightly different ticks. As a result, it's possible for a + tick to be counted in different bars between backtesting and live trading, which can lead to bars having slightly different open, high, low, close, and volume values. +

    + + + +

    Delivery

    + + +

    + Most live trading algorithms run on co-located servers racked in Equinix. Co-location reduces several factors that can interfere with your algorithm, including downtime from internet outages, equipment repairs, and natural disasters. +

    +

    + Live data takes time to travel from the source to your algorithm. The QuantConnect data provider has a latency of 20-50 milliseconds. QuantConnect is not designed for high-frequency trading. +

    + + + +

    Historical Data

    + + +

    + When you + + request historical data + + or run + + warm-up + + , the amount of historical data you can access depends on the resolution of your data subscriptions. The following table shows the amount of trailing historical data you can access for each data resolution: +

    + + + + + + + + + + + + + + + + +
    + Resolution + + Available History +
    + Daily + All historical data
    - - MarketOnCloseOrder - + Hour - green check + All historical data
    - green check + Minute + 1 year
    - green check + Second - green check + 2 months
    - green check + Tick - green check + 1 month
    + + + +

    Pricing

    + + +

    + The QuantConnect data provider serves Crypto Futures data for free. +

    + + + +

     

    + +
    +
    +

    QuantConnect

    +

    CFD

    +
    +
    +

    Introduction

    + + +

    + The QuantConnect data provider provides a stream of CFD trades and quotes to your trading algorithm during live execution. Live data enables you to make real-time trades and update the value of the securities in your portfolio. +

    + + + +

    Sourcing

    + + +

    + The QuantConnect data provider consolidates CFD market data from OANDA. +

    + + + +

    Bar Building

    + + +

    + We aggregate ticks to build bars. +

    +

    + In live trading, bars are built using the exchange timestamps with microsecond accuracy. This microsecond-by-microsecond processing + of the ticks can mean that the individual bars between live trading and backtesting can have slightly different ticks. As a result, it's possible for a + tick to be counted in different bars between backtesting and live trading, which can lead to bars having slightly different open, high, low, close, and volume values. +

    + + + +

    Delivery

    + + +

    + Most live trading algorithms run on co-located servers racked in Equinix. Co-location reduces several factors that can interfere with your algorithm, including downtime from internet outages, equipment repairs, and natural disasters. +

    +

    + Live data takes time to travel from the source to your algorithm. The QuantConnect data provider has a latency of 20-50 milliseconds. QuantConnect is not designed for high-frequency trading. +

    + + + +

    Historical Data

    + + +

    + When you + + request historical data + + or run + + warm-up + + , the amount of historical data you can access depends on the resolution of your data subscriptions. The following table shows the amount of trailing historical data you can access for each data resolution: +

    + + + + + + + + - - - - - - - - - - - - + + + + + + +
    + Resolution + + Available History +
    - - ComboMarketOrder - - - - - - - + Daily - green check + All historical data
    - - ComboLimitOrder - - - - - - - + Hour - green check + All historical data
    - - ComboLegLimitOrder - + Minute + 1 year
    + Second + 2 months
    + Tick + 1 month
    + + + +

    Pricing

    + + +

    + The QuantConnect data provider serves CFD data for free. +

    + + + +

     

    + +
    +
    +

    QuantConnect

    +

    Forex

    +
    +
    +

    Introduction

    + + +

    + The QuantConnect data provider provides a stream of Forex pair trades and quotes to your trading algorithm during live execution. Live data enables you to make real-time trades and update the value of the securities in your portfolio. +

    + + + +

    Sourcing

    + + +

    + The QuantConnect data provider consolidates Forex market data from OANDA. +

    + + + +

    Bar Building

    + + +

    + We aggregate ticks to build bars. +

    +

    + In live trading, bars are built using the exchange timestamps with microsecond accuracy. This microsecond-by-microsecond processing + of the ticks can mean that the individual bars between live trading and backtesting can have slightly different ticks. As a result, it's possible for a + tick to be counted in different bars between backtesting and live trading, which can lead to bars having slightly different open, high, low, close, and volume values. +

    + + + +

    Delivery

    + + +

    + Most live trading algorithms run on co-located servers racked in Equinix. Co-location reduces several factors that can interfere with your algorithm, including downtime from internet outages, equipment repairs, and natural disasters. +

    +

    + Live data takes time to travel from the source to your algorithm. The QuantConnect data provider has a latency of 20-50 milliseconds. QuantConnect is not designed for high-frequency trading. +

    + + + +

    Historical Data

    + + +

    + When you + + request historical data + + or run + + warm-up + + , the amount of historical data you can access depends on the resolution of your data subscriptions. The following table shows the amount of trailing historical data you can access for each data resolution: +

    + + + + + + + + + + + + + + +
    + Resolution + + Available History +
    + Daily - green check + All historical data
    - - ExerciseOption - + Hour + All historical data
    + Minute + 1 year
    + Second + 2 months
    + Tick - green check + 1 month
    - -

    - Time In Force -

    + + + +

    Pricing

    + +

    - The - - DefaultBrokerageModel - - supports the following - - TimeInForce - - instructions: + The QuantConnect data provider serves Forex data for free.

    - -

    - Updates -

    + + + +

     

    + +
    +
    +

    QuantConnect

    +

    Futures

    +
    +
    +

    Introduction

    + +

    - The - - DefaultBrokerageModel - - supports - - order updates - - . + The QuantConnect data provider provides a stream of Futures trades, quotes, and open interest to your trading algorithm during live execution. Live data enables you to make real-time trades and update the value of the securities in your portfolio.

    -

    - Handling Splits -

    + + + +

    Sourcing

    + +

    - If you're using raw - - data normalization - - and you have active orders with a limit, stop, or trigger price in the market for a US Equity when a - - stock split - - occurs, the following properties of your orders automatically adjust to reflect the stock split: + The QuantConnect data provider consolidates Futures market data across the following markets:

    +

    + The data is powered by the Chicago Mercantile Exchange (CME). +

    +

    + The data provider doesn't include the CFE market. For + + Futures.Indices.VIX + + , use a combination of the QuantConnect and IB data provider. For more details about this option, see + + Hybrid QuantConnect Data Provider + + . +

    -

    Fees

    +

    Bar Building

    - The following table shows the fees that the - - DefaultBrokerageModel - - charges for each of the supported asset classes: + We aggregate ticks to build bars.

    - +

    + In live trading, bars are built using the exchange timestamps with microsecond accuracy. This microsecond-by-microsecond processing + of the ticks can mean that the individual bars between live trading and backtesting can have slightly different ticks. As a result, it's possible for a + tick to be counted in different bars between backtesting and live trading, which can lead to bars having slightly different open, high, low, close, and volume values. +

    + + + +

    Delivery

    + + +

    + Most live trading algorithms run on co-located servers racked in Equinix. Co-location reduces several factors that can interfere with your algorithm, including downtime from internet outages, equipment repairs, and natural disasters. +

    +

    + Live data takes time to travel from the source to your algorithm. The QuantConnect data provider has a latency of 20-50 milliseconds. QuantConnect is not designed for high-frequency trading. +

    + + + +

    Historical Data

    + + +

    + When you + + request historical data + + or run + + warm-up + + , the amount of historical data you can access depends on the resolution of your data subscriptions. The following table shows the amount of trailing historical data you can access for each data resolution: +

    +
    - - - - - -
    - Asset Class + + Resolution - Fee + + Available History
    - Equities - - $0.005/share with a $1 minimum fee -
    - Crypto + Daily - $0 + All historical data
    - Forex + Hour - $0 + All historical data
    - CFDs + Minute - $0 + 1 year
    - Futures + Second - $1.85/contract + 2 months
    - Future Options + Tick - $1.85/contract + 1 month
    + + + +

    Pricing

    + +

    - There is no fee to exercise Option contracts. + The QuantConnect data provider serves Futures data for free.

    + + + +

     

    + +
    +
    +

    QuantConnect

    +

    Future Options

    +
    +
    +

    Introduction

    + +

    - If you set the brokerage model to a model other than the - - DefaultBrokerageModel - - , the new brokerage model defines the order fees. + The QuantConnect data provider provides a stream of Futures Options trades, quotes, and open interest to your trading algorithm during live execution. Live data enables you to make real-time trades and update the value of the securities in your portfolio. +

    + + + +

    Sourcing

    + + +

    + The QuantConnect data provider consolidates Future Options market data across the following markets:

    + + + + +

    Bar Building

    + +

    - To see the fee models that the - - DefaultBrokerageModel - - uses, see - - Fees - - . + We aggregate ticks to build bars. +

    +

    + In live trading, bars are built using the exchange timestamps with microsecond accuracy. This microsecond-by-microsecond processing + of the ticks can mean that the individual bars between live trading and backtesting can have slightly different ticks. As a result, it's possible for a + tick to be counted in different bars between backtesting and live trading, which can lead to bars having slightly different open, high, low, close, and volume values.

    -

    Margin

    +

    Delivery

    - We model - - buying power - - and - - margin calls - - to ensure your algorithm stays within the margin requirements. If you set the brokerage model to a different model, the new brokerage model defines how margin is modeled. If you have more than $25,000 in your brokerage account, you can use the - - PatternDayTradingMarginModel - - to make use of the 4x intraday leverage and 2x overnight leverage available on most brokerages from the - - PDT rule - - . + Most live trading algorithms run on co-located servers racked in Equinix. Co-location reduces several factors that can interfere with your algorithm, including downtime from internet outages, equipment repairs, and natural disasters. +

    +

    + Live data takes time to travel from the source to your algorithm. The QuantConnect data provider has a latency of 20-50 milliseconds. QuantConnect is not designed for high-frequency trading.

    -

    Slippage

    +

    Historical Data

    - Orders through the - - DefaultBrokerageModel - - do not experience slippage in backtests or paper trading. For more information about the slippage model the - - DefaultBrokerageModel - - uses, see - - Slippage + When you + + request historical data - . + or run + + warm-up + + , the amount of historical data you can access depends on the resolution of your data subscriptions. The following table shows the amount of trailing historical data you can access for each data resolution:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Resolution + + Available History +
    + Daily + + All historical data +
    + Hour + + All historical data +
    + Minute + + 1 year +
    + Second + + 2 months +
    + Tick + + 1 month +
    -

    Fills

    +

    Pricing

    - The - - DefaultBrokerageModel - - fills market orders immediately and completely. When available, bid and ask spread will be used for the fill prices. -

    -

    - To view how we model realistic order fills, see - - Fills - - . + The QuantConnect data provider serves Future Options data for free.

    -

    Settlements

    +

     

    + +
    +
    +

    QuantConnect

    +

    Alternative Data

    +
    +
    +

    Introduction

    - If you trade with a margin account, trades settle immediately -

    -

    - To view how we model settlement for paper trades, see - - Settlement - - . + The QuantConnect data provider can stream live alternative data into your algorithms to help you make informed trading decisions.

    -

    Brokerage Models

    +

    Sourcing

    - The QuantConnect Paper Trading brokerage uses the - - DefaultBrokerageModel - - by default, but you can use any of the - - brokerage models + The QuantConnect data provider sources alternative data directly from + + data vendors + + . To view all of the integrated data vendors, see the + + Dataset Market .

    -

    Deposits and Withdraws

    +

    Delivery

    - The QuantConnect Paper Trading brokerage supports deposits and withdraws. + The delivery schedule of alternative data depends on the specific dataset you're using. We inject the data into your algorithms when the vendor provides the data. For most alternative datasets, the data is updated on a daily or hourly basis. Some datasets, like the + + Tiingo News Feed + + or + + Benzinga News Feed + + , include a live stream. In these cases, we deliver the data as a live stream to your algorithm.

    -
    -
    Porfolio.CashBook.Add(AccountCurrency, 100);
    -Porfolio.CashBook.Add("ETH", -1);
    -
    self.Porfolio.CashBook.Add(self.AccountCurrency, 100)
    -self.Porfolio.CashBook.Add("ETH", -1)
    -
    - - - -

    Demo Algorithm

    - -

    - The following algorithm demonstrates the functionality of the - - DefaultBrokerageModel - - : + Most live trading algorithms run on co-located servers racked in Equinix. Co-location reduces several factors that can interfere with your algorithm, including downtime from internet outages, equipment repairs, and natural disasters. +

    +

    + Live data takes time to travel from the source to your algorithm. The latency of the alternative data depends on the specific dataset you're using.

    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -

    Deploy Live Algorithms

    +

    Historical Data

    - -

    - You must have an available - - live trading node - - for each live trading algorithm you deploy. -

    -

    - Follow these steps to deploy a live paper trading algorithm: -

    -
      -
    1. - - Open the project - - that you want to deploy. -
    2. -
    3. - Click the - Deploy live icon - - Deploy Live - - icon. -
    4. -
    5. - On the Deploy Live page, click the - - Brokerage - - field and then click - - Paper Trading - - from the drop-down menu. -
    6. -
    7. - Click the - - Node - - field and then click the live trading node that you want to use from the drop-down menu. -
    8. -
    9. - - (Optional) - - Follow these steps to start the algorithm with existing cash holdings ( - - see video - - ): -
    10. -
        -
      1. - In the - - Algorithm Cash State - - section, click - - Show - - . -
      2. -
      3. - Click - - Add Currency - - . -
      4. -
      5. - Enter the currency ticker (for example, USD or BTC) and a quantity. -
      6. -
      -
    11. - - (Optional) - - Follow these steps to start the algorithm with existing position holdings ( - - see video - - ): -
    12. -
        -
      1. - In the - - Algorithm Holdings State - - section, click - - Show - - . -
      2. -
      3. - Click - - Add Holding - - . -
      4. -
      5. - Enter the symbol ID, symbol, quantity, and average price. -
      6. -
      -
    13. - - (Optional) - - - Set up notifications - - . -
    14. -
    15. - Configure the - - Automatically restart algorithm - - setting. -
    16. -

      - By enabling - - automatic restarts - - , the algorithm will use best efforts to restart the algorithm if it fails due to a runtime error. This can help improve the algorithm's resilience to temporary outages such as a brokerage API disconnection. -

      -
    17. - Click - - Deploy - - . -
    18. -
    +

    - The deployment process can take up to 5 minutes. When the algorithm deploys, the - - live results page + When you + + request historical data - displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings. + or run + + warm-up + + , the amount of historical data you can access depends on the resolution of your data subscriptions. The following table shows the amount of trailing historical data you can access for each data resolution: +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Resolution + + Available History +
    + Daily + + All historical data +
    + Hour + + All historical data +
    + Minute + + 1 year +
    + Second + + 2 months +
    + Tick + + 1 month +
    + + + +

    Pricing

    + + +

    + Refer to the + + Dataset Market + + listings.

     

    - +
    -
    -

    Brokerages

    -

    Binance

    +
    +

    Datasets

    +

    Interactive Brokers

    Introduction

    - QuantConnect enables you to run your algorithms in live mode with real-time market data. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015. -

    -

    - Binance was founded by Changpeng Zhao in 2017 with the goal to "increase the freedom of money globally". Binance provides access to trading Crypto through spot markets and perpetual Futures. They serve clients with no minimum deposit when depositing Crypto. Binance also provides an NFT marketplace, a mining pool, and services to deposit Crypto coins in liquidity pools to earn rewards. + Interactive Brokers (IB) was founded by Thomas Peterffy in 1993 with the goal to "create technology to provide liquidity on better terms. Compete on price, speed, size, diversity of global products and advanced trading tools". IB provides access to trading Equities, ETFs, Options, Futures, Future Options, Forex, Gold, Warrants, Bonds, and Mutual Funds for clients in over + + 200 countries and territories + + with no minimum deposit. IB also provides paper trading, a trading platform, and educational services.

    - To view the implementation of the Binance brokerage integration, see the - - Lean.Brokerages.Binance repository - - . + The Interactive Brokers (IB) data provider streams live asset prices from IB. If you use this data provider and request historical data, the historical data comes from IB.

    -

    Account Types

    +

    Sourcing

    - Binance supports cash and margin accounts for spot trades, but only supports margin accounts for Futures trades. Binance US only supports cash accounts. To set the account type in an algorithm, see the - - Binance brokerage model documentation + The IB data provider sources data directly from IB. For more information about the data source, see the + + Trader Workstation API documentation .

    -

    - Create an Account -

    -

    - Follow the account creation wizard on the - - Binance.com - - or - - Binance.us - - website to create a Binance account. -

    - You will need API credentials to deploy live algorithms with your brokerage account. After you open your account, - - create API credentials - - and store them somewhere safe. As you create credentials, make the following configurations: + If you use the IB data provider, IB only provides the security price data. We provide the following auxiliary datasets from the Dataset Market:

    -

    - Paper Trading -

    -

    - Binance supports paper trading through the Binance Spot Test Network. You don't need a Binance account to create API credentials for the Spot Test Network. -

    -

    - Follow these steps to set up paper trading with the Binance Spot Test Network: -

    -
      -
    1. - Log in to the - - Binance Spot Test Network + + US Equity Security Master - with your GitHub credentials.
    2. - In the - - API Keys - - section, click - - Generate HMAC_SHA256 Key - - . + + US Futures Security Master +
    3. - Enter a description and then click - - Generate - - . + Universe selection datasets
    4. - Store your API key and API key secret somewhere safe. + Non-streaming + + alternative datasets +
    5. -
    -

    - Paper trading Binance Crypto Futures or with Binance US isn't currently available. -

    -

    - Sub-Accounts -

    -

    - Our Binance and Binance US integrations don't support trading with sub-accounts. You must use your main account. -

    + -

    Asset Classes

    +

    Universe Selection

    - Our Binance integration supports trading - - Crypto - - and - - Crypto Futures + + Universe selection - . + is available with the IB data provider.

    -
    AddCrypto("BTCUSDT", Resolution.Minute, Market.Binance);
    -AddCryptoFuture("BTCUSD", Resolution.Minute, Market.Binance);
    -AddCrypto("BTCUSDT", Resolution.Minute, Market.BinanceUS);
    -
    self.AddCrypto("BTCUSDT", Resolution.Minute, Market.Binance)
    -self.AddCryptoFuture("BTCUSD", Resolution.Minute, Market.Binance)
    +
    UniverseSettings.Asynchronous = true;
    +AddUniverse(FundamentalUniverseSelection);
    +
    self.UniverseSettings.Asynchronous = True
    +self.AddUniverse(self.FundamentalUniverseSelection)

    - Our Binance US integration supports trading - - Crypto + The universe selection data comes from our Dataset Market, not the + + TWS market scanners - . + . Universe selection with the IB data provider occurs around 6-7 AM Eastern Time (ET) on Tuesday to Friday and at 2 AM ET on Sunday. Universe selection data isn't available when the IB servers are closed. To check the IB server status, see the + + Current System Status + + page on the IB website.

    -
    -
    AddCrypto("BTCUSDT", Resolution.Minute, Market.BinanceUS);
    -
    self.AddCrypto("BTCUSDT", Resolution.Minute, Market.BinanceUS)
    -

    - If you call the - - SetBrokerageModel - - method with the correct - - BrokerageName - - , then you don't need to pass a - - Market - - argument to the - - AddCrypto - - method because the brokerage model has a - - default market + The IB data provider can stream data for up to 100 assets by default, but IB may let you stream more than 100 assets based on your commissions and equity value. For more information about quotas from IB, see the + + Market Data Pricing Overview + + page on the IB website. If your algorithm adds more than the your quota, LEAN logs an error message from IB. To increase the quota, purchase a Quote Booster from IB. +

    + + + +

    Bar Building

    + + +

    + The data is a summarized snapshot of the trades and quotes at roughly 300 milliseconds per snapshot. +

    + + + +

    Alternative Data

    + + +

    + Third-party data providers support most alternative datasets, except data that streams real-time intraday data. Streaming datasets, like the + + Tiingo News Feed - . + and + + Benzinga News Feed + + , require the QuantConnect data provider. The hybrid QuantConnect-IB data provider supports streaming datasets.

    -

    Data Providers

    +

    Hybrid QuantConnect Data Provider

    - The - - QuantConnect data provider + When you + + deploy a live algorithm with the IB brokerage - provides Crypto data during live trading. + , you can use the QC data provider, the IB data provider, or both. If you use both data providers, Lean gives priority to the QuantConnect data provider. If our data provider doesn't have a stream for the securities you request, Lean uses the IB data provider. This process makes it possible to use our data provider for Equity universe selection and then place Options trades on the securities in the universe. If you use the QC data provider, the assets that you subscribe to don't contribute to the + + IB data limit + + .

    -

    Orders

    +

    Historical Data

    - We model the Binance and Binance US APIs by supporting several order types, supporting order properties, and not supporting order updates. When you deploy live algorithms, you can - - place manual orders + If you get historical data from IB through a + + history request - through the IDE. + or a + + warm-up period + + , the historical data has the following characteristics:

    -

    - Order Types -

    +

    - The following table describes the available order types for each asset class that our Binance and Binance US integrations support: + The following quotas are in place for tick and second resolution historical data:

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Order Type - - Crypto - - Crypto Futures -
    - - MarketOrder - - - green check - - green check -
    - - LimitOrder - - - green check - - green check -
    - - StopLimitOrder - - - green check - -
    - -

    - Order Properties -
    -

    +

    - We model custom order properties from the Binance and Binance US APIs. The following table describes the members of the + In the preceding quotas, - BinanceOrderProperties + TradeBar - object that you can set to customize order execution: + and + + QuoteBar + + data count as separate requests. For example, if you request + + TradeBar + + and + + QuoteBar + + data for SPY, it counts as two requests.

    - - - - - - - - - - - - - - - - - -
    - Property - - Description -
    - - TimeInForce - - - A - - TimeInForce - - instruction to apply to the order. The following instructions are supported: -
      -
    • - - Day - -
    • -
    • - - GoodTilCanceled - -
    • -
    • - - GoodTilDate - -
    • -
    -
    - - PostOnly - - - A flag to signal that the order must only add liquidity to the order book and not take liquidity from the order book. If part of the order results in taking liquidity rather than providing liquidity, the order is rejected without any part of it being filled. -
    -

    - Updates -

    - We model the Binance and Binance US APIs by not supporting order updates, but you can cancel an existing order and then create a new order with the desired arguments. For more information about this workaround, see the - - Workaround for Brokerages That Don’t Support Updates + For more information about historical data from IB, see + + Historical Data Limitations - . + in the IB documentation.

    -

    Fees

    +

    Pricing

    - To view the Binance or Binance US trading fees, see the - - Trading Fees + To use IB data in your algorithms, + + subscribe to IB market data - page on the Binance.com website or the - - Fee Structure + . We support all of the IB data subscriptions that are related to + + the securities and markets we support - page on the Binance.us website. To view how we model their fees, see - - Fees + . Members usually subscribe to the following IB market data: +

    + +

    + To see the latest prices, check the + + Market Data Pricing Overview - . The Binance Spot Test Network does not charge order fees. + page on the IB website. IB can take up to 24 hours to process subscription requests. So after you subscribe to data, you need to wait 24 hours before you can use it in your algorithms. When you subscribe to data, IB only assigns your data subscription to one of your accounts. If you want to assign the subscription to a different account, for example, a paper trading account instead of a live trading account, then contact IB.

    -

    Margin

    +

     

    + +
    +
    +

    Datasets

    +

    Polygon

    +
    +
    +

    Introduction

    - We model - - buying power - - and - - margin calls - - to ensure your algorithm stays within the margin requirements. If you trade Crypto Perpetual Futures, we model the margin cost and payments of your Crypto Future holdings by directly adjusting your portfolio cash. For more information about Futures margin interest modeling, see the - - Binance Futures Model - - . + Polygon was founded by Quinton Pike in 2017 with the goal to "break down the barriers that have traditionally limited access to high-quality financial data for all". Polygon provides institutional-grade Equity, Option, Index, Forex, and Crypto data for business and educational purposes.

    - - - -

    Slippage

    - -

    - Orders through Binance and Binance US do not experience slippage in backtests. In live trading, your orders may experience slippage. + The Polygon data provider streams live asset prices from Polygon. + Instead of using the data from QuantConnect or your brokerage, you can use data from + + Polygon + + if you're deploying a live algorithm and have an API key. + To get an API key, see the + + API Keys + + page on the Polygon website + If you use this data provider and request historical data, the historical data comes from Polygon.

    - To view how we model Binance and Binance US slippage, see - - Slippage + QuantConnect Cloud currently only supported streaming Polygon data during live trading. + To download Polygon for backtesting, research, and optimizations, use the + + CLI .

    -

    Fills

    +

    Supported Datasets

    - We fill market orders immediately and completely in backtests. In live trading, if the quantity of your market - orders exceeds the quantity available at the top of the order book, your orders are filled according to what is - available in the order book. + The Polygon data provider serves asset price data directly from Polygon. Our integration supports securities from the following asset classes:

    +

    - To view how we model Binance and Binance US order fills, see - - Fills + To supplement the asset price data from Polygon, we provide the following auxiliary datasets from the Dataset Market: +

    + +

    + For more information about the Polygon data source, see the + + Polygon API documentation .

    -

    Settlements

    +

    Bar Building

    +

    + Backtesting +

    - Trades settle immediately after the transaction + The Polygon data provider is not currently supported for backtesting in QuantConnect Cloud.

    +

    + Live Trading +

    - To view how we model settlement for Binance and Binance US trades, see - - Settlement - - . + In live trading, the data feed is a stream of asset prices, built into bars and consumed by the algorithm.

    -

    Security and Stability

    +

    Research

    - When you deploy live algorithms with Binance or Binance US, we don't save your brokerage account credentials. + The Polygon data provider is not currently supported for research in QuantConnect Cloud.

    -

    Deposits and Withdraws

    +

    Backtesting

    - You can deposit and withdraw cash from your brokerage account while you run an algorithm that's connected to the - account. We sync the algorithm's cash holdings with the cash holdings in your brokerage account every day at 7:45 AM - Eastern Time (ET). + The Polygon data provider is not currently supported for backtesting in QuantConnect Cloud.

    -

    Demo Algorithm

    +

    Optimization

    - The following algorithm demonstrates the functionality of the Binance and Binance US brokerages: + The Polygon data provider is not currently supported for optimizations in QuantConnect Cloud.

    -

    - Binance -

    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -

    - Binance US -

    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -

    Virtual Pairs

    +

    Live Trading

    - All fiat and Crypto currencies are individual assets. When you buy a pair like BTCUSD, you trade USD for BTC. In this case, LEAN removes some USD from your portfolio - - cashbook - - and adds some BTC. The virtual pair BTCUSD represents your position in that trade, but the virtual pair doesn't actually exist. It simply represents an open trade. When you deploy a live algorithm, LEAN populates your cashbook with the quantity of each currency, but it can't get your position of each virtual pair. + The following sections explain live trading deployment, universe selection, and alternative data when using the Polygon data provider.

    - - - -

    Deploy Live Algorithms

    - - +

    + Deployment +

    You must have an available @@ -18862,18 +18719,18 @@

    Deploy Live Algorithms

    for each live trading algorithm you deploy.

    - Follow these steps to deploy a live algorithm: + Follow these steps to deploy a live trading algorithm that uses the Polygon data provider:

    1. Open the project - you want to deploy. + that you want to deploy.
    2. Click the - Lightning icon + Deploy live icon Deploy Live @@ -18884,130 +18741,69 @@

      Deploy Live Algorithms

      Brokerage - field and then click - - Binance Exchange - - from the drop-down menu. + field and then click your brokerage from the drop-down menu.
    3. - Enter your API key and secret. + Enter the required brokerage authentication information.
    4. - To generate your API credentials, see - - Account Types + For more information about the required information for each brokerage, see the + + Deploy Live Algorithms + + section of your + + brokerage documentation - . Your account details are not saved on QuantConnect. + .

    5. - Click on the - - Environment + In the + + Data Provider - field and then click one of the environments. + section of the deployment wizard, click + + Show + + .
    6. -

      - The following table shows the supported environments: -

      - - - - - - - - - - - - - - - - - -
      - Environment - - Description -
      - Real - - Trade with real money -
      - Demo - - Trade with paper money through the Binance Global brokerage -
      -
    7. Click the - Node - - field and then click the live trading node that you want to use from the drop-down menu. -
    8. -
    9. - If your brokerage account has existing cash holdings, follow these steps ( - - see video - - ): -
    10. -
        -
      1. - In the - - Algorithm Cash State - - section, click - - Show - - . -
      2. -
      3. - Click - - Add Currency - - . -
      4. -
      5. - Enter the currency ticker (for example, USD or CAD) and a quantity. -
      6. -
      + Data Provider 1 + + field and then click + + Polygon + + from the drop-down menu. +
    11. - If your brokerage account has existing position holdings, follow these steps ( + Enter your Polygon API Key. +
    12. + Polygon selected as the data provider in the deployment wizard +
    13. + Click + + Save + + . +
    14. +
    15. + + (Optional) + + If your brokerage supports exisiting - see video + cash - ): + and + + position holdings + + , add them.
    16. -
        -
      1. - In the - - Algorithm Holdings State - - section, click - - Show - - . -
      2. -
      3. - Click - - Add Holding - - . -
      4. -
      5. - Enter the symbol ID, symbol, quantity, and average price. -
      6. -
    17. (Optional) @@ -19039,597 +18835,505 @@

      Deploy Live Algorithms

      .
    +

    + Universe Selection +

    - The deployment process can take up to 5 minutes. When the algorithm deploys, the - - live results page + When you trade live on QuantConnect Cloud with the Polygon data provider, QuantConnect provides the + + universe selection - displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings. + data. +

    +

    + Alternative Data +

    +

    + Third-party data providers support most alternative datasets, except data that streams real-time intraday data. Streaming datasets, like the + + Tiingo News Feed + + and + + Benzinga News Feed + + , require the QuantConnect data provider. +

    + + + +

    Pricing

    + + +

    + To view the prices of the Polygon API packages, see the + + Simple Pricing + + page on the Polygon website.

     

    - +
    -
    -

    Brokerages

    -

    Bitfinex

    +
    +

    Datasets

    +

    Samco

    Introduction

    - QuantConnect enables you to run your algorithms in live mode with real-time market data. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015. -

    -

    - Bitfinex was founded by Giancarlo Devasini and Raphael Nicolle in 2012 with the goal to "give our users the ultimate cryptocurrency trading experience". Bitfinex provides access to trading Crypto for clients outside - - prohibited jurisdictions - - with no minimum deposit to set up an account. If you fund your account with fiat currency, they enforce a - - 10,000 minimum - - for USD, EUR, and GBP. However, if you fund your account with Crypto, they do not enforce a minimum deposit. Bitfinex also provides Crypto staking, a mobile app, and an unrealized profit leaderboard for the traders on the platform. Bitfinex has always been at the forefront of technological innovation in digital asset trading. + Samco was founded by Jimeet Modi in 2015 with a mission of providing retail investors access to sophisticated financial technology that can assist retail investors in creating wealth at a low cost. Samco provides access to India Equities for clients in India with no minimum balance. Samco also provides stock ratings, mutual funds, and a mini-portfolio investment platform.

    - To view the implementation of the Bitfinex brokerage integration, see the - - Lean.Brokerages.Bitfinex repository - - . + The Samco data provider streams live asset prices from Samco. If you use this data provider and request historical data, the historical data comes from Samco.

    -

    Account Types

    +

    Sourcing

    - Bitfinex supports cash and margin accounts. To set the account type in an algorithm, see the - - Bitfinex brokerage model documentation + The Samco data provider sources data directly from Samco. For more information about the data source, see the + + StockNote API documentation .

    - Use - - AccountType.Cash - - to connect to your Exchange wallet or - - AccountType.Margin - - to connect to your Margin wallet. You can not connect to your Funding or Capital Raise wallet. If you provide the wrong - - AccountType - - to the - - SetBrokerageModel - - method, you may connect to an empty wallet, causing Lean to throw a warning. If you have a currency in your wallet that ends with "F0", it will not load into your - - CashBook - - . + If you use the Samco data provider, Samco only provides the security price data. We provide the following auxiliary datasets from the Dataset Market:

    -

    - Create an Account -

    + + + + +

    Universe Selection

    + +

    - Follow the - - account creation wizard - - on the Bitfinex website to create a Bitfinex account. + Universe selection isn't available with the Samco data provider.

    + + + +

    Bar Building

    + +

    - You will need API credentials to deploy live algorithms. After you have an account, - - create API credentials + The Samco data provider consolidates prices and quotes across all of the Indian exchanges. For a complete list of exchange and securities, see the + + ScripMaster - and store them somewhere safe. + file from the StockNote API documentation.

    -

    - Paper Trading -

    + + + +

    Alternative Data

    + +

    - Bitfinex supports paper trading with only the TESTBTCTESTUSD and TESTBTCTESTUSDT securities. Follow these steps to paper trade with Bitfinex: + Third-party data providers support most alternative datasets, except data that streams real-time intraday data. Streaming datasets, like the + + Tiingo News Feed + + and + + Benzinga News Feed + + , require the QuantConnect data provider.

    -
      -
    1. - Create a paper trading sub-account and refill the paper balance For instructions, see - - Paper Trading at Bitfinex - - on the Bitfinex website. -
    2. -
    3. - Create an API key for your sub-account. For instructions, see - - How to create and revoke a Bitfinex API Key - - on the Bitfinex website. -
    4. -
    5. - Use - - AccountType.Cash - - in your algorithms. -
    6. -
    + + + +

    Pricing

    + +

    - To paper trade securities other than TESTBTCTESTUSD and TESTBTCTESTUSDT, follow these steps to simulate paper trading with the QuantConnect Paper Trading brokerage: + The Samco data provider is free. To access it, you just need an active Samco account. +

    + + + +

     

    + +
    +
    +

    Datasets

    +

    Tradier

    +
    +
    +

    Introduction

    + + +

    + Tradier was founded by Dan Raju, Peter Laptewicz, Jason Barry, Jeyashree Chidambaram, and Steve Agalloco in 2012 with the goal to "deliver a choice of low-cost, high-value brokerage services to traders". Tradier provides access to trading Equities and Options for clients in over 250 countries and territories with + + no minimum deposit for cash accounts + + . Tradier also delivers custody, clearing, execution, and billing on behalf of registered advisors. +

    +

    + The Tradier data feeds are streams of Equity and Option prices directly from Tradier. If you use this data feed and request historical data, the historical data comes from Tradier. If you deploy to the demo environment, Tradier doesn't offer streaming market data due to exchange restrictions related to delayed data, so you must use our data feed.

    -
      -
    1. - In the - - Initialize - - method of your algorithm, add one of the preceding - - SetBrokerageModel - - method calls. -
    2. -
    3. - - Deploy your algorithm with the QuantConnect Paper Trading brokerage - - . -
    4. -
    -

    Asset Classes

    +

    Sourcing

    - Our Bitfinex integration supports trading - - Crypto + The Tradier data feed comes directly from Tradier. For more information about the data source, see the + + Tradier API documentation .

    -
    -
    AddCrypto("BTCUSDT", Resolution.Minute, Market.Bitfinex);
    -
    self.AddCrypto("BTCUSDT", Resolution.Minute, Market.Bitfinex)
    -

    - If you call the - - SetBrokerageModel - - method with the correct - - BrokerageName - - , then you don't need to pass a - - Market - - argument to the - - AddCrypto - - method because the brokerage model has a - - default market - - . + If you use the Tradier data feed, Tradier only provides the security price data. We provide the following auxiliary datasets from the Dataset Market:

    + -

    Data Providers

    +

    Universe Selection

    - The - - QuantConnect data provider + + Universe selection - provides Crypto data during live trading. + is available with the Tradier data provider.

    +
    +
    UniverseSettings.Asynchronous = true;
    +AddUniverse(FundamentalUniverseSelection);
    +
    self.UniverseSettings.Asynchronous = True
    +self.AddUniverse(self.FundamentalUniverseSelection)
    +
    -

    Orders

    +

    Bar Building

    - We model the Bitfinex API by supporting several order types, order properties, and order updates. When you deploy live algorithms, you can - - place manual orders - - through the IDE. -

    -

    - Order Types -

    -

    - The following table describes the available order types for each asset class that our Bitfinex integration supports: -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Order Type - - Crypto -
    - - MarketOrder - - - green check -
    - - LimitOrder - - - green check -
    - - LimitIfTouchedOrder - - - green check -
    - - StopMarketOrder - - - green check -
    - - StopLimitOrder - - - green check -
    - - MarketOnOpenOrder - - - green check -
    - - MarketOnCloseOrder - - - green check -
    - -

    - Order Properties -

    -

    - We model custom order properties from the Bitfinex API. The following table describes the members of the - - BitfinexOrderProperties - - object that you can set to customize order execution: -

    - - - - - - - - - - - - - - - - - - - - - -
    - Property - - Description -
    - - TimeInForce - - - A - - TimeInForce - - instruction to apply to the order. The following instructions are supported: -
      -
    • - - Day - -
    • -
    • - - GoodTilCanceled - -
    • -
    • - - GoodTilDate - -
    • -
    -
    - - Hidden - - - A flag to signal that the order should be hidden. Hidden orders do not appear in the order book, so they do not influence other market participants. Hidden orders incur the taker fee. -
    - - PostOnly - - - A flag to signal that the order must only add liquidity to the order book and not take liquidity from the order book. If part of the order results in taking liquidity rather than providing liquidity, the order is rejected without any part of it being filled. -
    -

    - Updates -

    -

    - We model the Bitfinex API by supporting - - order updates - - . + The data feed is a stream of asset prices collected by WebSockets and distributed to algorithms on the platform.

    -

    Fees

    +

    Alternative Data

    - To view the Bitfinex trading fees, see the - - Fees Schedule + Third-party data providers support most alternative datasets, except data that streams real-time intraday data. Streaming datasets, like the + + Tiingo News Feed - page on the Bitfinex website. To view how we model their fees, see - - Fees + and + + Benzinga News Feed - . -

    -

    - To use the Bitfinex brokerage in a live algorithm, the following table shows the fee settings you need on your - - Account > Fees - - page on the Bitfinex website: + , require the QuantConnect data provider.

    - - - - - - - - - - - - - - - - - -
    - Fee Setting - - Value -
    - Default currency for fees - - USD -
    - Fee type for Exchange orders - - Currency Exchange Fee -
    -

    Margin

    +

    Pricing

    - We model - - buying power - - and - - margin calls + The Tradier data feed is free for Tradier subscription accounts. If you have a free Tradier account, you may have to pay inactivity and maintenance fees. If you have less than $2,000 in total account value and less than 2 executed trades in 1 year, the inactivity fee is $50. If you have less than 2 executed trades per month, the international account monthly maintenance fee is $20. To view the latest prices, see the + + Pricing - to ensure your algorithm stays within the margin requirements. + page on the Tradier website.

    -

    Slippage

    +

     

    + +
    +
    +

    Datasets

    +

    Zerodha

    +
    +
    +

    Introduction

    - Orders through Bitfinex do not experience slippage in backtests. In paper trading and live trading, your orders may experience slippage. + Zerodha was founded by Nithin Kamath in 2010 with the goal to break all barriers that traders and investors face in India in terms of cost, support, and technology. Zerodha provides access to India Equities for clients in India with no minimum balance required. Zerodha also provides a mutual fund investment platform and an interactive portfolio dashboard.

    - To view how we model Bitfinex slippage, see - - Slippage - - . + The Zerodha data feed streams live asset prices from Zerodha. If you use this data feed and request historical data, the historical data comes from Zerodha.

    -

    Fills

    +

    Sourcing

    - We fill market orders immediately and completely in backtests. In live trading, if the quantity of your market - orders exceeds the quantity available at the top of the order book, your orders are filled according to what is - available in the order book. -

    -

    - To view how we model Bitfinex order fills, see - - Fills + The Zerodha data feed comes directly from Zerodha. For more information about the data source, see the + + Kite Connect API documentation .

    +

    + If you use the Zerodha data feed, Zerodha only provides the security price data. We provide the following auxiliary datasets from the Dataset Market: +

    + -

    Settlements

    +

    Universe Selection

    - Trades settle immediately after the transaction -

    -

    - To view how we model settlement for Bitfinex trades, see - - Settlement - - . + Universe selection isn't available with the Zerodha data feed.

    -

    Security and Stability

    +

    Bar Building

    - Note the following security and stability aspects of our Bitfinex integration. -

    -

    - Account Credentials -

    -

    - When you deploy live algorithms with Bitfinex, we don't save your brokerage account credentials. + The data feed consolidates prices and quotes across all of the Indian exchanges.

    -

    - API Outages -

    + + + +

    Alternative Data

    + +

    - We call the Bitfinex API to place live trades. Sometimes the API may be down. Check the - - Bitfinex status page + Third-party data providers support most alternative datasets, except data that streams real-time intraday data. Streaming datasets, like the + + Tiingo News Feed - to see if the API is currently working. + and + + Benzinga News Feed + + , require the QuantConnect data provider.

    -

    Deposits and Withdraws

    +

    Pricing

    - You can deposit and withdraw cash from your brokerage account while you run an algorithm that's connected to the - account. We sync the algorithm's cash holdings with the cash holdings in your brokerage account every day at 7:45 AM - Eastern Time (ET). + The Zerodha data feed costs ₹2000/month for retail users. To view the latest prices, see the + + What are the charges for KITE APIs? + + page on the Zerodha website.

    -

    Demo Algorithm

    +

     

    + +
    +
    +

    Live Trading

    + +
    +
    + + +
    +
    +

    + A live algorithm is an algorithm that trades in real-time with real market data. QuantConnect enables you to run your algorithms in live mode with real-time market data. Deploy your algorithms using QuantConnect because our infrastructure is battle-tested. We have successfully hosted more than 200,000 live algorithms and have had more than $15B in volume traded on our servers since 2015. The algorithms that our members create are run on co-located servers and the trading infrastructure is maintained at all times by our team of engineers. It's common for members to achieve 6-months of uptime with no interruptions. +

    +
    + + +
    + + + +

     

    + +
    +
    +

    Live Trading

    +

    Getting Started

    +
    +
    -

    - The following algorithm demonstrates the functionality of the Bitfinex brokerage: -

    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    - -
    +
    + +
    +
    -

    Virtual Pairs

    +

    Introduction

    - All fiat and Crypto currencies are individual assets. When you buy a pair like BTCUSD, you trade USD for BTC. In this case, LEAN removes some USD from your portfolio - - cashbook - - and adds some BTC. The virtual pair BTCUSD represents your position in that trade, but the virtual pair doesn't actually exist. It simply represents an open trade. When you deploy a live algorithm, LEAN populates your cashbook with the quantity of each currency, but it can't get your position of each virtual pair. + A live algorithm is an algorithm that trades in real-time with real market data. QuantConnect enables you to run your algorithms in live mode with real-time market data. Deploy your algorithms using QuantConnect because our infrastructure is battle-tested. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015. The algorithms that our members create are run on co-located servers and the trading infrastructure is maintained at all times by our team of engineers. It's common for members to achieve 6-months of uptime with no interruptions.

    @@ -19637,6 +19341,10 @@

    Virtual Pairs

    Deploy Live Algorithms

    +

    + The following video demonstrates how to deploy live paper trading algorithms: +

    + Deploy a live algorithm

    You must have an available @@ -19645,33 +19353,18 @@

    Deploy Live Algorithms

    for each live trading algorithm you deploy.

    - Follow these steps to deploy a live algorithm: + Follow these steps to deploy a live paper trading algorithm:

    1. Open the project - you want to deploy. + that you want to deploy.
    2. -

      - If you are deploying a paper trading algorithm without the QuantConnect Paper Trading brokerage, include the following lines of code in the - - Initialize - - method of your algorithm: -

      -
      -
      self.SetAccountCurrency('TESTUSD') # or 'TESTUSDT'
      -self.SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Cash)
      -self.SetBenchmark(lambda x: 0) # or the Symbol of the TESTBTCTESTUSD/TESTBTCTESTUSDT securities
      -
      SetAccountCurrency("TESTUSD"); // or "TESTUSDT"
      -SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Cash);
      -SetBenchmark(x => 0); // or the Symbol of the TESTBTCTESTUSD/TESTBTCTESTUSDT securities
      -
    3. Click the - Lightning icon + Deploy live icon Deploy Live @@ -19684,20 +19377,10 @@

      Deploy Live Algorithms

      field and then click - Bitfinex Exchange + Paper Trading from the drop-down menu.
    4. -
    5. - Enter your API key and secret. -
    6. -

      - To generate your API credentials, see - - Account Types - - . Your account details are not saved on QuantConnect. -

    7. Click the @@ -19705,6 +19388,72 @@

      Deploy Live Algorithms

      field and then click the live trading node that you want to use from the drop-down menu.
    8. +
    9. + + (Optional) + + Follow these steps to start the algorithm with existing cash holdings ( + + see video + + ): +
    10. +
        +
      1. + In the + + Algorithm Cash State + + section, click + + Show + + . +
      2. +
      3. + Click + + Add Currency + + . +
      4. +
      5. + Enter the currency ticker (for example, USD or BTC) and a quantity. +
      6. +
      +
    11. + + (Optional) + + Follow these steps to start the algorithm with existing position holdings ( + + see video + + ): +
    12. +
        +
      1. + In the + + Algorithm Holdings State + + section, click + + Show + + . +
      2. +
      3. + Click + + Add Holding + + . +
      4. +
      5. + Enter the symbol ID, symbol, quantity, and average price. +
      6. +
    13. (Optional) @@ -19738,938 +19487,988 @@

      Deploy Live Algorithms

    The deployment process can take up to 5 minutes. When the algorithm deploys, the - + live results page displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings.

    - - - -

     

    - -
    -
    -

    Brokerages

    -

    Bybit

    -
    -
    -

    Introduction

    - - -

    - QuantConnect enables you to run your algorithms in live mode with real-time market data. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015. -

    -

    - Bybit was co-founded by Ben Zhou in March 2018 with the goal to offer a professional platform where Crypto traders can find an ultra-fast matching engine, excellent customer service, and multilingual community support. Bybit provides access to trading Crypto and Crypto Futures for clients outside of - - excluded jurisdictions - - with low minimum deposits to set up an account. For more information about - - Crypto - - and - - fiat deposits - - , see the Bybit documentation. Bybit also provides Crypto staking, initial DEX offerings, and community airdrops. -

    - To view the implementation of the Bybit brokerage integration, see the - - Lean.Brokerages.Bybit repository + To deploy a live algorithm with a different brokerage, see the + + Deploy Live Algorithms + + section of the + + brokerage integration documentation .

    -

    Account Types

    +

    Stop Live Algorithms

    - Bybit supports cash and margin accounts. To set the account type in an algorithm, see the - - Bybit brokerage model documentation - - . + The live trading results page has a + + Stop + + button to immediately stop your algorithm from executing. +When you stop a live algorithm, your portfolio holdings are retained. Stop your algorithm if you want to perform any of the following actions:

    -

    - Create an Account -

    -

    - Follow the - - How to Register an Account - - tutorial on the Bybit website to create a Bybit account. +

      +
    • + Update your project's code files +
    • +
    • + Upgrade the + + live trading node + +
    • +
    • + Update the settings you entered into the deployment wizard +
    • +
    • + Place manual orders through your brokerage account instead of the web IDE +
    • +
    +

    + Furthermore, if you receive new securities in your portfolio because of a reverse merger, you also need to stop and redeploy the algorithm.

    - You will need API credentials to deploy live algorithms. After you have an account, - - create API credentials - - and store them somewhere safe. + LEAN actively terminates live algorithms when it detects interference outside of the algorithm's control to avoid conflicting race conditions between the owner of the account and the algorithm, so avoid manipulating your brokerage account and placing manual orders on your brokerage account while your algorithm is running. If you need to adjust your brokerage account holdings, stop the algorithm, manually place your trades, and then redeploy the algorithm.

    -

    - Paper Trading -

    - Our integration doesn't support paper trading through the Bybit Demo Trading environment, but you can follow these steps to simulate it: + Follow these steps to stop your algorithm:

    1. - In the - - Initialize - - method of your algorithm, set the Bybit brokerage model. + Open your algorithm's + + live results page + + .
    2. - - Deploy your algorithm with the QuantConnect Paper Trading brokerage - + Click + + Stop + .
    3. +
    4. + Click + + Stop + + again. +
    -

    Asset Classes

    - - -

    - Our Bybit integration supports trading - - Crypto - - and - - Crypto Futures - - . -

    - - - -

    Data Providers

    - - -

    - The - - QuantConnect data provider - - provides Crypto data during live trading. -

    - - - -

    Orders

    +

    Liquidate Live Algorithms

    - We model the Bybit API by supporting several order types, order properties, and order updates. When you deploy live algorithms, you can - - place manual orders - - through the IDE. -

    -

    - Order Types -

    -

    - The following table describes the available order types for each asset class that our Bybit integration supports: -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Order Type - - Crypto - - Crypto Futures -
    - - MarketOrder - - - green check - - green check -
    - - LimitOrder - - - green check - - green check -
    - - StopMarketOrder - - - green check - - green check -
    - - StopLimitOrder - - - green check - - green check -
    - -

    - Order Properties -

    -

    - We model custom order properties from the Bybit API. The following table describes the members of the - - BybitBrokerageModel - - object that you can set to customize order execution: + The live results page has a + + Liquidate + + button that acts as a "kill switch" to sell all of your portfolio holdings. If your algorithm has a bug in it that caused it to purchase a lot of securities that you didn't want, this button let's you easily liquidate your portfolio instead of placing many manual trades. When you click the + + Liquidate + + button, if the market is open for an asset you hold, the algorithm liquidates it with market orders. If the market is not open, the algorithm places market on open orders. After the algorithm submits the liquidation orders, it stops executing.

    - - - - - - - - - - - - - - - - - - - - - -
    - Property - - Description -
    - - TimeInForce - - - A - - TimeInForce - - instruction to apply to the order. The following instructions are supported: -
      -
    • - - Day - -
    • -
    • - - GoodTilCanceled - -
    • -
    • - - GoodTilDate - -
    • -
    -
    - - PostOnly - - - A flag to signal that the order must only add liquidity to the order book and not take liquidity from the order book. If part of the order results in taking liquidity rather than providing liquidity, the order is rejected without any part of it being filled. This order property is only available for limit orders. -
    - - ReduceOnly - - - A flag to signal that the order must only reduce your current position size. For more information about this order property, see - - Reduce-Only Order - - on the Bybit website. -
    -

    - Updates -

    - We model the Bybit API by supporting - - order updates - - for Crypto Future assets that have one of the following - - order states - - : + Follow these steps to liquidate your positions:

    -
      -
    • - - OrderStatus.New - -
    • +
      1. - - OrderStatus.PartiallyFilled - + Open your algorithm's + + live results page + + .
      2. - - OrderStatus.Submitted - + Click + + Liquidate + + .
      3. - - OrderStatus.UpdateSubmitted - + Click + + Liquidate + + again.
      4. -
    -

    - In cases where you can't update an order, you can cancel the existing order and then create a new order with the desired arguments. For more information about this workaround, see the - - Workaround for Brokerages That Don’t Support Updates - - . -

    + -

    Fees

    +

    On-Premise Live Algorithms

    - To view the Bybit trading fees, see the - - Trading Fees Schedule + For information about on-premise live trading with + + Local Platform - page on the Bybit website. To view how we model their fees, see - - Fees + , see + + Getting Started .

    -

    Margin

    +

     

    + +
    +
    +

    Live Trading

    +

    Brokerages

    +
    +
    -

    - We model - - buying power - - and - - margin calls - - to ensure your algorithm stays within the margin requirements. -

    +
    +
    +

    + Brokerages supply a connection to the exchanges so that you can automate orders using LEAN. +

    +
    + + +
    -

    Slippage

    +

     

    + +
    +
    +

    Brokerages

    +

    QuantConnect Paper Trading

    +
    +
    +

    Introduction

    - Orders through Bybit do not experience slippage in backtests. In paper trading and live trading, your orders may experience slippage. + QuantConnect enables you to run your algorithms in live mode with real-time market data. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015.

    - To view how we model Bybit slippage, see - - Slippage + QuantConnect Paper Trading lets you run + + live, real-time data - . -

    - - - -

    Fills

    - - -

    - We fill market orders immediately and completely in backtests. In live trading, if the quantity of your market - orders exceeds the quantity available at the top of the order book, your orders are filled according to what is - available in the order book. + into your algorithm but execute trades using fictional capital. Instead of your orders being routed to an exchange when you're paper trading, your order fills are simulated. Use paper trading to test your algorithm without risking real money and to ensure your backtest wasn't overfit before deploying with real money. You can use the paper trading brokerage without needing to sign up for a real brokerage account. If you don't set a brokerage model in your algorithm with the + + SetBrokerageModel + + method, the paper trading brokerage uses the + + DefaultBrokerageModel + + to simulate trades.

    - To view how we model Bybit order fills, see - - Fills + To view the implementation of the QuantConnect Paper Trading brokerage, see + + PaperBrokerage.cs - . + in the LEAN GitHub repository. To view the implementation of the backtesting brokerage, see + + BacktestingBrokerage.cs + + in the LEAN GitHub repository.

    -

    Settlements

    +

    Account Types

    - Trades settle immediately after the transaction -

    -

    - To view how we model settlement for Bybit trades, see - - Settlement + The QuantConnect Paper Trading brokerage supports cash and margin accounts. To set the account type in an algorithm, see the + + paper trading brokerage model documentation .

    - - - -

    Security and Stability

    - - -

    - When you deploy live algorithms with Bybit, we don't save your brokerage account credentials. -

    - - - -

    Deposits and Withdraws

    - - -

    - You can deposit and withdraw cash from your brokerage account while you run an algorithm that's connected to the - account. We sync the algorithm's cash holdings with the cash holdings in your brokerage account every day at 7:45 AM - Eastern Time (ET). -

    - - - -

    Demo Algorithm

    - - -

    - The following algorithm demonstrates the functionality of the Bybit brokerage: -

    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    - - - -

    Virtual Pairs

    - -

    - All fiat and Crypto currencies are individual assets. When you buy a pair like BTCUSD, you trade USD for BTC. In this case, LEAN removes some USD from your portfolio - - cashbook - - and adds some BTC. The virtual pair BTCUSD represents your position in that trade, but the virtual pair doesn't actually exist. It simply represents an open trade. When you deploy a live algorithm, LEAN populates your cashbook with the quantity of each currency, but it can't get your position of each virtual pair. + If you pass a different + + BrokerageName + + to the + + SetBrokerageModel + + method, the new brokerage model defines the account types that are available.

    -

    Deploy Live Algorithms

    +

    Asset Classes

    - You must have an available - - live trading node - - for each live trading algorithm you deploy. -

    -

    - Follow these steps to deploy a live algorithm: + The QuantConnect Paper Trading brokerage supports the following asset classes:

    -
      +
      • - - Open the project + + US Equities - you want to deploy. -
      • -
      • - Click the - Lightning icon - - Deploy Live - - icon. -
      • -
      • - On the Deploy Live page, click the - - Brokerage - - field and then click - - Bybit Exchange - - from the drop-down menu. -
      • -
      • - Enter your API key and secret.
      • -

        - To generate your API credentials, see - - Account Types - - . Your account details are not saved on QuantConnect. -

      • - Click the - - VIP Level - - field and then click your level from the drop-down menu. -
      • -

        - For more information about VIP levels, see - - FAQ — Bybit VIP Program + + Crypto - on the Bybit website. -

        -
      • - Click the - - Node - - field and then click the live trading node that you want to use from the drop-down menu.
      • - If your brokerage account has existing position holdings, follow these steps ( - - see video + + Forex - ):
      • -
          -
        1. - In the - - Algorithm Holdings State - - section, click - - Show - - . -
        2. -
        3. - Click - - Add Holding - - . -
        4. -
        5. - Enter the symbol ID, symbol, quantity, and average price. -
        6. -
      • - - (Optional) - - - Set up notifications + + CFD - .
      • - Configure the - - Automatically restart algorithm - - setting. -
      • -

        - By enabling - - automatic restarts + + Futures - , the algorithm will use best efforts to restart the algorithm if it fails due to a runtime error. This can help improve the algorithm's resilience to temporary outages such as a brokerage API disconnection. -

        +
      • - Click - - Deploy - - . + + Future Options +
      • -
    +

    - The deployment process can take up to 5 minutes. When the algorithm deploys, the - - live results page + If you set the + + brokerage model - displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings. + to a model other than the + + DefaultBrokerageModel + + , the new brokerage model defines the asset classes you can trade.

    -

     

    - -
    -
    -

    Brokerages

    -

    Coinbase

    -
    -
    -

    Introduction

    +

    Data Feeds

    - QuantConnect enables you to run your algorithms in live mode with real-time market data. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015. -

    -

    - Coinbase was founded by Brian Armstrong and Fred Ehrsam in 2012 with the goal to "increase economic freedom in the world". Coinbase provides access to trading Crypto for clients in over - - 100 countries - - with no minimum deposit. Coinbase also provides a self-hosted Crypto wallet, a Visa debit rewards card, and Bitcoin collateral-backed lines of credit. -

    -

    - To view the implementation of the Coinbase brokerage integration, see the - - Lean.Brokerages.Coinbase repository + We can only provide paper trading on the assets for which we have a + + live data provider .

    -

    Account Types

    +

    Orders

    - Coinbase supports cash accounts. To set the account type in an algorithm, see the - - Coinbase brokerage model documentation - - . + The following sections describe how the + + DefaultBrokerageModel + + handles orders. If you set the brokerage model to a different model, the new brokerage model defines how orders are handled. +

    +

    + Order Types +

    +

    + The following table describes the available order types for each asset class that the + + DefaultBrokerageModel + + supports:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Order Type + + US Equity + + Crypto + + Crypto Futures + + Forex + + CFD + + Futures + + Futures Options +
    + + MarketOrder + + + green check + + green check + + green check + + green check + + green check + + green check + + green check +
    + + LimitOrder + + + green check + + green check + + green check + + green check + + green check + + green check + + green check +
    + + LimitIfTouchedOrder + + + green check + + green check + + green check + + green check + + green check + + green check + + green check +
    + + StopMarketOrder + + + green check + + green check + + green check + + green check + + green check + + green check + + green check +
    + + StopLimitOrder + + + green check + + green check + + green check + + green check + + green check + + green check + + green check +
    + + MarketOnOpenOrder + + + green check + + green check + + + green check + + green check + + +
    + + MarketOnCloseOrder + + + green check + + green check + + + green check + + green check + + green check + + green check +
    + + ComboMarketOrder + + + + + + + + + green check +
    + + ComboLimitOrder + + + + + + + + + green check +
    + + ComboLegLimitOrder + + + + + + + + + green check +
    + + ExerciseOption + + + + + + + + + green check +
    +

    - Create an Account + Time In Force

    - Follow the - - Create a Coinbase account - - tutorial on the Coinbase website to create an account. -

    -

    - You will need API credentials to deploy live algorithms. After you have an account, - - create API credentials + The + + DefaultBrokerageModel + + supports the following + + TimeInForce - and store them somewhere safe. As you create credentials, enable - - View - - and - - Trade - - permissions. -

    -

    - Paper Trading -

    -

    - The Coinbase brokerage doesn't support paper trading, but you can follow these steps to simulate it: + instructions:

    -
      +
    - - - -

    Asset Classes

    - - -

    - Our Coinbase integration supports trading - - Crypto - - . -

    -
    -
    AddCrypto("BTCUSD", Resolution.Minute, Market.Coinbase);
    -
    self.AddCrypto("BTCUSD", Resolution.Minute, Market.Coinbase)
    -
    + +

    + Updates +

    - If you call the - - SetBrokerageModel - - method with the correct - - BrokerageName - - , then you don't need to pass a - - Market - - argument to the + The - AddCrypto + DefaultBrokerageModel - method because the brokerage model has a - - default market + supports + + order updates .

    - - - -

    Data Providers

    - - +

    + Handling Splits +

    - The - - QuantConnect data provider + If you're using raw + + data normalization - provides Crypto data during live trading. + and you have active orders with a limit, stop, or trigger price in the market for a US Equity when a + + stock split + + occurs, the following properties of your orders automatically adjust to reflect the stock split:

    +
      +
    • + Quantity +
    • +
    • + Limit price +
    • +
    • + Stop price +
    • +
    • + Trigger price +
    • +
    -

    Orders

    +

    Fees

    - We model the Coinbase API by supporting several order types, supporting order properties, and not supporting order updates. When you deploy live algorithms, you can - - place manual orders - - through the IDE. -

    -

    - Order Types -

    -

    - The following table describes the available order types for each asset class that our Coinbase integration supports: + The following table shows the fees that the + + DefaultBrokerageModel + + charges for each of the supported asset classes:

    - +
    - - - -
    - Order Type + + Asset Class - Crypto + + Fee
    - - MarketOrder - + Equities - green check + $0.005/share with a $1 minimum fee
    - - LimitOrder - + Crypto - green check + $0
    - - StopMarketOrder - + Forex - green check + $0
    - - StopLimitOrder - + CFDs - green check + $0
    - -

    - Order Properties -

    -

    - We model custom order properties from the Coinbase API. The following table describes the members of the - - CoinbaseOrderProperties - - object that you can set to customize order execution: -

    - - - - - - - -
    - Property - - Description -
    - - TimeInForce - + Futures - A - - TimeInForce - - instruction to apply to the order. The - - GoodTilCanceled - - - TimeInForce - - is supported. + $1.85/contract
    - - PostOnly - + Future Options - A flag that signals the order must only add liquidity to the order book and not take liquidity from the order book. If part of the order results in taking liquidity rather than providing liquidity, the order is rejected without any part of it being filled. + $1.85/contract
    -

    - Updates -

    - We model the Coinbase API by not supporting order updates, but you can cancel an existing order and then create a new order with the desired arguments. For more information about this workaround, see the - - Workaround for Brokerages That Don’t Support Updates - - . + There is no fee to exercise Option contracts.

    - - - -

    Fees

    - -

    - To view the Coinbase trading fees, see the - - What are the fees on Coinbase? - - page on the Coinbase website. To view how we model their fees, see - + If you set the brokerage model to a model other than the + + DefaultBrokerageModel + + , the new brokerage model defines the order fees. +

    +

    + To see the fee models that the + + DefaultBrokerageModel + + uses, see + Fees . @@ -20681,7 +20480,23 @@

    Margin

    - Coinbase doesn't support margin trading. + We model + + buying power + + and + + margin calls + + to ensure your algorithm stays within the margin requirements. If you set the brokerage model to a different model, the new brokerage model defines how margin is modeled. If you have more than $25,000 in your brokerage account, you can use the + + PatternDayTradingMarginModel + + to make use of the 4x intraday leverage and 2x overnight leverage available on most brokerages from the + + PDT rule + + .

    @@ -20690,11 +20505,16 @@

    Slippage

    - Orders through Coinbase do not experience slippage in backtests. In paper trading and live trading, your orders may experience slippage. -

    -

    - To view how we model Coinbase slippage, see - + Orders through the + + DefaultBrokerageModel + + do not experience slippage in backtests or paper trading. For more information about the slippage model the + + DefaultBrokerageModel + + uses, see + Slippage . @@ -20706,13 +20526,15 @@

    Fills

    - We fill market orders immediately and completely in backtests. In live trading, if the quantity of your market - orders exceeds the quantity available at the top of the order book, your orders are filled according to what is - available in the order book. + The + + DefaultBrokerageModel + + fills market orders immediately and completely. When available, bid and ask spread will be used for the fill prices.

    - To view how we model Coinbase order fills, see - + To view how we model realistic order fills, see + Fills . @@ -20724,11 +20546,11 @@

    Settlements

    - Trades settle immediately after the transaction + If you trade with a margin account, trades settle immediately

    - To view how we model settlement for Coinbase trades, see - + To view how we model settlement for paper trades, see + Settlement . @@ -20736,27 +20558,19 @@

    Settlements

    -

    Security and Stability

    +

    Brokerage Models

    - Note the following security and stability aspects of our Coinbase integration. -

    -

    - Account Credentials -

    -

    - When you deploy live algorithms with Coinbase, we don't save your brokerage account credentials. -

    -

    - API Outages -

    -

    - We call the Coinbase API to place live trades. Sometimes the API may be down. Check the - - Coinbase status page + The QuantConnect Paper Trading brokerage uses the + + DefaultBrokerageModel + + by default, but you can use any of the + + brokerage models - to see if the API is currently working. + .

    @@ -20765,10 +20579,14 @@

    Deposits and Withdraws

    - You can deposit and withdraw cash from your brokerage account while you run an algorithm that's connected to the - account. We sync the algorithm's cash holdings with the cash holdings in your brokerage account every day at 7:45 AM - Eastern Time (ET). + The QuantConnect Paper Trading brokerage supports deposits and withdraws.

    +
    +
    Porfolio.CashBook.Add(AccountCurrency, 100);
    +Porfolio.CashBook.Add("ETH", -1);
    +
    self.Porfolio.CashBook.Add(self.AccountCurrency, 100)
    +self.Porfolio.CashBook.Add("ETH", -1)
    +
    @@ -20776,14 +20594,18 @@

    Demo Algorithm

    - The following algorithm demonstrates the functionality of the Coinbase brokerage: + The following algorithm demonstrates the functionality of the + + DefaultBrokerageModel + + :

    -
    @@ -20793,7 +20615,7 @@

    Demo Algorithm

    -
    @@ -20801,19 +20623,6 @@

    Demo Algorithm

    -

    Virtual Pairs

    - - -

    - All fiat and Crypto currencies are individual assets. When you buy a pair like BTCUSD, you trade USD for BTC. In this case, LEAN removes some USD from your portfolio - - cashbook - - and adds some BTC. The virtual pair BTCUSD represents your position in that trade, but the virtual pair doesn't actually exist. It simply represents an open trade. When you deploy a live algorithm, LEAN populates your cashbook with the quantity of each currency, but it can't get your position of each virtual pair. -

    - - -

    Deploy Live Algorithms

    @@ -20825,18 +20634,18 @@

    Deploy Live Algorithms

    for each live trading algorithm you deploy.

    - Follow these steps to deploy a live algorithm: + Follow these steps to deploy a live paper trading algorithm:

    1. Open the project - you want to deploy. + that you want to deploy.
    2. Click the - Lightning icon + Deploy live icon Deploy Live @@ -20849,24 +20658,10 @@

      Deploy Live Algorithms

      field and then click - Coinbase + Paper Trading from the drop-down menu.
    3. -
    4. - Enter your Coinbase API key and API secret. -
    5. -

      - To generate your API credentials, see the - - Create an Account - - section in the - - Account Types - - documentation. Your account details are not saved on QuantConnect. -

    6. Click the @@ -20875,7 +20670,43 @@

      Deploy Live Algorithms

      field and then click the live trading node that you want to use from the drop-down menu.
    7. - If your brokerage account has existing position holdings, follow these steps ( + + (Optional) + + Follow these steps to start the algorithm with existing cash holdings ( + + see video + + ): +
    8. +
        +
      1. + In the + + Algorithm Cash State + + section, click + + Show + + . +
      2. +
      3. + Click + + Add Currency + + . +
      4. +
      5. + Enter the currency ticker (for example, USD or BTC) and a quantity. +
      6. +
      +
    9. + + (Optional) + + Follow these steps to start the algorithm with existing position holdings ( see video @@ -20937,7 +20768,7 @@

      Deploy Live Algorithms

    The deployment process can take up to 5 minutes. When the algorithm deploys, the - + live results page displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings. @@ -20945,660 +20776,239 @@

    Deploy Live Algorithms

    -

     

    - -
    -
    -

    Brokerages

    -

    Interactive Brokers

    -
    -
    -

    Introduction

    - - -

    - QuantConnect enables you to run your algorithms in live mode with real-time market data. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015. -

    -

    - Interactive Brokers (IB) was founded by Thomas Peterffy in 1993 with the goal to "create technology to provide liquidity on better terms. Compete on price, speed, size, diversity of global products and advanced trading tools". IB provides access to trading Equities, ETFs, Options, Futures, Future Options, Forex, Gold, Warrants, Bonds, and Mutual Funds for clients in over - - 200 countries and territories - - with no minimum deposit. IB also provides paper trading, a trading platform, and educational services. -

    -

    - To view the implementation of the IB brokerage integration, see the - - Lean.Brokerages.InteractiveBrokers repository - - . -

    - - - -

    Account Types

    - - -

    - The IB API does not support the IBKR LITE plan. You need an IBKR PRO plan. Individual and Financial Advisor (FA) accounts are available. -

    -

    - Individual Accounts -

    -

    - IB supports cash and margin accounts. To set the account type in an algorithm, see the - - IB brokerage model documentation - - . -

    -

    - FA Accounts -

    -

    - IB supports FA accounts for Trading Firm and Institution organizations. FA accounts enable certified professionals to use a single trading algorithm to manage several client accounts. If your account code starts with F, FA, or I, then you have an FA account. For more information about FA accounts, see - - Financial Advisors - - . -

    -

    - Create an Account -

    -

    - You need to open an IBKR Pro account to deploy algorithms with IB. The IB API does not support IBKR Lite accounts. To create an IB account, see the - - Open an Account - - page on the IB website. -

    -

    - You need to activate IBKR Mobile Authentication (IB Key) to deploy live algorithms with your brokerage account. After you open your account, follow the - - installation and activation instructions - - on the IB website. -

    -

    - Paper Trading -

    -

    - IB supports paper trading. Follow the - - Opening a Paper Trading Account - - page in the IB documentation to set up your paper trading account. -

    -

    - If you want to use - - IB market data - - and trade with your paper trading account, follow these steps: -

    -
      -
    1. - Log in to the IB Client Portal. -
    2. -
    3. - In the top-right corner, click the - - person - - icon and then click - - Settings - - . -
    4. -
    5. - In the - - Account Configuration - - section, click - - Paper Trading Account - - . -
    6. -
    7. - Click - - Yes - - . -
    8. -
    9. - Click - - Save - - . -
    10. -
    -

    - The IB paper trading environment simulates most aspects of a production Trader Workstation account, but you may encounter some differences due to its construction as a simulator with no execution or clearing abilities. -

    -

    - Insured Bank Deposit Sweep Program -

    -

    - LEAN doesn't support IB accounts in the - - Insured Bank Deposit Sweep Program - - because when LEAN reads your account balances, it includes cash that's in the FDIC Sweep Account Cash, which isn't tradable. - For example, if your account has $150K USD of cash, only $100K may be available to trade if $50K is in FDIC Sweep Account Cash. -

    - - - -

    Asset Classes

    - - -

    - Our Interactive Brokers integration supports the following asset classes: -

    - -

    - You may not be able to trade all assets with IB. For example, if you live in the EU, you can't trade US ETFs. Check with your local regulators to know which assets you are allowed to trade. You may need to adjust settings in your brokerage account to live trade some assets. -

    - - - -

    Data Providers

    +

     

    + +
    +
    +

    Brokerages

    +

    Binance

    +
    +
    +

    Introduction

    - You might need to purchase an - - IB market data - - subscription for your trading. For more information about live data providers, see - - Data Providers + QuantConnect enables you to run your algorithms in live mode with real-time market data. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015. +

    +

    + Binance was founded by Changpeng Zhao in 2017 with the goal to "increase the freedom of money globally". Binance provides access to trading Crypto through spot markets and perpetual Futures. They serve clients with no minimum deposit when depositing Crypto. Binance also provides an NFT marketplace, a mining pool, and services to deposit Crypto coins in liquidity pools to earn rewards. +

    +

    + To view the implementation of the Binance brokerage integration, see the + + Lean.Brokerages.Binance repository .

    -

    Orders

    +

    Account Types

    - We model the IB API by supporting several order types, order properties, and order updates. When you deploy live algorithms, you can - - place manual orders + Binance supports cash and margin accounts for spot trades, but only supports margin accounts for Futures trades. Binance US only supports cash accounts. To set the account type in an algorithm, see the + + Binance brokerage model documentation - through the IDE. + .

    - Order Types + Create an Account

    - The following table describes the order types that our IB integration supports: supports. For specific details about each order type, refer to the IB documentation. -
    + Follow the account creation wizard on the + + Binance.com + + or + + Binance.us + + website to create a Binance account.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Order Type - - IB Documentation Page -
    - - MarketOrder - - - - Market Orders - -
    - - LimitOrder - - - - Limit Orders - -
    - - LimitIfTouchedOrder - - - - Limit if Touched Orders - -
    - - StopMarketOrder - - - - Stop Orders - -
    - - StopLimitOrder - - - - Stop-Limit Orders - -
    - - TrailingStopOrder - - - - Trailing Stop Orders - -
    - - MarketOnOpenOrder - - - - Market-on-Open (MOO) Orders - -
    - - MarketOnCloseOrder - - - - Market-on-Close (MOC) Orders - -
    - - ComboMarketOrder - - - - Spread Orders - -
    - - ComboLimitOrder - - - - Spread Orders - -
    - - ComboLegLimitOrder - - - - Spread Orders - -
    - - ExerciseOption - - - - Options Exercise - -

    - The following table describes the available order types for each asset class that IB supports: + You will need API credentials to deploy live algorithms with your brokerage account. After you open your account, + + create API credentials + + and store them somewhere safe. As you create credentials, make the following configurations: +

    +
      +
    • + Select the + + Restrict access to trusted IPs only + + check box and then enter our IP address, 146.59.85.21. +
    • +
    • + If you are going to trade Crypto Futures, select the + + Enable Futures + + check box. +
    • +
    +

    + Paper Trading +

    +

    + Binance supports paper trading through the Binance Spot Test Network. You don't need a Binance account to create API credentials for the Spot Test Network. +

    +

    + Follow these steps to set up paper trading with the Binance Spot Test Network: +

    +
      +
    1. + Log in to the + + Binance Spot Test Network + + with your GitHub credentials. +
    2. +
    3. + In the + + API Keys + + section, click + + Generate HMAC_SHA256 Key + + . +
    4. +
    5. + Enter a description and then click + + Generate + + . +
    6. +
    7. + Store your API key and API key secret somewhere safe. +
    8. +
    +

    + Paper trading Binance Crypto Futures or with Binance US isn't currently available.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +

    + Sub-Accounts +

    +

    + Our Binance and Binance US integrations don't support trading with sub-accounts. You must use your main account. +

    + + + +

    Asset Classes

    + + +

    + Our Binance integration supports trading + + Crypto + + and + + Crypto Futures + + . +

    +
    +
    AddCrypto("BTCUSDT", Resolution.Minute, Market.Binance);
    +AddCryptoFuture("BTCUSD", Resolution.Minute, Market.Binance);
    +AddCrypto("BTCUSDT", Resolution.Minute, Market.BinanceUS);
    +
    self.AddCrypto("BTCUSDT", Resolution.Minute, Market.Binance)
    +self.AddCryptoFuture("BTCUSD", Resolution.Minute, Market.Binance)
    +
    +

    + Our Binance US integration supports trading + + Crypto + + . +

    +
    +
    AddCrypto("BTCUSDT", Resolution.Minute, Market.BinanceUS);
    +
    self.AddCrypto("BTCUSDT", Resolution.Minute, Market.BinanceUS)
    +
    +

    + If you call the + + SetBrokerageModel + + method with the correct + + BrokerageName + + , then you don't need to pass a + + Market + + argument to the + + AddCrypto + + method because the brokerage model has a + + default market + + . +

    + + + +

    Data Providers

    + + +

    + The + + QuantConnect data provider + + provides Crypto data during live trading. +

    + + + +

    Orders

    + + +

    + We model the Binance and Binance US APIs by supporting several order types, supporting order properties, and not supporting order updates. When you deploy live algorithms, you can + + place manual orders + + through the IDE. +

    +

    + Order Types +

    +

    + The following table describes the available order types for each asset class that our Binance and Binance US integrations support: +

    +
    - Order Type - - US Equity - - Equity Options - - Forex - - Futures - - Futures Options - - Index Options -
    - - MarketOrder - - - green check - - green check - - green check - - green check - - green check - - green check -
    - - LimitOrder - - - green check - - green check - - green check - - green check - - green check - - green check -
    - - LimitIfTouchedOrder - - - green check - - green check - - green check - - green check - - green check - - green check -
    - - StopMarketOrder - - - green check - - green check - - green check - - green check - - green check - - green check -
    - - StopLimitOrder - - - green check - - green check - - green check - - green check - - green check - - green check -
    - - TrailingStopOrder - - - green check - - green check - - green check - - green check - - green check - - green check -
    - - MarketOnOpenOrder - - - green check - - green check - - green check - - - - green check -
    - - MarketOnCloseOrder - - - green check - - - green check - - green check - - green check - - green check -
    + - - - - - - - + + + + + - - - - @@ -21608,19 +21018,10 @@

    - - - - @@ -21630,21 +21031,10 @@

    - - - - @@ -21661,13 +21051,14 @@

    Order Properties +

    - We model custom order properties from the IB API. The following table describes the members of the + We model custom order properties from the Binance and Binance US APIs. The following table describes the members of the - InteractiveBrokersOrderProperties + BinanceOrderProperties - object that you can set to customize order execution. The table does not include the preceding methods for FA accounts. + object that you can set to customize order execution:

    - - ComboMarketOrder - - - - green check - - - - green check - - green check - + Order Type + + Crypto + + Crypto Futures +
    - - ComboLimitOrder + + MarketOrder - - green check - - - green check
    - - ComboLegLimitOrder + + LimitOrder - - green check - - - green check
    - - ExerciseOption + + StopLimitOrder - - green check -
    - Not supported for cash-settled Options -
    - - green check
    @@ -21688,119 +21079,51 @@

    - - - - - - -
    - A - - TimeInForce - - instruction to apply to the order. The following instructions are supported: -
      -
    • - - Day - -
    • -
    • - - GoodTilCanceled - -
    • -
    • - - GoodTilDate - -
    • -
    -
    - - OutsideRegularTradingHours - - - A flag to signal that the order may be triggered and filled outside of regular trading hours. -
    -

    - Updates -

    -

    - We model the IB API by supporting - - order updates - - . -

    -

    - Financial Advisor Group Orders -

    -

    - To place FA group orders, see - - Financial Advisors - - . -

    -

    - Fractional Trading -

    -

    - The IB API and FIX/CTCI don't support - - fractional trading - - . -

    -

    - Handling Splits -

    -

    - If you're using raw - - data normalization - - and you have active orders with a limit, stop, or trigger price in the market for a US Equity when a - - stock split - - occurs, the following properties of your orders automatically adjust to reflect the stock split: -

    -
      -
    • - Quantity -
    • -
    • - Limit price -
    • -
    • - Stop price -
    • -
    • - Trigger price -
    • -
    -

    - Fill Time -

    -

    - IB has a 400 millisecond fill time for live orders. -

    + A + + TimeInForce + + instruction to apply to the order. The following instructions are supported: +
      +
    • + + Day + +
    • +
    • + + GoodTilCanceled + +
    • +
    • + + GoodTilDate + +
    • +
    + + + + + + PostOnly + + + + A flag to signal that the order must only add liquidity to the order book and not take liquidity from the order book. If part of the order results in taking liquidity rather than providing liquidity, the order is rejected without any part of it being filled. + + + +

    - Brokerage Liquidations + Updates

    - When IB liquidates part of your position, you receive an - - order event + We model the Binance and Binance US APIs by not supporting order updates, but you can cancel an existing order and then create a new order with the desired arguments. For more information about this workaround, see the + + Workaround for Brokerages That Don’t Support Updates - that contains the - - Brokerage Liquidation - - message. + .

    @@ -21809,15 +21132,19 @@

    Fees

    - To view the IB trading fees, see the - - Commissions + To view the Binance or Binance US trading fees, see the + + Trading Fees - page on the IB website. To view how we model their fees, see - + page on the Binance.com website or the + + Fee Structure + + page on the Binance.us website. To view how we model their fees, see + Fees - . + . The Binance Spot Test Network does not charge order fees.

    @@ -21827,20 +21154,16 @@

    Margin

    We model - + buying power and margin calls - to ensure your algorithm stays within the margin requirements. If you have more than $25,000 in your brokerage account, you can use the - - PatternDayTradingMarginModel - - to make use of the 4x intraday leverage and 2x overnight leverage available on most brokerages from the - - PDT rule + to ensure your algorithm stays within the margin requirements. If you trade Crypto Perpetual Futures, we model the margin cost and payments of your Crypto Future holdings by directly adjusting your portfolio cash. For more information about Futures margin interest modeling, see the + + Binance Futures Model .

    @@ -21851,11 +21174,11 @@

    Slippage

    - Orders through IB do not experience slippage in backtests. In paper trading and live trading, your orders may experience slippage. + Orders through Binance and Binance US do not experience slippage in backtests. In live trading, your orders may experience slippage.

    - To view how we model IB slippage, see - + To view how we model Binance and Binance US slippage, see + Slippage . @@ -21872,8 +21195,8 @@

    Fills

    available in the order book.

    - To view how we model IB order fills, see - + To view how we model Binance and Binance US order fills, see + Fills . @@ -21885,11 +21208,11 @@

    Settlements

    - If you trade with a margin account, trades settle immediately + Trades settle immediately after the transaction

    - To view how we model settlement for IB trades, see - + To view how we model settlement for Binance and Binance US trades, see + Settlement . @@ -21901,68 +21224,7 @@

    Security and Stability

    - Note the following security and stability aspects of our IB integration. -

    -

    - Account Credentials -

    -

    - When you deploy live algorithms with IB, we don't save your brokerage account credentials. -

    -

    - API Outages -

    -

    - We call the IB API to place live trades. Sometimes the API may be down. Check the - - IB status page - - to see if the API is currently working. -

    -

    - Connections -

    -

    - By default, IB only supports one connection at a time to your account. If you interfere with your brokerage account while an algorithm is connected to it, the algorithm may stop executing. If you deploy a live running algorithm with your IB account and want to open Trader Workstation (TWS) with the same IB account, - - create a second user on your IB account - - and log in to TWS with the new user credentials. To run more than one algorithm with IB, - - open an IB subaccount - - for each additional algorithm. -

    -

    - If you can't log in to TWS with your credentials, contact IB. If you can log in to TWS but can't log in to the deployment wizard, - - contact us - - and provide the algorithm ID and deployment ID. -

    -

    - SMS 2FA -

    -

    - Our IB integration doesn't support Two-Factor Authentication (2FA) via SMS or the Online Security Code Card. Use the - - IB Key Security via IBKR Mobile - - instead. -

    -

    - System Resets -

    -

    - You'll receive a notification on your IB Key device every Sunday to re-authenticate the connection between IB and your live algorithm. When you - - deploy your algorithm - - , you can select a time on Sunday to receive the notification. If you don't re-authenticate before the timeout period, your algorithm quits executing. Ensure your IB Key device has sufficient battery for the time you expect to receive the notification. If you don't receive a notification, see - - I am not receiving IBKR Mobile notifications - - on the IB website. + When you deploy live algorithms with Binance or Binance US, we don't save your brokerage account credentials.

    @@ -21982,14 +21244,17 @@

    Demo Algorithm

    - The following algorithm demonstrates the functionality of the IB brokerage: + The following algorithm demonstrates the functionality of the Binance and Binance US brokerages:

    +

    + Binance +

    -
    @@ -21999,7 +21264,30 @@

    Demo Algorithm

    - +
    +
    +
    +

    + Binance US +

    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    @@ -22007,6 +21295,19 @@

    Demo Algorithm

    +

    Virtual Pairs

    + + +

    + All fiat and Crypto currencies are individual assets. When you buy a pair like BTCUSD, you trade USD for BTC. In this case, LEAN removes some USD from your portfolio + + cashbook + + and adds some BTC. The virtual pair BTCUSD represents your position in that trade, but the virtual pair doesn't actually exist. It simply represents an open trade. When you deploy a live algorithm, LEAN populates your cashbook with the quantity of each currency, but it can't get your position of each virtual pair. +

    + + +

    Deploy Live Algorithms

    @@ -22042,98 +21343,61 @@

    Deploy Live Algorithms

    field and then click - Interactive Brokers + Binance Exchange from the drop-down menu.
  • - Enter your IB user name, ID, and password. -
  • - if ($localPlatform) { include(DOCS_RESOURCES."/brokerages/interactive-brokers/paper-trading-data-feeds.html"); } ?> -

    - Your account details are not saved on QuantConnect. -

    -
  • - In the - - Weekly Restart UTC - - field, enter the Coordinated Universal Time (UTC) time of when you want to receive notifications on Sundays to re-authenticate your account connection. + Enter your API key and secret.
  • - For example, 4 PM UTC is equivalent to 11 AM Eastern Standard Time, 12 PM Eastern Daylight Time, 8 AM Pacific Standard Time, and 9 AM Pacific Daylight Time. To convert from UTC to a different time zone, see the - - UTC Time Zone Converter + To generate your API credentials, see + + Account Types - on the UTC Time website. -

    -

    - If your IB account has 2FA enabled, you receive a notification on your IB Key device every Sunday to re-authenticate the connection between IB and your live algorithm. If you don't re-authenticate before the timeout period, your algorithm quits executing. + . Your account details are not saved on QuantConnect.

    - if ($cloudPlatform) { ?>
  • - Click the + Click on the - Data Provider + Environment - field and then click one of the data providers from the drop-down menu. + field and then click one of the environments.
  • - The following table describes the available data providers: + The following table shows the supported environments:

    - +
    - + - - - - - - + +
    - Data Provider - - Description + Environment + + Description
    - QuantConnect - - Use data collected across all of the exchanges. For more details about this data provider, see - - Data Providers - - . -
    - IB + Real - Use data sourced directly from IB. For more details about this data provider, see the - - IB data provider - - guide. + Trade with real money
    - QuantConnect + IB + Demo - Use a combination of the QuantConnect and IB data providers. For more details about this option, see - - Hybrid QuantConnect Data Provider - - . + Trade with paper money through the Binance Global brokerage +
    - include(DOCS_RESOURCES."/brokerages/interactive-brokers/paper-trading-data-feeds.html"); - } - ?>
  • Click the @@ -22141,6 +21405,66 @@

    Deploy Live Algorithms

    field and then click the live trading node that you want to use from the drop-down menu.
  • +
  • + If your brokerage account has existing cash holdings, follow these steps ( + + see video + + ): +
  • +
      +
    1. + In the + + Algorithm Cash State + + section, click + + Show + + . +
    2. +
    3. + Click + + Add Currency + + . +
    4. +
    5. + Enter the currency ticker (for example, USD or CAD) and a quantity. +
    6. +
    +
  • + If your brokerage account has existing position holdings, follow these steps ( + + see video + + ): +
  • +
      +
    1. + In the + + Algorithm Holdings State + + section, click + + Show + + . +
    2. +
    3. + Click + + Add Holding + + . +
    4. +
    5. + Enter the symbol ID, symbol, quantity, and average price. +
    6. +
  • (Optional) @@ -22171,13 +21495,10 @@

    Deploy Live Algorithms

    .
  • -
  • - If your IB account has 2FA enabled, tap the notification on your IB Key device and then enter your pin. -
  • The deployment process can take up to 5 minutes. When the algorithm deploys, the - + live results page displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings. @@ -22186,11 +21507,11 @@

    Deploy Live Algorithms

     

    - +
    -
    +

    Brokerages

    -

    Kraken

    +

    Bitfinex

    Introduction

    @@ -22200,23 +21521,20 @@

    Introduction

    QuantConnect enables you to run your algorithms in live mode with real-time market data. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015.

    - - Kraken - - was founded by Jesse Powell in 2011 with the goal to "accelerate the adoption of cryptocurrency so that you and the rest of the world can achieve financial freedom and inclusion". Kraken provides access to trading Crypto through spot and Futures markets for clients with a minimum deposit of around $0-$150 USD for - - currency + Bitfinex was founded by Giancarlo Devasini and Raphael Nicolle in 2012 with the goal to "give our users the ultimate cryptocurrency trading experience". Bitfinex provides access to trading Crypto for clients outside + + prohibited jurisdictions - and - - Crypto deposits + with no minimum deposit to set up an account. If you fund your account with fiat currency, they enforce a + + 10,000 minimum - . Kraken also provides staking services, educational content, and a developer grant program. + for USD, EUR, and GBP. However, if you fund your account with Crypto, they do not enforce a minimum deposit. Bitfinex also provides Crypto staking, a mobile app, and an unrealized profit leaderboard for the traders on the platform. Bitfinex has always been at the forefront of technological innovation in digital asset trading.

    - To view the implementation of the Kraken brokerage integration, see the - - Lean.Brokerages.Kraken repository + To view the implementation of the Bitfinex brokerage integration, see the + + Lean.Brokerages.Bitfinex repository .

    @@ -22227,25 +21545,48 @@

    Account Types

    - Kraken supports cash and margin accounts. To set the account type in an algorithm, see the - - Kraken brokerage model documentation + Bitfinex supports cash and margin accounts. To set the account type in an algorithm, see the + + Bitfinex brokerage model documentation .

    +

    + Use + + AccountType.Cash + + to connect to your Exchange wallet or + + AccountType.Margin + + to connect to your Margin wallet. You can not connect to your Funding or Capital Raise wallet. If you provide the wrong + + AccountType + + to the + + SetBrokerageModel + + method, you may connect to an empty wallet, causing Lean to throw a warning. If you have a currency in your wallet that ends with "F0", it will not load into your + + CashBook + + . +

    Create an Account

    Follow the - + account creation wizard - on the Kraken website to create a Kraken account. + on the Bitfinex website to create a Bitfinex account.

    - You will need API credentials to deploy live algorithms with your brokerage account. After you open your account, - + You will need API credentials to deploy live algorithms. After you have an account, + create API credentials and store them somewhere safe. @@ -22254,7 +21595,33 @@

    Paper Trading

    - The Kraken brokerage doesn't support paper trading, but you can follow these steps to simulate it: + Bitfinex supports paper trading with only the TESTBTCTESTUSD and TESTBTCTESTUSDT securities. Follow these steps to paper trade with Bitfinex: +

    +
      +
    1. + Create a paper trading sub-account and refill the paper balance For instructions, see + + Paper Trading at Bitfinex + + on the Bitfinex website. +
    2. +
    3. + Create an API key for your sub-account. For instructions, see + + How to create and revoke a Bitfinex API Key + + on the Bitfinex website. +
    4. +
    5. + Use + + AccountType.Cash + + in your algorithms. +
    6. +
    +

    + To paper trade securities other than TESTBTCTESTUSD and TESTBTCTESTUSDT, follow these steps to simulate paper trading with the QuantConnect Paper Trading brokerage:

    1. @@ -22282,15 +21649,15 @@

      Asset Classes

      - Our Kraken integration supports trading + Our Bitfinex integration supports trading Crypto .

      -
      AddCrypto("BTCUSDT", Resolution.Minute, Market.Kraken);
      -
      self.AddCrypto("BTCUSDT", Resolution.Minute, Market.Kraken)
      +
      AddCrypto("BTCUSDT", Resolution.Minute, Market.Bitfinex);
      +
      self.AddCrypto("BTCUSDT", Resolution.Minute, Market.Bitfinex)

      If you call the @@ -22310,7 +21677,7 @@

      Asset Classes

      AddCrypto method because the brokerage model has a - + default market . @@ -22323,7 +21690,7 @@

      Data Providers

      The - + QuantConnect data provider provides Crypto data during live trading. @@ -22335,7 +21702,7 @@

      Orders

      - We model the Kraken API by supporting several order types, supporting order properties, and not supporting order updates. When you deploy live algorithms, you can + We model the Bitfinex API by supporting several order types, order properties, and order updates. When you deploy live algorithms, you can place manual orders @@ -22345,7 +21712,7 @@

      Order Types

      - The following table describes the available order types for each asset class that our Kraken integration supports: + The following table describes the available order types for each asset class that our Bitfinex integration supports:

      @@ -22409,6 +21776,26 @@

      green check +

      + + + + + + +
      + + MarketOnOpenOrder + + + green check +
      + + MarketOnCloseOrder + + + green check +

      - Time In Force + Order Properties

      - We model the + We model custom order properties from the Bybit API. The following table describes the members of the - GoodTilCanceled + BybitBrokerageModel - - TimeInForce - - from the Oanda API. + object that you can set to customize order execution:

      + + + + + + + + + + + + + + + + + + + + + +
      + Property + + Description +
      + + TimeInForce + + + A + + TimeInForce + + instruction to apply to the order. The following instructions are supported: +
        +
      • + + Day + +
      • +
      • + + GoodTilCanceled + +
      • +
      • + + GoodTilDate + +
      • +
      +
      + + PostOnly + + + A flag to signal that the order must only add liquidity to the order book and not take liquidity from the order book. If part of the order results in taking liquidity rather than providing liquidity, the order is rejected without any part of it being filled. This order property is only available for limit orders. +
      + + ReduceOnly + + + A flag to signal that the order must only reduce your current position size. For more information about this order property, see + + Reduce-Only Order + + on the Bybit website. +

      Updates

      - We model the Oanda API by supporting + We model the Bybit API by supporting order updates + for Crypto Future assets that have one of the following + + order states + + : +

      +
        +
      • + + OrderStatus.New + +
      • +
      • + + OrderStatus.PartiallyFilled + +
      • +
      • + + OrderStatus.Submitted + +
      • +
      • + + OrderStatus.UpdateSubmitted + +
      • +
      +

      + In cases where you can't update an order, you can cancel the existing order and then create a new order with the desired arguments. For more information about this workaround, see the + + Workaround for Brokerages That Don’t Support Updates + .

      @@ -23128,12 +22543,12 @@

      Fees

      - To view the Oanda trading fees, see the - - Our Charges and Fees + To view the Bybit trading fees, see the + + Trading Fees Schedule - page on the Oanda website. To view how we model their fees, see - + page on the Bybit website. To view how we model their fees, see + Fees . @@ -23146,7 +22561,7 @@

      Margin

      We model - + buying power and @@ -23162,11 +22577,11 @@

      Slippage

      - Orders through Oanda do not experience slippage in backtests. In paper trading and live trading, your orders may experience slippage. + Orders through Bybit do not experience slippage in backtests. In paper trading and live trading, your orders may experience slippage.

      - To view how we model Oanda slippage, see - + To view how we model Bybit slippage, see + Slippage . @@ -23183,8 +22598,8 @@

      Fills

      available in the order book.

      - To view how we model Oanda order fills, see - + To view how we model Bybit order fills, see + Fills . @@ -23199,36 +22614,20 @@

      Settlements

      Trades settle immediately after the transaction

      - To view how we model settlement for Oanda trades, see - - Settlement - - . -

      - - - -

      Security and Stability

      - - -

      - Note the following security and stability aspects of our Oanda integration. -

      -

      - Account Credentials -

      -

      - When you deploy live algorithms with Oanda, we don't save your brokerage account credentials. -

      -

      - API Outages -

      -

      - We call the Oanda API to place live trades. Sometimes the API may be down. Check the - - Oanda status page + To view how we model settlement for Bybit trades, see + + Settlement - to see if the API is currently working. + . +

      + + + +

      Security and Stability

      + + +

      + When you deploy live algorithms with Bybit, we don't save your brokerage account credentials.

      @@ -23248,14 +22647,14 @@

      Demo Algorithm

      - The following algorithm demonstrates the functionality of the Oanda brokerage: + The following algorithm demonstrates the functionality of the Bybit brokerage:

      -
      @@ -23265,7 +22664,7 @@

      Demo Algorithm

      -
      @@ -23273,6 +22672,19 @@

      Demo Algorithm

      +

      Virtual Pairs

      + + +

      + All fiat and Crypto currencies are individual assets. When you buy a pair like BTCUSD, you trade USD for BTC. In this case, LEAN removes some USD from your portfolio + + cashbook + + and adds some BTC. The virtual pair BTCUSD represents your position in that trade, but the virtual pair doesn't actually exist. It simply represents an open trade. When you deploy a live algorithm, LEAN populates your cashbook with the quantity of each currency, but it can't get your position of each virtual pair. +

      + + +

      Deploy Live Algorithms

      @@ -23308,65 +22720,34 @@

      Deploy Live Algorithms

      field and then click - Oanda + Bybit Exchange from the drop-down menu.
    2. - Enter your Oanda account Id and access token. + Enter your API key and secret.
    3. - To get your account ID and access token, see the - - Create an Account - - section in the - + To generate your API credentials, see + Account Types - documentation. Your account details are not saved on QuantConnect. -
      + . Your account details are not saved on QuantConnect.

    4. Click the - Environment + VIP Level - field and then click one of the environments. + field and then click your level from the drop-down menu.
    5. - The following table shows the supported environments: + For more information about VIP levels, see + + FAQ — Bybit VIP Program + + on the Bybit website.

      - - - - - - - - - - - - - - - - - -
      - Environment - - Description -
      - Real - - Trade real money with fxTrade -
      - Demo - - Trade paper money with fxTrade Practice -
    6. Click the @@ -23374,6 +22755,36 @@

      Deploy Live Algorithms

      field and then click the live trading node that you want to use from the drop-down menu.
    7. +
    8. + If your brokerage account has existing position holdings, follow these steps ( + + see video + + ): +
    9. +
        +
      1. + In the + + Algorithm Holdings State + + section, click + + Show + + . +
      2. +
      3. + Click + + Add Holding + + . +
      4. +
      5. + Enter the symbol ID, symbol, quantity, and average price. +
      6. +
    10. (Optional) @@ -23407,7 +22818,7 @@

      Deploy Live Algorithms

    The deployment process can take up to 5 minutes. When the algorithm deploys, the - + live results page displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings. @@ -23416,11 +22827,11 @@

    Deploy Live Algorithms

     

    - +
    -
    +

    Brokerages

    -

    Samco

    +

    Coinbase

    Introduction

    @@ -23430,12 +22841,16 @@

    Introduction

    QuantConnect enables you to run your algorithms in live mode with real-time market data. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015.

    - Samco was founded by Jimeet Modi in 2015 with a mission of providing retail investors access to sophisticated financial technology that can assist retail investors in creating wealth at a low cost. Samco provides access to India Equities for clients in India with no minimum balance. Samco also provides stock ratings, mutual funds, and a mini-portfolio investment platform. + Coinbase was founded by Brian Armstrong and Fred Ehrsam in 2012 with the goal to "increase economic freedom in the world". Coinbase provides access to trading Crypto for clients in over + + 100 countries + + with no minimum deposit. Coinbase also provides a self-hosted Crypto wallet, a Visa debit rewards card, and Bitcoin collateral-backed lines of credit.

    - To view the implementation of the Samco brokerage integration, see the - - Lean.Brokerages.Samco repository + To view the implementation of the Coinbase brokerage integration, see the + + Lean.Brokerages.Coinbase repository .

    @@ -23446,35 +22861,62 @@

    Account Types

    - Samco supports cash and margin accounts. To set the account type in an algorithm, see the - - Samco brokerage model documentation + Coinbase supports cash accounts. To set the account type in an algorithm, see the + + Coinbase brokerage model documentation .

    -

    - Samco only supports trading in Indian Rupees, so - - set the account currency of your algorithm - - to INR. -

    Create an Account

    Follow the - - account creation wizard + + Create a Coinbase account - on the Samco website to create a Samco account. + tutorial on the Coinbase website to create an account. +

    +

    + You will need API credentials to deploy live algorithms. After you have an account, + + create API credentials + + and store them somewhere safe. As you create credentials, enable + + View + + and + + Trade + + permissions.

    Paper Trading

    - Samco doesn't support paper trading. + The Coinbase brokerage doesn't support paper trading, but you can follow these steps to simulate it:

    +
      +
    1. + In the + + Initialize + + method of your algorithm, add one of the preceding + + SetBrokerageModel + + method calls. +
    2. +
    3. + + Deploy your algorithm with the QuantConnect Paper Trading brokerage + + . +
    4. +
    @@ -23482,18 +22924,39 @@

    Asset Classes

    - Our Samco integration supports trading the following asset classes: + Our Coinbase integration supports trading + + Crypto + + . +

    +
    +
    AddCrypto("BTCUSD", Resolution.Minute, Market.Coinbase);
    +
    self.AddCrypto("BTCUSD", Resolution.Minute, Market.Coinbase)
    +
    +

    + If you call the + + SetBrokerageModel + + method with the correct + + BrokerageName + + , then you don't need to pass a + + Market + + argument to the + + AddCrypto + + method because the brokerage model has a + + default market + + .

    - @@ -23502,10 +22965,10 @@

    Data Providers

    The - - Samco data provider + + QuantConnect data provider - provides India Equities data during live trading. + provides Crypto data during live trading.

    @@ -23514,7 +22977,7 @@

    Orders

    - We model the Samco API by supporting several order types, supporting order properties, and order updates. When you deploy live algorithms, you can + We model the Coinbase API by supporting several order types, supporting order properties, and not supporting order updates. When you deploy live algorithms, you can place manual orders @@ -23524,7 +22987,7 @@

    Order Types

    - The following table describes the available order types for each asset class that our Samco integration supports: + The following table describes the available order types for each asset class that our Coinbase integration supports:

    @@ -23533,7 +22996,7 @@

    Order Type

    @@ -23568,6 +23031,16 @@

    green check +

    + + +
    - India Equity + Crypto
    + + StopLimitOrder + + + green check +

    - Time In Force + Order Properties +

    +

    + We model custom order properties from the IB API. The following table describes the members of the + + InteractiveBrokersOrderProperties + + object that you can set to customize order execution. The table does not include the preceding methods for FA accounts. +

    + + + + + + + + + + + + + + + + + +
    + Property + + Description +
    + + TimeInForce + + + A + + TimeInForce + + instruction to apply to the order. The following instructions are supported: +
      +
    • + + Day + +
    • +
    • + + GoodTilCanceled + +
    • +
    • + + GoodTilDate + +
    • +
    +
    + + OutsideRegularTradingHours + + + A flag to signal that the order may be triggered and filled outside of regular trading hours. +
    +

    + Updates

    - We model the TD Ameritrade API by supporting the following - - TimeInForce + We model the IB API by supporting + + order updates - instructions: + .

    -
      -
    • - - Day - -
    • -
    • - - GoodTilCanceled - -
    • -
    • - - GoodTilDate - -
    • -

    - Updates + Financial Advisor Group Orders

    - We model the TD Ameritrade API by supporting - - order updates + To place FA group orders, see + + Financial Advisors + + . +

    +

    + Fractional Trading +

    +

    + The IB API and FIX/CTCI don't support + + fractional trading .

    @@ -24321,6 +24239,26 @@

    Trigger price +

    + Fill Time +

    +

    + IB has a 400 millisecond fill time for live orders. +

    +

    + Brokerage Liquidations +

    +

    + When IB liquidates part of your position, you receive an + + order event + + that contains the + + Brokerage Liquidation + + message. +

    @@ -24328,12 +24266,12 @@

    Fees

    - To view the TD Ameritrade trading fees, see the - - Pricing + To view the IB trading fees, see the + + Commissions - page on the TD Ameritrade website. To view how we model their fees, see - + page on the IB website. To view how we model their fees, see + Fees . @@ -24346,7 +24284,7 @@

    Margin

    We model - + buying power and @@ -24370,11 +24308,11 @@

    Slippage

    - Orders through TD Ameritrade do not experience slippage in backtests. In paper trading and live trading, your orders may experience slippage. + Orders through IB do not experience slippage in backtests. In paper trading and live trading, your orders may experience slippage.

    - To view how we model TD Ameritrade slippage, see - + To view how we model IB slippage, see + Slippage . @@ -24391,8 +24329,8 @@

    Fills

    available in the order book.

    - To view how we model TD Ameritrade order fills, see - + To view how we model IB order fills, see + Fills . @@ -24407,8 +24345,8 @@

    Settlements

    If you trade with a margin account, trades settle immediately

    - To view how we model settlement for TD Ameritrade trades, see - + To view how we model settlement for IB trades, see + Settlement . @@ -24420,7 +24358,68 @@

    Security and Stability

    - When you deploy live algorithms with TD Ameritrade, we don't save your brokerage account credentials. + Note the following security and stability aspects of our IB integration. +

    +

    + Account Credentials +

    +

    + When you deploy live algorithms with IB, we don't save your brokerage account credentials. +

    +

    + API Outages +

    +

    + We call the IB API to place live trades. Sometimes the API may be down. Check the + + IB status page + + to see if the API is currently working. +

    +

    + Connections +

    +

    + By default, IB only supports one connection at a time to your account. If you interfere with your brokerage account while an algorithm is connected to it, the algorithm may stop executing. If you deploy a live running algorithm with your IB account and want to open Trader Workstation (TWS) with the same IB account, + + create a second user on your IB account + + and log in to TWS with the new user credentials. To run more than one algorithm with IB, + + open an IB subaccount + + for each additional algorithm. +

    +

    + If you can't log in to TWS with your credentials, contact IB. If you can log in to TWS but can't log in to the deployment wizard, + + contact us + + and provide the algorithm ID and deployment ID. +

    +

    + SMS 2FA +

    +

    + Our IB integration doesn't support Two-Factor Authentication (2FA) via SMS or the Online Security Code Card. Use the + + IB Key Security via IBKR Mobile + + instead. +

    +

    + System Resets +

    +

    + You'll receive a notification on your IB Key device every Sunday to re-authenticate the connection between IB and your live algorithm. When you + + deploy your algorithm + + , you can select a time on Sunday to receive the notification. If you don't re-authenticate before the timeout period, your algorithm quits executing. Ensure your IB Key device has sufficient battery for the time you expect to receive the notification. If you don't receive a notification, see + + I am not receiving IBKR Mobile notifications + + on the IB website.

    @@ -24440,14 +24439,14 @@

    Demo Algorithm

    - The following algorithm demonstrates the functionality of the TD Ameritrade brokerage: + The following algorithm demonstrates the functionality of the IB brokerage:

    -
    @@ -24457,7 +24456,7 @@

    Demo Algorithm

    -
    @@ -24500,20 +24499,98 @@

    Deploy Live Algorithms

    field and then click - TD Ameritrade + Interactive Brokers from the drop-down menu.
  • - Enter your TD Ameritrade account ID, key, and token. + Enter your IB user name, ID, and password.
  • + if ($localPlatform) { include(DOCS_RESOURCES."/brokerages/interactive-brokers/paper-trading-data-feeds.html"); } ?>

    - To get your account credentials, see - - Account Types + Your account details are not saved on QuantConnect. +

    +
  • + In the + + Weekly Restart UTC + + field, enter the Coordinated Universal Time (UTC) time of when you want to receive notifications on Sundays to re-authenticate your account connection. +
  • +

    + For example, 4 PM UTC is equivalent to 11 AM Eastern Standard Time, 12 PM Eastern Daylight Time, 8 AM Pacific Standard Time, and 9 AM Pacific Daylight Time. To convert from UTC to a different time zone, see the + + UTC Time Zone Converter - . Your account details are not saved on QuantConnect. + on the UTC Time website. +

    +

    + If your IB account has 2FA enabled, you receive a notification on your IB Key device every Sunday to re-authenticate the connection between IB and your live algorithm. If you don't re-authenticate before the timeout period, your algorithm quits executing. +

    + if ($cloudPlatform) { ?> +
  • + Click the + + Data Provider + + field and then click one of the data providers from the drop-down menu. +
  • +

    + The following table describes the available data providers:

    + + + + + + + + + + + + + + + + + + + + + +
    + Data Provider + + Description +
    + QuantConnect + + Use data collected across all of the exchanges. For more details about this data provider, see + + Datasets + + . +
    + IB + + Use data sourced directly from IB. For more details about this data provider, see the + + IB data provider + + guide. +
    + QuantConnect + IB + + Use a combination of the QuantConnect and IB data providers. For more details about this option, see + + Hybrid QuantConnect Data Provider + + . +
    + include(DOCS_RESOURCES."/brokerages/interactive-brokers/paper-trading-data-feeds.html"); + } + ?>
  • Click the @@ -24551,10 +24628,13 @@

    Deploy Live Algorithms

    .
  • +
  • + If your IB account has 2FA enabled, tap the notification on your IB Key device and then enter your pin. +
  • The deployment process can take up to 5 minutes. When the algorithm deploys, the - + live results page displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings. @@ -24563,11 +24643,11 @@

    Deploy Live Algorithms

     

    - +
    -
    +

    Brokerages

    -

    Tradier

    +

    Kraken

    Introduction

    @@ -24577,16 +24657,23 @@

    Introduction

    QuantConnect enables you to run your algorithms in live mode with real-time market data. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015.

    - Tradier was founded by Dan Raju, Peter Laptewicz, Jason Barry, Jeyashree Chidambaram, and Steve Agalloco in 2012 with the goal to "deliver a choice of low-cost, high-value brokerage services to traders". Tradier provides access to trading Equities and Options for clients in over 250 countries and territories with - - no minimum deposit for cash accounts + + Kraken - . Tradier also delivers custody, clearing, execution, and billing on behalf of registered advisors. + was founded by Jesse Powell in 2011 with the goal to "accelerate the adoption of cryptocurrency so that you and the rest of the world can achieve financial freedom and inclusion". Kraken provides access to trading Crypto through spot and Futures markets for clients with a minimum deposit of around $0-$150 USD for + + currency + + and + + Crypto deposits + + . Kraken also provides staking services, educational content, and a developer grant program.

    - To view the implementation of the Tradier brokerage integration, see the - - Lean.Brokerages.Tradier repository + To view the implementation of the Kraken brokerage integration, see the + + Lean.Brokerages.Kraken repository .

    @@ -24597,9 +24684,9 @@

    Account Types

    - Tradier supports cash and margin accounts. To set the account type in an algorithm, see the - - Tradier brokerage model documentation + Kraken supports cash and margin accounts. To set the account type in an algorithm, see the + + Kraken brokerage model documentation .

    @@ -24608,54 +24695,43 @@

    Follow the - + account creation wizard - on the Tradier website to create a Tradier account. + on the Kraken website to create a Kraken account.

    - You will need your account ID and access token to deploy live algorithms. After you have an account, get your account ID and token from the - - Settings > API Access + You will need API credentials to deploy live algorithms with your brokerage account. After you open your account, + + create API credentials - page on the Tradier website. Your account ID is the alpha-numeric code in a drop-down field on the page. + and store them somewhere safe.

    Paper Trading

    - Tradier supports paper trading, but with the following caveats: + The Kraken brokerage doesn't support paper trading, but you can follow these steps to simulate it:

    -
      +
      1. - Account activity is unavailable since this information is populated from Tradier's clearing firm. + In the + + Initialize + + method of your algorithm, add one of the preceding + + SetBrokerageModel + + method calls.
      2. - Streaming Tradier market data is unavailable due to exchange restrictions related to delayed data. + + Deploy your algorithm with the QuantConnect Paper Trading brokerage + + .
      3. -
    -

    - To get your paper trading account number and access token, open the - - API Access - - page on the Tradier website and then scroll down to the - - Sandbox Account Access (Paper Trading) - - section. -

    -

    - If you trade Equities, you can use the - - QuantConnect data provider - - to get real-time data. If you trade Options, you must use delayed data from the - - Tradier data provider - - . If you trade Equities and Options, use the Tradier data provider. We don't currently have a hybrid QuantConnect-Tradier data provider. If you trade with the demo environment, Tradier doesn't offer streaming market data due to exchange restrictions related to delayed data, so you must use our data provider. -

    + @@ -24663,18 +24739,38 @@

    Asset Classes

    - Our Tradier integration supports trading - - US Equities - - and - - Equity Options + Our Kraken integration supports trading + + Crypto .

    +
    +
    AddCrypto("BTCUSDT", Resolution.Minute, Market.Kraken);
    +
    self.AddCrypto("BTCUSDT", Resolution.Minute, Market.Kraken)
    +

    - You may not be able to trade all assets with Tradier. For example, if you live in the EU, you can't trade US ETFs. Check with your local regulators to know which assets you are allowed to trade. You may need to adjust settings in your brokerage account to live trade some assets. + If you call the + + SetBrokerageModel + + method with the correct + + BrokerageName + + , then you don't need to pass a + + Market + + argument to the + + AddCrypto + + method because the brokerage model has a + + default market + + .

    @@ -24683,15 +24779,11 @@

    Data Providers

    - You might need to purchase a - - Tradier market data - - subscription for your trading. For more information about live data providers, see - - Data Providers + The + + QuantConnect data provider - . + provides Crypto data during live trading.

    @@ -24700,11 +24792,7 @@

    Orders

    - We model the Tradier API by supporting several order types and the - - TimeInForce - - order property. Tradier partially supports order updates, but does not support trading during extended market hours. When you deploy live algorithms, you can + We model the Kraken API by supporting several order types, supporting order properties, and not supporting order updates. When you deploy live algorithms, you can place manual orders @@ -24714,7 +24802,7 @@

    Order Types

    - The following table describes the available order types for each asset class that our Tradier integration supports: + The following table describes the available order types for each asset class that our Kraken integration supports:

    @@ -24722,11 +24810,8 @@

    - - @@ -24740,9 +24825,6 @@

    - + + + @@ -24766,90 +24855,164 @@

    + + + + +
    Order Type - Equity - - Equity Options + + Crypto
    green check - green check -
    @@ -24753,6 +24835,13 @@

    green check
    + + LimitIfTouchedOrder + + green check green check
    + + StopLimitOrder + + green check
    + +

    + Order Properties +

    +

    + We model custom order properties from the Kraken API. The following table describes the members of the + + KrakenOrderProperties + + object that you can set to customize order execution: +

    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Property + + Description +
    + + TimeInForce + + + A + + TimeInForce + + instruction to apply to the order. The following instructions are supported: +
      +
    • + + Day + +
    • +
    • + + GoodTilCanceled + +
    • +
    • + + GoodTilDate + +
    • +
    +
    + + PostOnly + + + A flag to signal that the order must only add liquidity to the order book and not take liquidity from the order book. If part of the order results in taking liquidity rather than providing liquidity, the order is rejected without any part of it being filled. +
    + + FeeInBase + + + A flag to signal that the order fees should be paid in the base currency, which is the default behavior when selling. This flag must be the opposite of the + + FeeInQuote + + flag. +
    + + FeeInQuote + + + A flag to signal that the order fees should be paid in the quote currency, which is the default behavior when buying. This flag must be the opposite of the + + FeeInBase + + flag. +
    - - StopLimitOrder + + NoMarketPriceProtection + + + A flag to signal that no + + Market Price Protection + should be used.
    - green check + + ConditionalOrder + - green check + An + + Order + + that's submitted when the primary order is executed. The + + ConditionalOrder + + quantity must match the primary order quantity and the + + ConditionalOrder + + direction must be the opposite of the primary order direction. This order property is only available for live algorithms.
    - -

    - Time In Force -

    -

    - We model the Tradier API by supporting the following - - TimeInForce - - instructions: -

    -
      -
    • - - Day - -
    • -
    • - - GoodTilCanceled - - (not available for short selling) -
    • -

    Updates

    - We model the Tradier API by supporting most - - order updates - - . To update the quantity of an order, cancel the order and then submit a new order with the desired quantity. For more information about this workaround, see the + We model the Kraken API by not supporting order updates, but you can cancel an existing order and then create a new order with the desired arguments. For more information about this workaround, see the Workaround for Brokerages That Don’t Support Updates .

    -

    - Extended Market Hours -

    -

    - Tradier doesn't support extended market hours trading. If you place an order outside of regular trading hours, the order will be processed at market open. -

    -

    - Automatic Cancellations -

    -

    - If you have open orders for a security when it performs a reverse split, Tradier automatically cancels your orders. -

    -

    - Errors -

    -

    - To view the order-related error codes from Tradier, see - - Error Responses - - in their documentation. -

    @@ -24857,12 +25020,12 @@

    Fees

    - To view the Tradier trading fees, see the - - Pricing + To view the Kraken trading fees, see the + + Fee Schedule - page on the Tradier website. To view how we model their fees, see - + page on the Kraken website. To view how we model their fees, see + Fees . @@ -24875,22 +25038,14 @@

    Margin

    We model - + buying power and margin calls - to ensure your algorithm stays within the margin requirements. If you have more than $25,000 in your brokerage account, you can use the - - PatternDayTradingMarginModel - - to make use of the 4x intraday leverage and 2x overnight leverage available on most brokerages from the - - PDT rule - - . + to ensure your algorithm stays within the margin requirements.

    @@ -24899,11 +25054,11 @@

    Slippage

    - Orders through Tradier do not experience slippage in backtests. In live trading, your orders may experience slippage. + Orders through Kraken do not experience slippage in backtests. In live trading, your orders may experience slippage.

    - To view how we model Tradier slippage, see - + To view how we model Kraken slippage, see + Slippage . @@ -24920,8 +25075,8 @@

    Fills

    available in the order book.

    - To view how we model Tradier order fills, see - + To view how we model Kraken order fills, see + Fills . @@ -24933,11 +25088,11 @@

    Settlements

    - If you trade with a margin account, trades settle immediately + Trades settle immediately after the transaction

    - To view how we model settlement for Tradier trades, see - + To view how we model settlement for Kraken trades, see + Settlement . @@ -24949,21 +25104,21 @@

    Security and Stability

    - Note the following security and stability aspects of our Tradier integration. + Note the following security and stability aspects of our Kraken integration.

    Account Credentials

    - When you deploy live algorithms with Tradier, we don't save your brokerage account credentials. + When you deploy live algorithms with Kraken, we don't save your brokerage account credentials.

    API Outages

    - We call the Tradier API to place live trades. Sometimes the API may be down. Check the - - Tradier status page + We call the Kraken API to place live trades. Sometimes the API may be down. Check the + + Kraken status page to see if the API is currently working.

    @@ -24985,14 +25140,14 @@

    Demo Algorithm

    - The following algorithm demonstrates the functionality of the Tradier brokerage: + The following algorithm demonstrates the functionality of the Kraken brokerage:

    -
    @@ -25002,7 +25157,7 @@

    Demo Algorithm

    -
    @@ -25010,6 +25165,19 @@

    Demo Algorithm

    +

    Virtual Pairs

    + + +

    + All fiat and Crypto currencies are individual assets. When you buy a pair like BTCUSD, you trade USD for BTC. In this case, LEAN removes some USD from your portfolio + + cashbook + + and adds some BTC. The virtual pair BTCUSD represents your position in that trade, but the virtual pair doesn't actually exist. It simply represents an open trade. When you deploy a live algorithm, LEAN populates your cashbook with the quantity of each currency, but it can't get your position of each virtual pair. +

    + + +

    Deploy Live Algorithms

    @@ -25045,113 +25213,34 @@

    Deploy Live Algorithms

    field and then click - Tradier + Kraken Exchange from the drop-down menu.
  • - Enter your Tradier account Id and token. + Enter your Kraken API secret and key.
  • - To get your account ID and token, see the - - Create an Account - - section in the - - Account Types + Gather your API credentials from the + + API Management Settings - documentation. Your account details are not saved on QuantConnect. -
    -

    -
  • - Click the - - Environment - - field and then click one of the environments from the drop-down menu. -
  • -

    - The following table shows the supported environments: + page on the Kraken website. Your account details are not saved on QuantConnect.

    - - - - - - - - - - - - - - - - - -
    - Environment - - Description -
    - Real - - Trade with real money -
    - Demo - - Trade with paper money -
  • Click the - Data Provider + Verification Tier - field and then click one of the data providers from the drop-down menu. + field and then click your verification tier from the drop-down menu.
  • - The following table describes the available data providers: -

    - - - - - - - - - - - - - - - - - -
    - Data Provider - - Description -
    - QuantConnect - - Use data collected across all of the exchanges. For more details about this data provider, see - - Data Providers - - . -
    - Tradier - - Use data sourced directly from Tradier. This data provider isn't available for the demo environment. For more details about this data provider, see the - - Tradier data provider - - . -
    + For more information about verification tiers, see + + Verification levels explained + + on the Kraken website. +

  • Click the @@ -25192,7 +25281,7 @@

    Deploy Live Algorithms

    The deployment process can take up to 5 minutes. When the algorithm deploys, the - + live results page displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings. @@ -25201,11 +25290,11 @@

    Deploy Live Algorithms

     

    - +
    -
    +

    Brokerages

    -

    Trading Technologies

    +

    Oanda

    Introduction

    @@ -25215,74 +25304,137 @@

    Introduction

    QuantConnect enables you to run your algorithms in live mode with real-time market data. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015.

    - Trading Technologies (TT) was founded by Gary Kemp in 1994 with the goal to create professional trading software, infrastructure, and data solutions for a wide variety of users. TT provides access to trading Futures, Options, and Crypto. TT also provides a charting platform, infrastructure services, and risk management tools. TT is not actually a brokerage. The firm is a brokerage router with access to more than 30 execution destinations. + Oanda was founded by Dr. Michael Stumm and Dr. Richard Olsen in 1995 with the goal to "transform all aspects of how the world interacts with currencies, whether that be trading or utilizing currency data and information". Oanda provides access to trading Forex and CFDs for clients in over 240 countries and territories with + + no minimum deposit + + . Oanda also provides demo accounts, advanced charting tools, and educational content

    - To view the implementation of the TT integration, see the - - Lean.Brokerages.TradingTechnologies repository + To view the implementation of the Oanda brokerage integration, see the + + Lean.Brokerages.OANDA repository .

    -

    Modeling

    +

    Account Types

    - The - - TradingTechnologiesBrokerageModel - - does not have specific modeling for fees and slippage because TT is an order router and can execute on many exchanges and brokerages. To set the brokerage model and account type in an algorithm, see the - - TT brokerage model documentation + Oanda supports margin accounts. To set the account type in an algorithm, see the + + Oanda brokerage model documentation - . In live trading, TT reports the total fees of your orders after each order fill. Pass a different - - BrokerageName - - to - - SetBrokerageModel - - to backtest your algorithm with fee and slippage modeling. The brokerage model you set should support the asset classes and orders in your algorithm. + .

    Create an Account

    Follow the - - account creation wizard + + How to open an account - on the TT website to create a TT account. + page on the Oanda website to open an Oanda account. +

    +

    + You will need your account number and access token to deploy live algorithms. To get your account number, open the + + Account Statement + + page on the Oanda website. Your account number is formatted as + + ###-###-######-### + + . To get your access token, open the + + Manage API Access + + on the Oanda website.

    +
    +

    + Important note for European Union residents: On March 17th, 2023, OANDA Europe Markets Ltd. ("OEML") closed operations and transferred accounts to OANDA TMS Brokers S.A. ("OANDA TMS") + + + 1 + + + . OANDA TWS does not offer REST API endpoints for live trading. EU residents can trade with OANDA if they can open an account with another member of the OANDA Group, for example, US citizens. +

    +

    Paper Trading

    - Our TT integration does not support paper trading through the TT Simulation environment, but you can follow these steps to simulate it: + Oanda supports paper trading. Follow these steps to set up an Oanda paper trading account:

    1. - In the - - Initialize - - method of your algorithm, add one of the preceding - - SetBrokerageModel - - method calls. + + Create an Oanda demo account + + .
    2. - - Deploy your algorithm with the QuantConnect Paper Trading brokerage + + Log in to your demo account .
    3. +
    4. + On the Account page, in the + + My Services + + section, click + + Manage API Access + + . +
    5. +
    6. + On the Your key to OANDA's API page, click + + Generate + + . +
    7. +

      + Your access token displays. Store it somewhere safe. You need your access token to deploy an algorithm with your paper trading account. +
      +

      +
    8. + In the top navigation bar, click + + My Account + + . +
    9. +
    10. + On the Account page, in the + + Manage Funds + + section, click + + View + + . +
    11. +
    12. + On the My Funds page, in the + + Account Summary + + section, note your v20 Account Number. +
    13. +

      + You need your v20 Account Number to deploy an algorithm with your paper trading account. +

    @@ -25291,9 +25443,13 @@

    Asset Classes

    - Our TT integration supports trading - - Futures + Our Oanda integration supports trading + + Forex + + and + + CFDs .

    @@ -25304,11 +25460,15 @@

    Data Providers

    - The - - QuantConnect data provider + The QuantConnect data provider providers + + Forex - provides Futures data during live trading. + and + + CFD + + trading data during live trading.

    @@ -25317,11 +25477,11 @@

    Orders

    - We model the TT API by supporting several order types, the + We model the Oanda API by supporting several order types, a TimeInForce - order property, and order updates. When you deploy live algorithms, you can + order instruction, and order updates. When you deploy live algorithms, you can place manual orders @@ -25331,7 +25491,7 @@

    Order Types

    - The following table describes the available order types for each asset class that our TT integration supports: + The following table describes the available order types for each asset class that our Oanda integration supports:

    @@ -25339,8 +25499,11 @@

    - + @@ -25354,6 +25517,9 @@

    + + - - - @@ -25393,51 +25555,24 @@

    text-align: center; } -

    - TT enforces the following order rules: -

    -
      -
    • - If you are buying (selling) with a - - StopMarketOrder - - or a - - StopLimitOrder - - , the stop price of the order must be greater (less) than the current security price. -
    • -
    • - If you are buying (selling) with a - - StopLimitOrder - - , the limit price of the order must be greater (less) than the stop price. -
    • -

    Time In Force

    - We model the TT API by supporting the - - Day - - and + We model the GoodTilCanceled TimeInForce - order properties. + from the Oanda API.

    Updates

    - We model the TT API by supporting + We model the Oanda API by supporting order updates @@ -25450,12 +25585,12 @@

    Fees

    - To view the TT trading fees, see the - - Pricing + To view the Oanda trading fees, see the + + Our Charges and Fees - page on the TT website. To view how we model their fees, see - + page on the Oanda website. To view how we model their fees, see + Fees . @@ -25468,7 +25603,7 @@

    Margin

    We model - + buying power and @@ -25484,11 +25619,11 @@

    Slippage

    - Orders through TT do not experience slippage in backtests. In live trading, your orders may experience slippage. + Orders through Oanda do not experience slippage in backtests. In paper trading and live trading, your orders may experience slippage.

    - To view how we model TT slippage, see - + To view how we model Oanda slippage, see + Slippage . @@ -25496,18 +25631,34 @@

    Slippage

    -

    Fills

    +

    Fills

    + + +

    + We fill market orders immediately and completely in backtests. In live trading, if the quantity of your market + orders exceeds the quantity available at the top of the order book, your orders are filled according to what is + available in the order book. +

    +

    + To view how we model Oanda order fills, see + + Fills + + . +

    + + + +

    Settlements

    - We fill market orders immediately and completely in backtests. In live trading, if the quantity of your market - orders exceeds the quantity available at the top of the order book, your orders are filled according to what is - available in the order book. + Trades settle immediately after the transaction

    - To view how we model TT order fills, see - - Fills + To view how we model settlement for Oanda trades, see + + Settlement .

    @@ -25518,21 +25669,21 @@

    Security and Stability

    - Note the following security and stability aspects of our TT integration. + Note the following security and stability aspects of our Oanda integration.

    Account Credentials

    - When you deploy live algorithms with TT, we don't save your brokerage account credentials. + When you deploy live algorithms with Oanda, we don't save your brokerage account credentials.

    API Outages

    - We call the TT API to place live trades. Sometimes the API may be down. Check the - - TT status page + We call the Oanda API to place live trades. Sometimes the API may be down. Check the + + Oanda status page to see if the API is currently working.

    @@ -25554,14 +25705,14 @@

    Demo Algorithm

    - The following algorithm demonstrates the functionality of the TT brokerage: + The following algorithm demonstrates the functionality of the Oanda brokerage:

    -
    @@ -25571,7 +25722,7 @@

    Demo Algorithm

    -
    @@ -25614,30 +25765,31 @@

    Deploy Live Algorithms

    field and then click - Trading Technologies + Oanda from the drop-down menu.
  • - Enter your TT user name, account name, routing sender, session password, app key, and app secret. + Enter your Oanda account Id and access token.
  • - Our TT integration routes orders via the TT FIX 4.4 Connection. - - Contact your TT representative + To get your account ID and access token, see the + + Create an Account + + section in the + + Account Types - to set the exchange where you would like your orders sent. Your account details are not saved on QuantConnect. + documentation. Your account details are not saved on QuantConnect.

    -

    - Our integration fetches your positions using the REST endpoint, so the app key and app secret are your REST App credentials. -

  • Click the Environment - field and then click one of the environments from the drop-down menu. + field and then click one of the environments.
  • The following table shows the supported environments: @@ -25656,22 +25808,18 @@

    Deploy Live Algorithms

    @@ -25683,36 +25831,6 @@

    Deploy Live Algorithms

    field and then click the live trading node that you want to use from the drop-down menu. -
  • - If your brokerage account has existing cash holdings, follow these steps ( - - see video - - ): -
  • -
      -
    1. - In the - - Algorithm Cash State - - section, click - - Show - - . -
    2. -
    3. - Click - - Add Currency - - . -
    4. -
    5. - Enter the currency ticker (for example, USD or CAD) and a quantity. -
    6. -
  • (Optional) @@ -25746,7 +25864,7 @@

    Deploy Live Algorithms

    The deployment process can take up to 5 minutes. When the algorithm deploys, the - + live results page displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings. @@ -25755,11 +25873,11 @@

    Deploy Live Algorithms

     

    - +
    -
    +

    Brokerages

    -

    Wolverine

    +

    Samco

    Introduction

    @@ -25769,12 +25887,12 @@

    Introduction

    QuantConnect enables you to run your algorithms in live mode with real-time market data. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015.

    - Wolverine Execution Services is a diversified financial institution specializing in proprietary trading, asset management, order execution services, and technology solutions. They are recognized as a market leader in derivatives valuation, trading, and value-added order execution across global Equity, Options, and Futures markets. Their focus on innovation, achievement, and integrity serves the interests of their clients and colleagues. Wolverine Execution Services is headquartered in Chicago, with branch offices in New York, San Francisco, and London. They serve funds that have at least $5M assets under management. + Samco was founded by Jimeet Modi in 2015 with a mission of providing retail investors access to sophisticated financial technology that can assist retail investors in creating wealth at a low cost. Samco provides access to India Equities for clients in India with no minimum balance. Samco also provides stock ratings, mutual funds, and a mini-portfolio investment platform.

    - To view the implementation of the Wolverine Execution Services brokerage integration, see the - - Lean.Brokerages.Wolverine repository + To view the implementation of the Samco brokerage integration, see the + + Lean.Brokerages.Samco repository .

    @@ -25785,47 +25903,35 @@

    Account Types

    - Wolverine Execution Services supports cash and margin accounts. To set the account type in an algorithm, see the - - Wolverine brokerage model documentation + Samco supports cash and margin accounts. To set the account type in an algorithm, see the + + Samco brokerage model documentation .

    +

    + Samco only supports trading in Indian Rupees, so + + set the account currency of your algorithm + + to INR. +

    Create an Account

    - To create a Wolverine Execution Services account, - - contact their staff + Follow the + + account creation wizard - through the TradeWex website. + on the Samco website to create a Samco account.

    Paper Trading

    - Wolverine Execution Services doesn't support paper trading, but you can follow these steps to simulate it: + Samco doesn't support paper trading.

    -
      -
    1. - In the - - Initialize - - method of your algorithm, add one of the preceding - - SetBrokerageModel - - method calls. -
    2. -
    3. - - Deploy your algorithm with the QuantConnect Paper Trading brokerage - - . -
    4. -
    @@ -25833,15 +25939,18 @@

    Asset Classes

    - Our Wolverine Execution Services integration supports trading - - US Equities - - . -

    -

    - You may not be able to trade all assets with Wolverine. For example, if you live in the EU, you can't trade US ETFs. Check with your local regulators to know which assets you are allowed to trade. You may need to adjust settings in your brokerage account to live trade some assets. + Our Samco integration supports trading the following asset classes:

    + @@ -25850,10 +25959,10 @@

    Data Providers

    The - - QuantConnect data provider + + Samco data provider - provides US Equities data during live trading. + provides India Equities data during live trading.

    @@ -25862,7 +25971,7 @@

    Orders

    - We model the Wolverine Execution Services API by supporting order types, but not order updates or extended market hours trading. When you deploy live algorithms, you can + We model the Samco API by supporting several order types, supporting order properties, and order updates. When you deploy live algorithms, you can place manual orders @@ -25872,31 +25981,65 @@

    Order Types

    - Our Wolverine Execution Services integration supports - - market orders - - . -

    -

    - Updates -

    -

    - We model the Wolverine Execution Services API by not supporting order updates. -

    -

    - Extended Market Hours -

    -

    - Wolverine Execution Services doesn't support extended market hours trading. If you place an order outside of regular trading hours, the order is invalid. + The following table describes the available order types for each asset class that our Samco integration supports:

    +
  • Order Type - Futures + + Forex + + CFD
    green check + green check +
    @@ -25364,6 +25530,9 @@

    green check + green check +
    @@ -25374,13 +25543,6 @@

    green check
    - - StopLimitOrder - - green check
    - Live + Real - Trade in the production environment + Trade real money with fxTrade
    - UAT + Demo - Trade in the - - User Acceptance Testing - - environment + Trade paper money with fxTrade Practice
    + + + + + + + + + + + + + + + + + + + + +
    + Order Type + + India Equity +
    + + MarketOrder + + + green check +
    + + LimitOrder + + + green check +
    + + StopMarketOrder + + + green check +
    +

    Order Properties

    - We model custom order properties from the Wolverine API. The following table describes the members of the + We model custom order properties from the Samco API. The following table describes the members of the - WolverineOrderProperties + IndiaOrderProperties object that you can set to customize order execution:

    @@ -25915,24 +26058,20 @@

    - TimeInForce - - - - A - - TimeInForce - - instruction to apply to the order. The following instructions are supported: + Exchange + + + + Select the exchange for sending the order to. The following instructions are available:
    • - Day + NSE
    • - GoodTilCanceled + BSE
    @@ -25941,36 +26080,94 @@

    - Exchange + ProductType - Defines the exchange name for a particular market. For example, + A - Exchange.SMART + ProductType + + instruction to apply to the order. The + + IndiaProductType + enumeration has the following members: +
    +
    - ExchangePostFix + TimeInForce - The exchange post fix to apply if any. For example, if you set - - Exchange - - to - - Exchange.SMART - - , then "-INCA-TX" yields "SMART-INCA-TX" + A + + TimeInForce + + instruction to apply to the order. The following instructions are available: +
      +
    • + + Day + +
    • +
    • + + GoodTilCanceled + +
    • +
    • + + GoodTilDate + +
    • +
    +

    + Updates +

    +

    + We model the Samco API by supporting + + order updates + + . +

    +

    + Handling Splits +

    +

    + If you're using raw + + data normalization + + and you have active orders with a limit, stop, or trigger price in the market for a US Equity when a + + stock split + + occurs, the following properties of your orders automatically adjust to reflect the stock split: +

    +
      +
    • + Quantity +
    • +
    • + Limit price +
    • +
    • + Stop price +
    • +
    • + Trigger price +
    • +
    @@ -25978,8 +26175,12 @@

    Fees

    - Wolverine Execution Services charge $0.005 per share you trade. To view how we model their fees, see - + To view the Samco trading fees, see the + + Regulatory and Exchanges Charges + + page on the Samco website. To view how we model their fees, see + Fees . @@ -25992,22 +26193,14 @@

    Margin

    We model - + buying power and margin calls - to ensure your algorithm stays within the margin requirements. If you have more than $25,000 in your brokerage account, you can use the - - PatternDayTradingMarginModel - - to make use of the 4x intraday leverage and 2x overnight leverage available on most brokerages from the - - PDT rule - - . + to ensure your algorithm stays within the margin requirements.

    @@ -26016,11 +26209,11 @@

    Slippage

    - Orders through Wolverine Execution Services do not experience slippage in backtests. In live trading, your orders may experience slippage. + Orders through Samco do not experience slippage in backtests. In live trading, your orders may experience slippage.

    - To view how we model Wolverine slippage, see - + To view how we model Samco slippage, see + Slippage . @@ -26037,8 +26230,8 @@

    Fills

    available in the order book.

    - To view how we model Wolverine Execution Services order fills, see - + To view how we model Samco order fills, see + Fills . @@ -26053,8 +26246,8 @@

    Settlements

    If you trade with a margin account, trades settle immediately

    - To view how we model settlement for Wolverine trades, see - + To view how we model settlement for Samco trades, see + Settlement . @@ -26066,7 +26259,7 @@

    Security and Stability

    - When you deploy live algorithms with Wolverine Execution Services, we don't save your brokerage account credentials. + When you deploy live algorithms with Samco, we don't save your brokerage account credentials.

    @@ -26086,14 +26279,14 @@

    Demo Algorithm

    - The following algorithm demonstrates the functionality of the Wolverine Execution Services brokerage: + The following algorithm demonstrates the functionality of the Samco brokerage:

    -
    @@ -26103,7 +26296,7 @@

    Demo Algorithm

    -
    @@ -26146,83 +26339,80 @@

    Deploy Live Algorithms

    field and then click - Wolverine Execution Services + Samco from the drop-down menu.
  • - Enter your Wolverine Execution Services credentials. + Enter your client ID, password, and date of birth.
  • - Your account details are not saved on QuantConnect. + Your account details aren't saved on QuantConnect.

  • Click the - Node + Product Type - field and then click the live trading node that you want to use from the drop-down menu. -
  • -
  • - If your brokerage account has existing cash holdings, follow these steps ( - - see video - - ): + field and then click one of the following options from the drop-down menu:
  • -
      -
    1. - In the - - Algorithm Cash State - - section, click - - Show - - . -
    2. -
    3. - Click - - Add Currency - - . -
    4. -
    5. - Enter the currency ticker (for example, USD or CAD) and a quantity. -
    6. -
    + + + + + + + + + + + + + + + + + + + + + +
    + Product Type + + Description +
    + + MIS + + + Intraday products +
    + + CNC + + + Delivery products +
    + + NRML + + + Carry forward products +
    +
  • - If your brokerage account has existing position holdings, follow these steps ( - - see video - - ): -
  • -
      -
    1. - In the - - Algorithm Holdings State - - section, click - - Show - - . -
    2. -
    3. - Click - - Add Holding - - . -
    4. -
    5. - Enter the symbol ID, symbol, quantity, and average price. -
    6. -
    + Click the + + Node + + field and then click the live trading node that you want to use from the drop-down menu. +
  • (Optional) @@ -26256,7 +26446,7 @@

    Deploy Live Algorithms

    The deployment process can take up to 5 minutes. When the algorithm deploys, the - + live results page displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings. @@ -26265,11 +26455,11 @@

    Deploy Live Algorithms

     

    - +
    -
    +

    Brokerages

    -

    Zerodha

    +

    TD Ameritrade

    Introduction

    @@ -26279,12 +26469,16 @@

    Introduction

    QuantConnect enables you to run your algorithms in live mode with real-time market data. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015.

    - Zerodha was founded by Nithin Kamath in 2010 with the goal to break all barriers that traders and investors face in India in terms of cost, support, and technology. Zerodha provides access to India Equities for clients in India with no minimum balance required. Zerodha also provides a mutual fund investment platform and an interactive portfolio dashboard. + TD Ameritrade was founded by Joe Ricketts in 1971 with the goal to make "smart investors smarter through award-winning trading technology, education, and service". TD Ameritrade provides access to trading Equities, Options, Futures, Forex, Crypto, and other assets for clients with + + no minimum deposit + + . TD Ameritrade also provides a collateral lending program, education services, and a desktop trading platform.

    - To view the implementation of the Zerodha brokerage integration, see the - - Lean.Brokerages.Zerodha repository + To view the implementation of the TD Ameritrade brokerage integration, see the + + Lean.Brokerages.TDAmeritrade repository .

    @@ -26295,95 +26489,118 @@

    Account Types

    - Zerodha supports cash and margin accounts. To set the account type in an algorithm, see the - - Zerodha brokerage model documentation + TD Ameritrade supports cash and margin accounts. To set the account type in an algorithm, see the + + TD Ameritrade brokerage model documentation .

    -

    - Zerodha only supports trading Indian Rupees, so - - set the account currency of your algorithm - - to INR. -

    Create an Account

    - To create a Zerodha account, follow the - + Follow the + account creation wizard - on the Zerodha website. + on the TD Ameritrade website to create a TD Ameritrade account.

    - You will need API credentials to deploy live algorithms with your brokerage account. After you open your Zerodha account, follow these steps to get your API credentials: + You will need API credentials to deploy live algorithms with your brokerage account. You can't create new API credentials due to the + + Trader API Schwab Integration + + . +

    +

    + If you have the API key, follow these steps to retrieve the access token:

    1. - - Create a Kite Connect developer account - - . -
    2. -
    3. - On the My apps page, click - - Create new app - - . + Open https://auth.tdameritrade.com/oauth?client_id= + + your-api-key + + %40AMER.OAUTHAP&response_type=code&redirect_uri=http%3A%2F%2Flocalhost.
    4. - On the Create a new app page, fill in the form. + On the Secure Log-In page, log in with a TD Ameritrade client account.
    5. -

      - For the - - Redirect URL - - field, if you don't have a redirect URL, use https://zerodha.com. -

    6. Click - Create + Allow .
    7. - Copy and save your API key and API secret. + Get the access token from the page URL (for example, http://localhost/?code= + + this-blob-is-your-access-code + + ).
    8. +
    +

    + The redirect URI must use + + http + + . + + https + + isn't supported. +

    +

    + See the following resources for additional information: +

    +
    • - In a terminal, run the following Python script: -
      -
      from kiteconnect import KiteConnect
      -import webbrowser
      -
      -api_key = input ("Enter your API key: ")
      -kite = KiteConnect(api_key=api_key)
      -​webbrowser.open(kite.login_url())
      -request_token = input ("Enter your request_token: ")
      -api_secret = input ("Enter your API secret: ")
      -data = kite.generate_session(request_token, api_secret=api_secret)
      -kite.set_access_token(data["access_token"])
      -print(f"Your access_token is {data['access_token']}")
      -
      -

      - Input the data that the script requests. When the script opens your redirect URL page, log in and then copy the request token that's in the URL parameters. -

      -

      - When the script prints your access token. Copy and save it somewhere safe. -

      + + Authentication FAQ + + on the TD Ameritrade website
    • - +
    • + + TD Ameritrade API Access - 2019 Guide + + on r/algotrading +
    • +

      + In this tutorial, the access token is decoded. QuantConnect's implementation requires the encoded access token (see + + this-blob-is-your-access-code + + above). +

      +

    Paper Trading

    - Zerodha doesn't support paper trading. + The TD Ameritrade API doesn't support paper trading, but you can follow these steps to simulate it:

    +
      +
    1. + In the + + Initialize + + method of your algorithm, add one of the preceding + + SetBrokerageModel + + method calls. +
    2. +
    3. + + Deploy your algorithm with the QuantConnect Paper Trading brokerage + + . +
    4. +
    @@ -26391,12 +26608,15 @@

    Asset Classes

    - Our Zerodha integration supports trading - - Indian Equities + Our TD Ameritrade integration supports trading + + US Equities .

    +

    + You may not be able to trade all assets with TD Ameritrade. For example, if you live in the EU, you can't trade US ETFs. Check with your local regulators to know which assets you are allowed to trade. You may need to adjust settings in your brokerage account to live trade some assets. +

    @@ -26405,10 +26625,10 @@

    Data Providers

    The - - Zerodha data provider + + QuantConnect data provider - provides India Equities data during live trading. + provides US Equity data during live trading.

    @@ -26417,7 +26637,11 @@

    Orders

    - We model the Zerodha API by supporting several order types, order properties, and order updates. When you deploy live algorithms, you can + We model the TD Ameritrade API by supporting several order types, the + + TimeInForce + + order property, and order updates. When you deploy live algorithms, you can place manual orders @@ -26427,7 +26651,7 @@

    Order Types

    - The following table describes the available order types for each asset class that our Zerodha integration supports: + The following table describes the available order types for each asset class that our TD Ameritrade integration supports:

    @@ -26435,8 +26659,8 @@

    - @@ -26463,134 +26687,64 @@

    - - - - - - - -
    Order Type - India Equity + + Equity
    - - StopMarketOrder - - - green check -
    - - StopLimitOrder - - - green check -
    - -

    - Order Properties -

    -

    - We model custom order properties from the Zerodha API. The following table describes the members of the - - IndiaOrderProperties - - object that you can set to customize order execution: -

    - - - - - - - - - - - - - -
    - Property - - Description -
    - - Exchange - - - Select the exchange for sending the order to. The following instructions are supported: -
      -
    • - - NSE - -
    • -
    • - - BSE - -
    • -
    -
    - - ProductType - + + StopMarketOrder + - A - - ProductType - - instruction to apply to the order. The - - IndiaProductType - - enumeration has the following members: -
    -
    + green check
    - - TimeInForce - + + StopLimitOrder + - A - - TimeInForce - - instruction to apply to the order. The following instructions are supported: -
      -
    • - - Day - -
    • -
    • - - GoodTilCanceled - -
    • -
    • - - GoodTilDate - -
    • -
    + green check
    + +

    + Time In Force +

    +

    + We model the TD Ameritrade API by supporting the following + + TimeInForce + + instructions: +

    +
      +
    • + + Day + +
    • +
    • + + GoodTilCanceled + +
    • +
    • + + GoodTilDate + +
    • +

    Updates

    - We model the Samco Zerodha by supporting + We model the TD Ameritrade API by supporting order updates @@ -26631,12 +26785,12 @@

    Fees

    - To view the Zerodha trading fees, see the - - Charges + To view the TD Ameritrade trading fees, see the + + Pricing - page on the Zerodha website. To view how we model their fees, see - + page on the TD Ameritrade website. To view how we model their fees, see + Fees . @@ -26649,18 +26803,22 @@

    Margin

    We model - + buying power and margin calls - to ensure your algorithm stays within the margin requirements. The amount of margin available depends on the Equity and product type. To check the amount of margin available for each asset, see the - - Margin Calculator + to ensure your algorithm stays within the margin requirements. If you have more than $25,000 in your brokerage account, you can use the + + PatternDayTradingMarginModel + + to make use of the 4x intraday leverage and 2x overnight leverage available on most brokerages from the + + PDT rule - on the Zerodha website. + .

    @@ -26669,11 +26827,11 @@

    Slippage

    - Orders through Zerodha do not experience slippage in backtests. In live trading, your orders may experience slippage. + Orders through TD Ameritrade do not experience slippage in backtests. In paper trading and live trading, your orders may experience slippage.

    - To view how we model Zerodha slippage, see - + To view how we model TD Ameritrade slippage, see + Slippage . @@ -26690,8 +26848,8 @@

    Fills

    available in the order book.

    - To view how we model Zerodha order fills, see - + To view how we model TD Ameritrade order fills, see + Fills . @@ -26706,8 +26864,8 @@

    Settlements

    If you trade with a margin account, trades settle immediately

    - To view how we model settlement for Zerodha trades, see - + To view how we model settlement for TD Ameritrade trades, see + Settlement . @@ -26719,7 +26877,7 @@

    Security and Stability

    - When you deploy live algorithms with Zerodha, we don't save your brokerage account credentials. + When you deploy live algorithms with TD Ameritrade, we don't save your brokerage account credentials.

    @@ -26739,14 +26897,14 @@

    Demo Algorithm

    - The following algorithm demonstrates the functionality of the Zerodha brokerage: + The following algorithm demonstrates the functionality of the TD Ameritrade brokerage:

    -
    @@ -26756,7 +26914,7 @@

    Demo Algorithm

    -
    @@ -26777,151 +26935,41 @@

    Deploy Live Algorithms

    Follow these steps to deploy a live algorithm:

    -
      -
    1. - - Open the project - - you want to deploy. -
    2. -
    3. - Click the - Lightning icon - - Deploy Live - - icon. -
    4. -
    5. - On the Deploy Live page, click the - - Brokerage - - field and then click - - Zerodha - - from the drop-down menu. -
    6. -
    7. - Enter your Kite Connect access token and key. -
    8. -

      - To get your access token and key, see - - Account Types - - . Your account details aren't saved on QuantConnect. -

      -
    9. - Click the - - Product Type - - field and then click one of the following options from the drop-down menu: -
    10. - - - - - - - - - - - - - - - - - - - - - -
      - Product Type - - Description -
      - - MIS - - - Intraday products -
      - - CNC - - - Delivery products -
      - - NRML - - - Carry forward products -
      -
    11. - Click the - - Trading Segment - - field and then click one of the following options from the drop-down menu: -
    12. - - - - - - - - - - - - - - - - - -
      - Trading Segment - - Description -
      - - EQUITY - - - For trading Equities on the National Stock Exchange of India (NSE) or the Bombay Stock Exchange (BSE) -
      - - COMMODITY - - - For trading commodities on the Multi Commodity Exchange of India (MCX) -
      +
        +
      1. + + Open the project + + you want to deploy. +
      2. Click the + Lightning icon + + Deploy Live + + icon. +
      3. +
      4. + On the Deploy Live page, click the - History Subscription + Brokerage field and then click - Yes - - or - - No + TD Ameritrade from the drop-down menu.
      5. +
      6. + Enter your TD Ameritrade account ID, key, and token. +
      7. - Use this field to declare whether you have a history API subscription on your Kite Connect account. + To get your account credentials, see + + Account Types + + . Your account details are not saved on QuantConnect.

      8. Click the @@ -26963,7 +27011,7 @@

        Deploy Live Algorithms

      The deployment process can take up to 5 minutes. When the algorithm deploys, the - + live results page displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings. @@ -26972,11 +27020,11 @@

      Deploy Live Algorithms

       

      - +
      -
      +

      Brokerages

      -

      Bloomberg EMSX

      +

      Tradier

      Introduction

      @@ -26985,14 +27033,17 @@

      Introduction

      QuantConnect enables you to run your algorithms in live mode with real-time market data. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015.

      - Terminal link icon

      - QuantConnect can integrate with the Bloombergâ„¢ Server API (SAPI) or Desktop API (DAPI) in different cloud environments. This integration allows research, backtesting, opitimization, and live trading through the Bloomberg APIs. Terminal Link is in no way affiliated with or endorsed by Bloombergâ„¢; it is simply an add-on. Add Terminal link to your organization to access the 1,300+ prime brokerages in the Bloomberg Execution Management System network. + Tradier was founded by Dan Raju, Peter Laptewicz, Jason Barry, Jeyashree Chidambaram, and Steve Agalloco in 2012 with the goal to "deliver a choice of low-cost, high-value brokerage services to traders". Tradier provides access to trading Equities and Options for clients in over 250 countries and territories with + + no minimum deposit for cash accounts + + . Tradier also delivers custody, clearing, execution, and billing on behalf of registered advisors.

      - QuantConnect Cloud only supports routing trades to the Bloombergâ„¢ Server API. In this environment, you can route orders to any of the prime brokerages that Bloomberg supports and you get to leverage the data, server management, and data management from QuantConnect, giving you the best of both worlds. To use Terminal Link, you need to be a member of an organization on the Trading Firm or Institution - - tier + To view the implementation of the Tradier brokerage integration, see the + + Lean.Brokerages.Tradier repository .

      @@ -27003,482 +27054,259 @@

      Account Types

      - Terminal Link supports order routing via the Bloombergâ„¢ EMSX network. It's a margin account that's similiar to a FIX API, where you set the buying power in the wizard when you're deploying to a professional prime brokerage account. + Tradier supports cash and margin accounts. To set the account type in an algorithm, see the + + Tradier brokerage model documentation + + .

      - - - -

      Data Providers

      - - +

      + Create an Account +

      - To use the Bloombergâ„¢ EMSX network and SAPI on QuantConnect, you must use the - - QuantConnect data provider + Follow the + + account creation wizard - . + on the Tradier website to create a Tradier account.

      - - - -

      Asset Classes

      - -

      - Terminal Link supports trading the following asset classes: + You will need your account ID and access token to deploy live algorithms. After you have an account, get your account ID and token from the + + Settings > API Access + + page on the Tradier website. Your account ID is the alpha-numeric code in a drop-down field on the page. +

      +

      + Paper Trading +

      +

      + Tradier supports paper trading, but with the following caveats:

      +

      + To get your paper trading account number and access token, open the + + API Access + + page on the Tradier website and then scroll down to the + + Sandbox Account Access (Paper Trading) + + section. +

      +

      + If you trade Equities, you can use the + + QuantConnect data provider + + to get real-time data. If you trade Options, you must use delayed data from the + + Tradier data provider + + . If you trade Equities and Options, use the Tradier data provider. We don't currently have a hybrid QuantConnect-Tradier data provider. If you trade with the demo environment, Tradier doesn't offer streaming market data due to exchange restrictions related to delayed data, so you must use our data provider. +

      -

      Orders

      +

      Asset Classes

      - Terminal Link enables you to create and manage Bloombergâ„¢ orders. -

      -

      - Order Types -

      -

      - The following table describes the available order types for each asset class that Terminal Link supports: -

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      - Order Type - - Equity - - Equity Options - - Futures - - Index Options -
      - - MarketOrder - - - green check - - green check - - green check - - green check -
      - - LimitOrder - - - green check - - green check - - green check - - green check -
      - - StopMarketOrder - - - green check - - green check - - green check - - green check -
      - - StopLimitOrder - - - green check - - green check - - green check - - green check -
      - -

      - Order Properties -

      + Our Tradier integration supports trading + + US Equities + + and + + Equity Options + + . +

      - We model custom order properties from the Bloomberg EMSX API. The following table describes the members of the + You may not be able to trade all assets with Tradier. For example, if you live in the EU, you can't trade US ETFs. Check with your local regulators to know which assets you are allowed to trade. You may need to adjust settings in your brokerage account to live trade some assets. +

      + + + +

      Data Providers

      + + +

      + You might need to purchase a + + Tradier market data + + subscription for your trading. For more information about live data providers, see + + Datasets + + . +

      + + + +

      Orders

      + + +

      + We model the Tradier API by supporting several order types and the - TerminalLinkOrderProperties + TimeInForce - object that you can set to customize order execution: + order property. Tradier partially supports order updates, but does not support trading during extended market hours. When you deploy live algorithms, you can + + place manual orders + + through the IDE.

      - +

      + Order Types +

      +

      + The following table describes the available order types for each asset class that our Tradier integration supports: +

      +
      + - - - - - - - - - - - - - - - - - - - - - - - - -
      + Order Type + - Property + Equity - Description + + Equity Options
      - - TimeInForce - - - A - - TimeInForce + + MarketOrder - instruction to apply to the order. The following instructions are supported: -
        -
      • - - Day - -
      • -
      • - - GoodTilCanceled - -
      • -
      • - - GoodTilDate - -
      • -
      - - Notes - - - The free form instructions that may be sent to the broker. -
      - - HandlingInstruction - + green check - The instructions for handling the order or route. The values can be preconfigured or a value customized by the broker. + green check
      - - CustomNotes1 - - - Custom user order notes 1. For more information about custom order notes, see - - Custom Notes & Free Text Fields + + LimitOrder - in the EMSX API documentation -
      - - CustomNotes2 - - - Custom user order notes 2. -
      - - CustomNotes3 - - - Custom user order notes 3.
      - - CustomNotes4 - + green check - Custom user order notes 4. + green check
      - - CustomNotes5 - - - Custom user order notes 5. + + StopMarketOrder +
      - - Account - + green check - The EMSX account. + green check
      - - Broker - - - The EMSX broker code. + + StopLimitOrder +
      - - Strategy - + green check - A - - StrategyParameters - - object that represents the EMSX order strategy details. You must append strategy parameters in the order that the EMSX API expects. - The following strategy names are supported: "DMA", "DESK", "VWAP", "TWAP", "FLOAT", "HIDDEN", "VOLUMEINLINE", "CUSTOM", "TAP", "CUSTOM2", "WORKSTRIKE", "TAPNOW", "TIMED", "LIMITTICK", "STRIKE" + green check
      -
      -
      public override void Initialize()
      -{
      -    // Set the default order properties
      -    DefaultOrderProperties = new TerminalLinkOrderProperties
      -    {
      -        TimeInForce = TimeInForce.GoodTilCanceled,
      -        Strategy = new TerminalLinkOrderProperties.StrategyParameters(
      -            "VWAP",
      -            new List<TerminalLinkOrderProperties.StrategyField>
      -            {
      -                new("09:30:00"),
      -                new("10:30:00"),
      -                new(),
      -                new()
      -            }
      -         )
      -    };
      -}
      -
      -public override void OnData(Slice slice)
      -{
      -    // Use default order order properties
      -    LimitOrder(_symbol, quantity, limitPrice);
      -    
      -    // Override the default order properties
      -    LimitOrder(_symbol, quantity, limitPrice, 
      -               orderProperties: new TerminalLinkOrderProperties
      -               { 
      -                   TimeInForce = TimeInForce.Day,
      -                   Account = "account1"
      -               });
      -    LimitOrder(_symbol, quantity, limitPrice, 
      -               orderProperties: new TerminalLinkOrderProperties
      -               { 
      -                   TimeInForce = TimeInForce.GoodTilDate(new DateTime(year, month, day)),
      -                   Account = "account2"
      -               });
      -}
      -
      def Initialize(self) -> None:
      -    # Set the default order properties
      -    self.DefaultOrderProperties = TerminalLinkOrderProperties()
      -    self.DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled
      -    self.DefaultOrderProperties.Strategy = TerminalLinkOrderProperties.StrategyParameters(
      -        "VWAP",
      -        [
      -            TerminalLinkOrderProperties.StrategyField("09:30:00"),
      -            TerminalLinkOrderProperties.StrategyField("10:30:00"),
      -            TerminalLinkOrderProperties.StrategyField(),
      -            TerminalLinkOrderProperties.StrategyField()
      -        ]
      -    )
      -
      -def OnData(self, slice: Slice) -> None:
      -    # Use default order order properties
      -    self.LimitOrder(self.symbol, quantity, limit_price)
      -    
      -    # Override the default order properties
      -    order_properties = TerminalLinkOrderProperties()
      -    order_properties.TimeInForce = TimeInForce.Day
      -    order_properties.Account = "account1"
      -    self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)
      -
      -    order_properties.TimeInForce = TimeInForce.GoodTilDate(datetime(year, month, day))
      -    order_properties.Account = "account2"
      -    self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)
      -
      -

      - For more information about the format that the Bloomberg EMSX API expects, see - - Create Order and Route Extended Request - - in the EMSX API documentation and the - - createOrderAndRouteWithStrat documentation - - on the MathWorks website. -

      +

      - Get Open Orders + Time In Force

      - Terminal Link lets you - - access open orders + We model the Tradier API by supporting the following + + TimeInForce - . + instructions:

      +
        +
      • + + Day + +
      • +
      • + + GoodTilCanceled + + (not available for short selling) +
      • +

      - Monitor Fills + Updates

      - Terminal Link allows you to monitor orders as they fill through - - order events + We model the Tradier API by supporting most + + order updates + + . To update the quantity of an order, cancel the order and then submit a new order with the desired quantity. For more information about this workaround, see the + + Workaround for Brokerages That Don’t Support Updates .

      - Updates + Extended Market Hours

      - Terminal Link doesn't support - - order updates - - . + Tradier doesn't support extended market hours trading. If you place an order outside of regular trading hours, the order will be processed at market open.

      - Cancellations + Automatic Cancellations

      - Terminal Link enables you to - - cancel open orders - - . + If you have open orders for a security when it performs a reverse split, Tradier automatically cancels your orders.

      - Handling Splits + Errors

      - If you're using raw - - data normalization - - and you have active orders with a limit, stop, or trigger price in the market for a US Equity when a - - stock split + To view the order-related error codes from Tradier, see + + Error Responses - occurs, the following properties of your orders automatically adjust to reflect the stock split: + in their documentation.

      -
        -
      • - Quantity -
      • -
      • - Limit price -
      • -
      • - Stop price -
      • -
      • - Trigger price -
      • -
      @@ -27486,8 +27314,12 @@

      Fees

      - Orders filled with Terminal Link are subject to the fees of the Bloombergâ„¢ Execution Management System and your prime brokerage destination. To view how we model their fees, see - + To view the Tradier trading fees, see the + + Pricing + + page on the Tradier website. To view how we model their fees, see + Fees . @@ -27499,293 +27331,145 @@

      Margin

      - Set your cash and holdings state in the wizard when you deploy to the Bloombergâ„¢ EMSX environment. We use these states to model - + We model + buying power and margin calls - to ensure your algorithm stays within the margin requirements. -

      - - - -

      Fills

      - - -

      - In live trading, LEAN routes your orders to the exchange or prime brokerage you select. The order fills and then routes back to you. -

      -

      - To view how we model Bloombergâ„¢ Execution Management System order fills, see - - Fills + to ensure your algorithm stays within the margin requirements. If you have more than $25,000 in your brokerage account, you can use the + + PatternDayTradingMarginModel + + to make use of the 4x intraday leverage and 2x overnight leverage available on most brokerages from the + + PDT rule .

      -

      Compliance

      - - -

      - Bloombergâ„¢ is not affiliated with QuantConnect, nor does it endorse Terminal Link. A Bloombergâ„¢ SAPI permission and EMSX permission is required to use this brokerage connection, along with a Trading Firm or Institutional subscription on QuantConnect. -

      -

      - The following rules apply: -

      -
        -
      • - All users of the integration must hold a Bloomberg License to be defined as an "Entitled User". -
      • -
      • - The Bloomberg SAPI will only be used for order routing and no data is permitted. The Bloomberg SAPI cannot be used for black-box trading. -
      • -
      -

      - The following table shows the activities each of the Bloomberg technologies support: -

      - - - - - - - - - - - - - - - - - - - -
      - Technology - - Research - - Backtesting - - Paper UAT Trading - - Live Trading -
      - Server API - - green check - - green check - - green check - - green check -
      - - - - -

      Set Up SAPI

      +

      Slippage

      - The following few sections explain how to download the Bloombergâ„¢ Server API (SAPI), install it on a cloud server, and add firewall rules so it can connect to QuantConnect Cloud. -

      -

      - Download SAPI -

      -

      - Follow these steps to download the SAPI: + Orders through Tradier do not experience slippage in backtests. In live trading, your orders may experience slippage. +

      +

      + To view how we model Tradier slippage, see + + Slippage + + . +

      + + + +

      Fills

      + + +

      + We fill market orders immediately and completely in backtests. In live trading, if the quantity of your market + orders exceeds the quantity available at the top of the order book, your orders are filled according to what is + available in the order book. +

      +

      + To view how we model Tradier order fills, see + + Fills + + . +

      + + + +

      Settlements

      + + +

      + If you trade with a margin account, trades settle immediately +

      +

      + To view how we model settlement for Tradier trades, see + + Settlement + + . +

      + + + +

      Security and Stability

      + + +

      + Note the following security and stability aspects of our Tradier integration.

      -
        -
      1. - - Install the Bloombergâ„¢ Terminal - - . -
      2. -
      3. - - Create a Bloombergâ„¢ Terminal account - - . -
      4. -
      5. - In the Bloombergâ„¢ Terminal, run - - WAPI<GO> - - . -
      6. -
      7. - On the API Developer's Help Site, click - - EMSX API - - . -
      8. - -
      9. - On the EMSX API page, under the - - Server API Process - - section, click - - Link - - . -
      10. - -
      11. - On the Server API Software Install page, click the correct - - download - - icons. -
      12. - -
      13. - Click - - System Requirements - - . -
      14. - -

      - Install the SAPI + Account Credentials

      - Follow these steps to install the SAPI: + When you deploy live algorithms with Tradier, we don't save your brokerage account credentials.

      -
        -
      1. - Spin up an E12x9 AWS instance or higher that your organization controls. -
      2. -
      3. - Run the SAPI installer on the cloud server. -
      4. -

        - For more information about this step, see - - How to install serverapi.exe - - in the EMSX API Programmers Guide. At the end of the installion, you get a registration key. -

        -
      5. - Ask Bloombergâ„¢ Support to activate your registration key. -
      6. -
      7. - Start the serverapi program. -
      8. -

        - On Windows, the default location is - - C: \ BLP \ ServerApi \ bin \ serverapi.exe - - . -

        -

      - Add Firewall Rules + API Outages

      - Follow these steps to configure the firewall rules on the AWS instance so that the SAPI can connect to QuantConnect Cloud: + We call the Tradier API to place live trades. Sometimes the API may be down. Check the + + Tradier status page + + to see if the API is currently working.

      -
        -
      1. - Click - - Start - - . -
      2. -
      3. - Enter - - Windows Defender Firewall with Advanced Security - - and then press - - Enter - - . -
      4. -
      5. - In the left panel, click - - Inbound Rules - - . -
      6. -
      7. - In the right panel, click - - New Rule... - - . -
      8. -
      9. - Follow the prompts to create a program rule for the serverapi. -
      10. -
      11. - In the Windows Defender Firewall with Advanced Security window, double-click the serverapi row. -
      12. -
      13. - In the serverapi window, click the - - Scope - - tab. -
      14. -
      15. - In the - - Remote IP address - - section, add the QuantConnect Cloud IP address, 207.182.16.137. -
      16. -
      17. - Click - - OK - - . -
      18. -
      19. - Add the QuantConnect Cloud IP address to the other row in the table that has the serverapi name. -
      20. -
      -

      Deploy Live Algorithms

      +

      Deposits and Withdraws

      - You need to - - set up the Bloomberg SAPI - - before you can deploy cloud algorithms with Terminal Link. + You can deposit and withdraw cash from your brokerage account while you run an algorithm that's connected to the + account. We sync the algorithm's cash holdings with the cash holdings in your brokerage account every day at 7:45 AM + Eastern Time (ET). +

      + + + +

      Demo Algorithm

      + + +

      + The following algorithm demonstrates the functionality of the Tradier brokerage:

      +
      +
      +
      +
      +
      + +
      +
      +
      +
      +
      +
      +
      +
      + +
      +
      +
      + + + +

      Deploy Live Algorithms

      + +

      You must have an available @@ -27818,76 +27502,113 @@

      Deploy Live Algorithms

      field and then click - Terminal Link - - from the drop-down menu. - -
    13. - Click the - - Connection Type - - field and then click - - SAPI + Tradier from the drop-down menu.
    14. - In the - - Server Auth Id - - field, enter your unique user identifier (UUID). -
    15. -

      - The UUID is a unique integer identifier that's assigned to each Bloomberg Anywhere user. If you don't know your UUID, contact Bloomberg. -

      -
    16. - In the - - EMSX Broker - - field, enter the EMSX broker to use. -
    17. -
    18. - In the - - Server Port - - field, enter the port where SAPI is listening. + Enter your Tradier account Id and token.
    19. - The default port is 8194. -

      -
    20. - In the - - Server Host - - field, enter the public IP address of the SAPI AWS server. -
    21. -
    22. - In the - - EMSX Account + To get your account ID and token, see the + + Create an Account - field, enter the account to which LEAN should route orders. -
    23. + section in the +
      + Account Types + + documentation. Your account details are not saved on QuantConnect. +
      +

    24. - In the + Click the - OpenFIGI Api Key + Environment - field, enter your API key. + field and then click one of the environments from the drop-down menu.
    25. +

      + The following table shows the supported environments: +

      + + + + + + + + + + + + + + + + + +
      + Environment + + Description +
      + Real + + Trade with real money +
      + Demo + + Trade with paper money +
    26. Click the - Environment + Data Provider - field and then click one of the options from the drop-down menu. + field and then click one of the data providers from the drop-down menu.
    27. +

      + The following table describes the available data providers: +

      + + + + + + + + + + + + + + + + + +
      + Data Provider + + Description +
      + QuantConnect + + Use data collected across all of the exchanges. For more details about this data provider, see + + Datasets + + . +
      + Tradier + + Use data sourced directly from Tradier. This data provider isn't available for the demo environment. For more details about this data provider, see the + + Tradier data provider + + . +
    28. Click the @@ -27895,66 +27616,6 @@

      Deploy Live Algorithms

      field and then click the live trading node that you want to use from the drop-down menu.
    29. -
    30. - If your brokerage account has existing cash holdings, follow these steps ( - - see video - - ): -
    31. -
        -
      1. - In the - - Algorithm Cash State - - section, click - - Show - - . -
      2. -
      3. - Click - - Add Currency - - . -
      4. -
      5. - Enter the currency ticker (for example, USD or CAD) and a quantity. -
      6. -
      -
    32. - If your brokerage account has existing position holdings, follow these steps ( - - see video - - ): -
    33. -
        -
      1. - In the - - Algorithm Holdings State - - section, click - - Show - - . -
      2. -
      3. - Click - - Add Holding - - . -
      4. -
      5. - Enter the symbol ID, symbol, quantity, and average price. -
      6. -
    34. (Optional) @@ -27988,7 +27649,7 @@

      Deploy Live Algorithms

    The deployment process can take up to 5 minutes. When the algorithm deploys, the - + live results page displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings. @@ -27997,796 +27658,772 @@

    Deploy Live Algorithms

     

    - +
    -
    +

    Brokerages

    -

    FIX Connections

    +

    Trading Technologies

    Introduction

    - The Financial Information eXchange (FIX) is the standard electronic communications protocol for front-office messaging. The FIX community includes about 300 firms, including major investment banks. + QuantConnect enables you to run your algorithms in live mode with real-time market data. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015. +

    +

    + Trading Technologies (TT) was founded by Gary Kemp in 1994 with the goal to create professional trading software, infrastructure, and data solutions for a wide variety of users. TT provides access to trading Futures, Options, and Crypto. TT also provides a charting platform, infrastructure services, and risk management tools. TT is not actually a brokerage. The firm is a brokerage router with access to more than 30 execution destinations. +

    +

    + To view the implementation of the TT integration, see the + + Lean.Brokerages.TradingTechnologies repository + + .

    -

    Supported Connections

    +

    Modeling

    + + +

    + The + + TradingTechnologiesBrokerageModel + + does not have specific modeling for fees and slippage because TT is an order router and can execute on many exchanges and brokerages. To set the brokerage model and account type in an algorithm, see the + + TT brokerage model documentation + + . In live trading, TT reports the total fees of your orders after each order fill. Pass a different + + BrokerageName + + to + + SetBrokerageModel + + to backtest your algorithm with fee and slippage modeling. The brokerage model you set should support the asset classes and orders in your algorithm. +

    +

    + Create an Account +

    +

    + Follow the + + account creation wizard + + on the TT website to create a TT account. +

    +

    + Paper Trading +

    +

    + Our TT integration does not support paper trading through the TT Simulation environment, but you can follow these steps to simulate it: +

    +
      +
    1. + In the + + Initialize + + method of your algorithm, add one of the preceding + + SetBrokerageModel + + method calls. +
    2. +
    3. + + Deploy your algorithm with the QuantConnect Paper Trading brokerage + + . +
    4. +
    + + + +

    Asset Classes

    + + +

    + Our TT integration supports trading + + Futures + + . +

    + + + +

    Data Providers

    + + +

    + The + + QuantConnect data provider + + provides Futures data during live trading. +

    + + + +

    Orders

    - The following FIX connections are available on QuantConnect: + We model the TT API by supporting several order types, the + + TimeInForce + + order property, and order updates. When you deploy live algorithms, you can + + place manual orders + + through the IDE. +

    +

    + Order Types +

    +

    + The following table describes the available order types for each asset class that our TT integration supports:

    - +
    - - + + + + + +
    - Name - - Integration Implementation + + Order Type - Model Implementation + Futures
    - Raiffeisen Bank International + + MarketOrder + - - Lean.Brokerages.RaiffeisenBankInternational - + green check
    - - RBIBrokerageModel.cs + + LimitOrder + green check +
    - - Wolverine + + StopMarketOrder - - Lean.Brokerages.Wolverine - + green check
    - - WolverineBrokerageModel.cs + + StopLimitOrder + green check +
    - - - -

     

    - -
    -
    -

    Brokerages

    -

    Unsupported Brokerages

    -
    -
    -

    Introduction

    - - +

    - New brokerages can be added if the brokerage has an API that is popular, stable, and officially supported by the brokerage. To add a new brokerage to the platform, - - contact us - - . + TT enforces the following order rules:

    - - - -

     

    - -
    -
    -

    Live Trading

    -

    Data Providers

    -
    -
    - - -
    -
    -

    - Data providers provide a stream of asset prices and quotes delivered to your trading algorithm during live execution. You need live data providers to inject data into your algorithm so that you can make real-time trading decisions and so that the values of the securities in your portfolio are updated. You can source data from QuantConnect or your brokerage. -

    -
    - -
    -

    - See Also -

    - - Datasets - -
    - - Brokerages - -
    -
    -
    - - - -

     

    - -
    -
    -

    Data Providers

    -

    QuantConnect

    -
    -
    - -
    -
    -

    QuantConnect

    -

    US Equities

    -
    -
    -

    Introduction

    - - +
      +
    • + If you are buying (selling) with a + + StopMarketOrder + + or a + + StopLimitOrder + + , the stop price of the order must be greater (less) than the current security price. +
    • +
    • + If you are buying (selling) with a + + StopLimitOrder + + , the limit price of the order must be greater (less) than the stop price. +
    • +
    +

    + Time In Force +

    - The QuantConnect data provider provides a stream of US Equity trades and quotes to your trading algorithm during live execution. Live data enables you to make real-time trades and update the value of the securities in your portfolio. + We model the TT API by supporting the + + Day + + and + + GoodTilCanceled + + + TimeInForce + + order properties.

    +

    + Updates +

    - The QuantConnect data provider also provides a live stream of corporate actions (US Equity Security Master), daily updates on company fundamentals (US Fundamentals), and the number of shares that are available for short sellers to borrow (US Equities Short Availability). + We model the TT API by supporting + + order updates + + .

    -

    Sourcing

    +

    Fees

    - The QuantConnect data provider consolidates US Equity market data across all of the exchanges. Over-the-Counter (OTC) trades are excluded. The data is powered by the Securities Information Processor (SIP), so it has 100% market coverage. In contrast, free platforms that display data feeds like the Better Alternative Trading System (BATS) only have - - about 6-7% market coverage + To view the TT trading fees, see the + + Pricing + + page on the TT website. To view how we model their fees, see + + Fees .

    -

    - We provide live splits, dividends, and corporate actions for US companies. We deliver them to your algorithm before the trading day starts. -

    -

    Universe Selection

    +

    Margin

    - The QuantConnect data provider enables you to create a dynamic universe of US Equities. -

    -

    - Fundamental Universe -

    -

    - The live data for fundamental universe selection arrives at 6/7 AM Eastern Time (ET), so fundamental universe selection runs for live algorithms between 7 and 8 AM ET. This timing allows you to place trades before the market opens. Don't schedule anything for midnight because the universe selection data isn't ready yet. -

    -
    -
    UniverseSettings.Asynchronous = true;
    -AddUniverse(SelectFundamental);
    -
    self.UniverseSettings.Asynchronous = True
    -self.AddUniverse(self.SelectFundamental)
    -
    -

    - ETF Constituent Universe -

    -

    - The QuantConnect data provider enables you to create a universe of securities to match the constituents of an ETF. For more information about ETF universes, see - - ETF Constituents Selection + We model + + buying power - . + and + + margin calls + + to ensure your algorithm stays within the margin requirements.

    -
    -
    UniverseSettings.Asynchronous = true;
    -var spy = AddEquity("SPY").Symbol;
    -AddUniverse(Universe.ETF(spy, UniverseSettings, ETFConstituentsFilter));
    -
    self.UniverseSettings.Asynchronous = True
    -spy = self.AddEquity("SPY").Symbol
    -self.AddUniverse(self.Universe.ETF(spy, self.UniverseSettings, self.ETFConstituentsFilter))
    -
    -

    Bar Building

    +

    Slippage

    - We aggregate ticks to build bars. -

    -

    - Discrepancies -

    -

    - In live trading, bars are built using the exchange timestamps with microsecond accuracy. This microsecond-by-microsecond processing - of the ticks can mean that the individual bars between live trading and backtesting can have slightly different ticks. As a result, it's possible for a - tick to be counted in different bars between backtesting and live trading, which can lead to bars having slightly different open, high, low, close, and volume values. -

    -

    - Opening and Closing Auctions -

    -

    - The opening and closing price of the day is set by very specific opening and closing auction ticks. When a stock like Apple is - listed, it’s listed on Nasdaq. The open auction tick on Nasdaq is the price that’s used as the official open of the - day. NYSE, BATS, and other exchanges also have opening auctions, but the only official opening price for Apple is the - opening auction on the exchange where it was listed. + Orders through TT do not experience slippage in backtests. In live trading, your orders may experience slippage.

    - We set the opening and closing prices of the first and last bars of the day to the official auction prices. This - process is used for second, minute, hour, and daily bars for the 9:30 AM and 4:30 PM Eastern Time (ET) prices. - In contrast, other platforms might not be using the correct opening and closing prices. + To view how we model TT slippage, see + + Slippage + + .

    + + + +

    Fills

    + +

    - The official auction prices are usually emitted 2-30 seconds after the market open and close. We do our best - to use the official opening and closing prices in the bars we build, but the delay can be so large that there - isn't enough time to update the opening and closing price of the bar before it's injected into your algorithms. For example, - if you subscribe to second resolution data, we wait until the end of the second for the opening price but most - second resolution data won’t get the official opening price. If you subscribe to minute resolution data, we wait until - the end of the minute for the opening auction price. Most of the time, you’ll get the actual opening auction price - with minute resolution data, but there are always exceptions. Nasdaq and NYSE can have delays in publishing the - opening auction price, but we don’t have control over those issues and we have to emit the data on time so that you - get the bar you are expecting. + We fill market orders immediately and completely in backtests. In live trading, if the quantity of your market + orders exceeds the quantity available at the top of the order book, your orders are filled according to what is + available in the order book.

    -

    - Excluded Ticks -

    - The bar-building process can exclude ticks. If a tick is excluded, its volume is aggregated in the bar but its price is not aggregated in the bar. Ticks are excluded if any of the following statements are true: -

    -
      -
    • - The tick is suspicious. -
    • -
    • - The tick is from the FINRA exchange and meets our price and volume thresholds. -
    • -
    • - The trade has none of the following included - - TradeConditionFlags - - and at least one of the following excluded - - TradeConditionFlags - - : -
    • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      - - TradeConditionFlags - - - Status - - Description -
      - - Regular - - - Included - - A trade made without stated conditions is deemed the regular way for settlement on the third business day following the transaction date. -
      - - FormT - - - Included - - Trading in extended hours enables investors to react quickly to events that typically occur outside regular market hours, such as earnings reports. However, liquidity may be constrained during such Form T trading, resulting in wide bid-ask spreads. -
      - - Cash - - - Included - - A transaction that requires delivery of securities and payment on the same day the trade takes place. -
      - - ExtendedHours - - - Included - - Identifies a trade that was executed outside of regular primary market hours and is reported as an extended hours trade. -
      - - NextDay - - - Included - - A transaction that requires the delivery of securities on the first business day following the trade date. -
      - - OfficialClose - - - Included - - Indicates the "official" closing value determined by a Market Center. This transaction report will contain the market center generated closing price. -
      - - OfficialOpen - - - Included - - Indicates the 'Official' open value as determined by a Market Center. This transaction report will contain the market center generated opening price. -
      - - ClosingPrints - - - Included - - The transaction that constituted the trade-through was a single priced closing transaction by the Market Center. -
      - - OpeningPrints - - - Included - - The trade that constituted the trade-through was a single priced opening transaction by the Market Center. -
      - - IntermarketSweep - - - Excluded - - The transaction that constituted the trade-through was the execution of an order identified as an Intermarket Sweep Order. -
      - - TradeThroughExempt - - - Excluded - - Denotes whether or not a trade is exempt (Rule 611). -
      - - OddLot - - - Excluded - - Denotes the trade is an odd lot less than a 100 shares. -
      + To view how we model TT order fills, see + + Fills + + . +

      + + + +

      Security and Stability

      + + +

      + Note the following security and stability aspects of our TT integration. +

      +

      + Account Credentials +

      +

      + When you deploy live algorithms with TT, we don't save your brokerage account credentials. +

      +

      + API Outages +

      +

      + We call the TT API to place live trades. Sometimes the API may be down. Check the + + TT status page + + to see if the API is currently working. +

      + + + +

      Deposits and Withdraws

      + + +

      + You can deposit and withdraw cash from your brokerage account while you run an algorithm that's connected to the + account. We sync the algorithm's cash holdings with the cash holdings in your brokerage account every day at 7:45 AM + Eastern Time (ET). +

      + + + +

      Demo Algorithm

      + + +

      + The following algorithm demonstrates the functionality of the TT brokerage: +

      +
      +
      +
      +
      +
      + +
      +
      +
      +
      +
      +
      +
      +
      + +
      +
      +
      + + + +

      Deploy Live Algorithms

      + + +

      + You must have an available + + live trading node + + for each live trading algorithm you deploy. +

      +

      + Follow these steps to deploy a live algorithm: +

      +
      1. - The quote has a size of less than 100 shares. + + Open the project + + you want to deploy.
      2. - The quote has one of the following - - QuoteConditionFlags - - : + Click the + Lightning icon + + Deploy Live + + icon.
      3. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        - - QuoteConditionFlags - - - Description -
        - - Closing - - - Indicates that this quote was the last quote for a security for that Participant. -
        - - NewsDissemination - - - Denotes a regulatory trading halt when relevant news influencing the security is being disseminated. Trading is - suspended until the primary market determines that an adequate publication or disclosure of information has occurred. -
        - - NewsPending - - - Denotes a regulatory Trading Halt due to an expected news announcement, which may influence the security. An Opening Delay or Trading Halt may be continued once the news has been disseminated. -
        - - TradingRangeIndication - - - Denotes the probable trading range (Bid and Offer prices, no sizes) of a security that is not Opening Delayed or Trading Halted. The Trading Range Indication is used prior to or after the opening of a security. -
        - - OrderImbalance - - - Denotes a non-regulatory halt condition where there is a significant imbalance of buy or sell orders. -
        - - Resume - - - Indicates that trading for a Participant is no longer suspended in a security that had been Opening Delayed or Trading Halted. -
      4. - The quote has none of the following - - QuoteConditionFlags - - : + On the Deploy Live page, click the + + Brokerage + + field and then click + + Trading Technologies + + from the drop-down menu.
      5. - - - - - - - - - - - - - - - - - - - - +
      6. + Enter your TT user name, account name, routing sender, session password, app key, and app secret. +
      7. +

        + Our TT integration routes orders via the TT FIX 4.4 Connection. + + Contact your TT representative + + to set the exchange where you would like your orders sent. Your account details are not saved on QuantConnect. +
        +

        +

        + Our integration fetches your positions using the REST endpoint, so the app key and app secret are your REST App credentials. +

        +
      8. + Click the + + Environment + + field and then click one of the environments from the drop-down menu. +
      9. +

        + The following table shows the supported environments: +

        +
        - - QuoteConditionFlags - - - Description -
        - - Regular - - - This condition is used for the majority of quotes to indicate a normal trading environment. -
        - - Slow - - - This condition is used to indicate that the quote is a Slow Quote on both the bid and offer sides due to a Set Slow List that includes high price securities. -
        - - Gap - - - While in this mode, auto-execution is not eligible, the quote is then considered manual and non-firm in the bid and offer, and either or both sides can be traded through as per Regulation NMS. -
        + - - + + + +
        - - OpeningQuote - - - This condition can be disseminated to indicate that this quote was the opening quote for a security for that Participant. - + Environment + + Description +
        - - FastTrading - + Live - For extremely active periods of short duration. While in this mode, the UTP Participant will enter quotations on a best efforts basis. + Trade in the production environment
        - - Resume - + UAT - Indicate that trading for a Participant is no longer suspended in a security which had been Opening Delayed or Trading Halted. + Trade in the + + User Acceptance Testing + + environment
        -
    +
  • + Click the + + Node + + field and then click the live trading node that you want to use from the drop-down menu. +
  • +
  • + If your brokerage account has existing cash holdings, follow these steps ( + + see video + + ): +
  • +
      +
    1. + In the + + Algorithm Cash State + + section, click + + Show + + . +
    2. +
    3. + Click + + Add Currency + + . +
    4. +
    5. + Enter the currency ticker (for example, USD or CAD) and a quantity. +
    6. +
    +
  • + + (Optional) + + + Set up notifications + + . +
  • +
  • + Configure the + + Automatically restart algorithm + + setting. +
  • +

    + By enabling + + automatic restarts + + , the algorithm will use best efforts to restart the algorithm if it fails due to a runtime error. This can help improve the algorithm's resilience to temporary outages such as a brokerage API disconnection. +

    +
  • + Click + + Deploy + + . +
  • +

    - In the preceding tables, - - Participant - - refers to the entities on page 19 of the - - Consolidated Tape System Multicast Output Binary Specification + The deployment process can take up to 5 minutes. When the algorithm deploys, the + + live results page + + displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings. +

    + + + +

     

    + +
    +
    +

    Brokerages

    +

    Wolverine

    +
    +
    +

    Introduction

    + + +

    + QuantConnect enables you to run your algorithms in live mode with real-time market data. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015. +

    +

    + Wolverine Execution Services is a diversified financial institution specializing in proprietary trading, asset management, order execution services, and technology solutions. They are recognized as a market leader in derivatives valuation, trading, and value-added order execution across global Equity, Options, and Futures markets. Their focus on innovation, achievement, and integrity serves the interests of their clients and colleagues. Wolverine Execution Services is headquartered in Chicago, with branch offices in New York, San Francisco, and London. They serve funds that have at least $5M assets under management. +

    +

    + To view the implementation of the Wolverine Execution Services brokerage integration, see the + + Lean.Brokerages.Wolverine repository .

    -

    Suspicious Ticks

    +

    Account Types

    - Tick price data is raw and unfiltered, so it can contain a lot of noise. If a tick is not tradable, we flag it as suspicious. This process makes the bars a more realistic representation of what you could execute in live trading. If you use tick data, avoid using suspicious ticks in your algorithms as informative data points. We recommend only using tick data if you understand the risks and are able to perform your own tick filtering. Ticks are flagged as suspicious in the following situations: + Wolverine Execution Services supports cash and margin accounts. To set the account type in an algorithm, see the + + Wolverine brokerage model documentation + + .

    -
      -
    • - The tick occurs below the best bid or above the best ask -
    • - A tick occurs above the best ask of a security -

      - This image shows a tick that occurred above the best ask price of a security. The green line represents the best ask of the security, the blue line represents the best bid of the security, and the red dots represent trade ticks. The ticks between the best bid and ask occur from filling hidden orders. The tick that occurred above the best ask price is flagged as suspicious. -

      -
    • - The tick occurs far from the current market price -
    • - A tick occurs far below the market price of a security -

      - This image shows a tick that occurred far from the price of the security. The red dots represent trade ticks. The tick that occurred far from the market price is flagged as suspicious. -

      -
    • - The tick occurs on a dark pool -
    • +

      + Create an Account +

      +

      + To create a Wolverine Execution Services account, + + contact their staff + + through the TradeWex website. +

      +

      + Paper Trading +

      +

      + Wolverine Execution Services doesn't support paper trading, but you can follow these steps to simulate it: +

      +
      1. - The tick is rolled back + In the + + Initialize + + method of your algorithm, add one of the preceding + + SetBrokerageModel + + method calls.
      2. - The tick is reported late + + Deploy your algorithm with the QuantConnect Paper Trading brokerage + + .
      3. -
    + -

    Delivery

    +

    Asset Classes

    - Most live trading algorithms run on co-located servers racked in Equinix. Co-location reduces several factors that can interfere with your algorithm, including downtime from internet outages, equipment repairs, and natural disasters. + Our Wolverine Execution Services integration supports trading + + US Equities + + .

    - Live data takes time to travel from the source to your algorithm. The QuantConnect data provider has a latency of 20-50 milliseconds. QuantConnect is not designed for high-frequency trading. + You may not be able to trade all assets with Wolverine. For example, if you live in the EU, you can't trade US ETFs. Check with your local regulators to know which assets you are allowed to trade. You may need to adjust settings in your brokerage account to live trade some assets.

    -

    Historical Data

    +

    Data Providers

    + + +

    + The + + QuantConnect data provider + + provides US Equities data during live trading. +

    + + + +

    Orders

    - When you - - request historical data - - or run - - warm-up - - , the amount of historical data you can access depends on the resolution of your data subscriptions. The following table shows the amount of trailing historical data you can access for each data resolution: + We model the Wolverine Execution Services API by supporting order types, but not order updates or extended market hours trading. When you deploy live algorithms, you can + + place manual orders + + through the IDE. +

    +

    + Order Types +

    +

    + Our Wolverine Execution Services integration supports + + market orders + + . +

    +

    + Updates +

    +

    + We model the Wolverine Execution Services API by not supporting order updates. +

    +

    + Extended Market Hours +

    +

    + Wolverine Execution Services doesn't support extended market hours trading. If you place an order outside of regular trading hours, the order is invalid. +

    +

    + Order Properties +

    +

    + We model custom order properties from the Wolverine API. The following table describes the members of the + + WolverineOrderProperties + + object that you can set to customize order execution:

    - +
    - - - - - - - - - - @@ -28794,1595 +28431,2128 @@

    Historical Data

    -

    Pricing

    +

    Fees

    - The QuantConnect data provider serves US Equities data for free. + Wolverine Execution Services charge $0.005 per share you trade. To view how we model their fees, see + + Fees + + .

    -

     

    - -
    -
    -

    QuantConnect

    -

    Crypto

    -
    -
    -

    Introduction

    +

    Margin

    - The QuantConnect data provider provides a stream of Crypto trades and quotes to your trading algorithm during live execution. Live data enables you to make real-time trades and update the value of the securities in your portfolio. + We model + + buying power + + and + + margin calls + + to ensure your algorithm stays within the margin requirements. If you have more than $25,000 in your brokerage account, you can use the + + PatternDayTradingMarginModel + + to make use of the 4x intraday leverage and 2x overnight leverage available on most brokerages from the + + PDT rule + + .

    -

    Sourcing

    +

    Slippage

    - The QuantConnect data provider uses WebSockets to gather Crypto market data from the following sources: + Orders through Wolverine Execution Services do not experience slippage in backtests. In live trading, your orders may experience slippage.

    -
      +

      + To view how we model Wolverine slippage, see + + Slippage + + . +

      + + + +

      Fills

      + + +

      + We fill market orders immediately and completely in backtests. In live trading, if the quantity of your market + orders exceeds the quantity available at the top of the order book, your orders are filled according to what is + available in the order book. +

      +

      + To view how we model Wolverine Execution Services order fills, see + + Fills + + . +

      + + + +

      Settlements

      + + +

      + If you trade with a margin account, trades settle immediately +

      +

      + To view how we model settlement for Wolverine trades, see + + Settlement + + . +

      + + + +

      Security and Stability

      + + +

      + When you deploy live algorithms with Wolverine Execution Services, we don't save your brokerage account credentials. +

      + + + +

      Deposits and Withdraws

      + + +

      + You can deposit and withdraw cash from your brokerage account while you run an algorithm that's connected to the + account. We sync the algorithm's cash holdings with the cash holdings in your brokerage account every day at 7:45 AM + Eastern Time (ET). +

      + + + +

      Demo Algorithm

      + + +

      + The following algorithm demonstrates the functionality of the Wolverine Execution Services brokerage: +

      +
      +
      +
      +
      +
      + +
      +
      +
      +
      +
      +
      +
      +
      + +
      +
      +
      + + + +

      Deploy Live Algorithms

      + + +

      + You must have an available + + live trading node + + for each live trading algorithm you deploy. +

      +

      + Follow these steps to deploy a live algorithm: +

      +
        +
      1. + + Open the project + + you want to deploy. +
      2. +
      3. + Click the + Lightning icon + + Deploy Live + + icon. +
      4. +
      5. + On the Deploy Live page, click the + + Brokerage + + field and then click + + Wolverine Execution Services + + from the drop-down menu. +
      6. - Binance & Binance US + Enter your Wolverine Execution Services credentials.
      7. +

        + Your account details are not saved on QuantConnect. +

      8. - Bitfinex + Click the + + Node + + field and then click the live trading node that you want to use from the drop-down menu.
      9. - Bybit + If your brokerage account has existing cash holdings, follow these steps ( + + see video + + ):
      10. +
          +
        1. + In the + + Algorithm Cash State + + section, click + + Show + + . +
        2. +
        3. + Click + + Add Currency + + . +
        4. +
        5. + Enter the currency ticker (for example, USD or CAD) and a quantity. +
        6. +
      11. - Coinbase + If your brokerage account has existing position holdings, follow these steps ( + + see video + + ): +
      12. +
          +
        1. + In the + + Algorithm Holdings State + + section, click + + Show + + . +
        2. +
        3. + Click + + Add Holding + + . +
        4. +
        5. + Enter the symbol ID, symbol, quantity, and average price. +
        6. +
        +
      13. + + (Optional) + + + Set up notifications + + .
      14. - Kraken + Configure the + + Automatically restart algorithm + + setting.
      15. -
          -
        -
    - - - -

    Universe Selection

    - - -

    - The QuantConnect data provider enables you to create a dynamic universe of Crypto securities. The live data for Crypto universe selection arrives at 4 PM Coordinated Universal Time (UTC), so universe selection runs for live algorithms between 4 PM and 4:30 PM. Don't schedule anything for midnight because the universe selection data isn't ready yet. -

    -
    -
    UniverseSettings.Asynchronous = true;
    -AddUniverse(CryptoCoarseFundamentalUniverse(Market.Bitfinex, UniverseSettings, UniverseSelectionFilter));
    -
    self.UniverseSettings.Asynchronous = True
    -self.AddUniverse(CryptoCoarseFundamentalUniverse(Market.Bitfinex, self.UniverseSettings, self.UniverseSelectionFilter))
    -
    +

    + By enabling + + automatic restarts + + , the algorithm will use best efforts to restart the algorithm if it fails due to a runtime error. This can help improve the algorithm's resilience to temporary outages such as a brokerage API disconnection. +

    +
  • + Click + + Deploy + + . +
  • +

    - To view an example for each Crypto market, see the - - Universe Selection - - section of the Crypto market in the - - Dataset Market + The deployment process can take up to 5 minutes. When the algorithm deploys, the + + live results page - . + displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings.

    -

    Bar Building

    +

     

    + +
    +
    +

    Brokerages

    +

    Zerodha

    +
    +
    +

    Introduction

    - We aggregate ticks to build bars. -

    -

    - In live trading, bars are built using the exchange timestamps with microsecond accuracy. This microsecond-by-microsecond processing - of the ticks can mean that the individual bars between live trading and backtesting can have slightly different ticks. As a result, it's possible for a - tick to be counted in different bars between backtesting and live trading, which can lead to bars having slightly different open, high, low, close, and volume values. + QuantConnect enables you to run your algorithms in live mode with real-time market data. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015.

    - - - -

    Delivery

    - -

    - Most live trading algorithms run on co-located servers racked in Equinix. Co-location reduces several factors that can interfere with your algorithm, including downtime from internet outages, equipment repairs, and natural disasters. + Zerodha was founded by Nithin Kamath in 2010 with the goal to break all barriers that traders and investors face in India in terms of cost, support, and technology. Zerodha provides access to India Equities for clients in India with no minimum balance required. Zerodha also provides a mutual fund investment platform and an interactive portfolio dashboard.

    - Live data takes time to travel from the source to your algorithm. The QuantConnect data provider has a latency of 20-50 milliseconds. QuantConnect is not designed for high-frequency trading. + To view the implementation of the Zerodha brokerage integration, see the + + Lean.Brokerages.Zerodha repository + + .

    -

    Historical Data

    +

    Account Types

    - When you - - request historical data - - or run - - warm-up + Zerodha supports cash and margin accounts. To set the account type in an algorithm, see the + + Zerodha brokerage model documentation - , the amount of historical data you can access depends on the resolution of your data subscriptions. The following table shows the amount of trailing historical data you can access for each data resolution: + .

    -
    - Resolution + + Property - Available History + + Description
    - Daily - - All historical data -
    - Hour - - All historical data -
    - Minute + + TimeInForce + - 1 year + A + + TimeInForce + + instruction to apply to the order. The following instructions are supported: +
      +
    • + + Day + +
    • +
    • + + GoodTilCanceled + +
    • +
    - Second + + Exchange + - 2 months + Defines the exchange name for a particular market. For example, + + Exchange.SMART +
    - Tick + + ExchangePostFix + - 1 month + The exchange post fix to apply if any. For example, if you set + + Exchange + + to + + Exchange.SMART + + , then "-INCA-TX" yields "SMART-INCA-TX"
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Resolution - - Available History -
    - Daily - - All historical data -
    - Hour - - All historical data -
    - Minute - - 1 year -
    - Second - - 2 months -
    - Tick - - 1 month -
    - - - -

    Pricing

    - -

    - The QuantConnect data provider serves Crypto data for free. + Zerodha only supports trading Indian Rupees, so + + set the account currency of your algorithm + + to INR.

    - - - -

     

    - -
    -
    -

    QuantConnect

    -

    Crypto Futures

    -
    -
    -

    Introduction

    - - +

    + Create an Account +

    - The QuantConnect data provider provides a stream of Crypto Futures trades and quotes to your trading algorithm during live execution. Live data enables you to make real-time trades and update the value of the securities in your portfolio. + To create a Zerodha account, follow the + + account creation wizard + + on the Zerodha website.

    - - +

    + You will need API credentials to deploy live algorithms with your brokerage account. After you open your Zerodha account, follow these steps to get your API credentials: +

    +
      +
    1. + + Create a Kite Connect developer account + + . +
    2. +
    3. + On the My apps page, click + + Create new app + + . +
    4. +
    5. + On the Create a new app page, fill in the form. +
    6. +

      + For the + + Redirect URL + + field, if you don't have a redirect URL, use https://zerodha.com. +

      +
    7. + Click + + Create + + . +
    8. +
    9. + Copy and save your API key and API secret. +
    10. +
    11. + In a terminal, run the following Python script: +
      +
      from kiteconnect import KiteConnect
      +import webbrowser
       
      -

      Sourcing

      - - +api_key = input ("Enter your API key: ") +kite = KiteConnect(api_key=api_key) +​webbrowser.open(kite.login_url()) +request_token = input ("Enter your request_token: ") +api_secret = input ("Enter your API secret: ") +data = kite.generate_session(request_token, api_secret=api_secret) +kite.set_access_token(data["access_token"]) +print(f"Your access_token is {data['access_token']}")
      +
      +

      + Input the data that the script requests. When the script opens your redirect URL page, log in and then copy the request token that's in the URL parameters. +

      +

      + When the script prints your access token. Copy and save it somewhere safe. +

      +
    12. +
    +

    + Paper Trading +

    - The QuantConnect data provider uses WebSockets to gather Crypto Futures market data from Binance. + Zerodha doesn't support paper trading.

    -

    Bar Building

    +

    Asset Classes

    - We aggregate ticks to build bars. -

    -

    - In live trading, bars are built using the exchange timestamps with microsecond accuracy. This microsecond-by-microsecond processing - of the ticks can mean that the individual bars between live trading and backtesting can have slightly different ticks. As a result, it's possible for a - tick to be counted in different bars between backtesting and live trading, which can lead to bars having slightly different open, high, low, close, and volume values. + Our Zerodha integration supports trading + + Indian Equities + + .

    -

    Delivery

    +

    Data Providers

    - Most live trading algorithms run on co-located servers racked in Equinix. Co-location reduces several factors that can interfere with your algorithm, including downtime from internet outages, equipment repairs, and natural disasters. -

    -

    - Live data takes time to travel from the source to your algorithm. The QuantConnect data provider has a latency of 20-50 milliseconds. QuantConnect is not designed for high-frequency trading. + The + + Zerodha data provider + + provides India Equities data during live trading.

    -

    Historical Data

    +

    Orders

    - When you - - request historical data - - or run - - warm-up + We model the Zerodha API by supporting several order types, order properties, and order updates. When you deploy live algorithms, you can + + place manual orders - , the amount of historical data you can access depends on the resolution of your data subscriptions. The following table shows the amount of trailing historical data you can access for each data resolution: + through the IDE.

    - +

    + Order Types +

    +

    + The following table describes the available order types for each asset class that our Zerodha integration supports: +

    +
    - - - - -
    - Resolution + + Order Type - Available History + India Equity
    - Daily - - All historical data -
    - Hour + + MarketOrder + - All historical data + green check
    - Minute + + LimitOrder + - 1 year + green check
    - Second + + StopMarketOrder + - 2 months + green check
    - Tick + + StopLimitOrder + - 1 month + green check
    - - - -

    Pricing

    - - -

    - The QuantConnect data provider serves Crypto Futures data for free. -

    - - - -

     

    - -
    -
    -

    QuantConnect

    -

    CFD

    -
    -
    -

    Introduction

    - - -

    - The QuantConnect data provider provides a stream of CFD trades and quotes to your trading algorithm during live execution. Live data enables you to make real-time trades and update the value of the securities in your portfolio. -

    - - - -

    Sourcing

    - - -

    - The QuantConnect data provider consolidates CFD market data from OANDA. -

    - - - -

    Bar Building

    - - -

    - We aggregate ticks to build bars. -

    -

    - In live trading, bars are built using the exchange timestamps with microsecond accuracy. This microsecond-by-microsecond processing - of the ticks can mean that the individual bars between live trading and backtesting can have slightly different ticks. As a result, it's possible for a - tick to be counted in different bars between backtesting and live trading, which can lead to bars having slightly different open, high, low, close, and volume values. -

    - - - -

    Delivery

    - - -

    - Most live trading algorithms run on co-located servers racked in Equinix. Co-location reduces several factors that can interfere with your algorithm, including downtime from internet outages, equipment repairs, and natural disasters. -

    -

    - Live data takes time to travel from the source to your algorithm. The QuantConnect data provider has a latency of 20-50 milliseconds. QuantConnect is not designed for high-frequency trading. -

    - - - -

    Historical Data

    - - + +

    + Order Properties +

    - When you - - request historical data - - or run - - warm-up - - , the amount of historical data you can access depends on the resolution of your data subscriptions. The following table shows the amount of trailing historical data you can access for each data resolution: + We model custom order properties from the Zerodha API. The following table describes the members of the + + IndiaOrderProperties + + object that you can set to customize order execution:

    - +
    - - + - - - - - - - -
    - Resolution - - Available History + + Property + + Description
    - Daily - - All historical data -
    - Hour - - All historical data -
    - Minute + + Exchange + - 1 year + Select the exchange for sending the order to. The following instructions are supported: +
      +
    • + + NSE + +
    • +
    • + + BSE + +
    • +
    - Second + + ProductType + - 2 months + A + + ProductType + + instruction to apply to the order. The + + IndiaProductType + + enumeration has the following members: +
    +
    - Tick + + TimeInForce + - 1 month + A + + TimeInForce + + instruction to apply to the order. The following instructions are supported: +
      +
    • + + Day + +
    • +
    • + + GoodTilCanceled + +
    • +
    • + + GoodTilDate + +
    • +
    - - - -

    Pricing

    - - +

    + Updates +

    - The QuantConnect data provider serves CFD data for free. + We model the Samco Zerodha by supporting + + order updates + + . +

    +

    + Handling Splits +

    +

    + If you're using raw + + data normalization + + and you have active orders with a limit, stop, or trigger price in the market for a US Equity when a + + stock split + + occurs, the following properties of your orders automatically adjust to reflect the stock split:

    +
      +
    • + Quantity +
    • +
    • + Limit price +
    • +
    • + Stop price +
    • +
    • + Trigger price +
    • +
    -

     

    - -
    -
    -

    QuantConnect

    -

    Forex

    -
    -
    -

    Introduction

    +

    Fees

    - The QuantConnect data provider provides a stream of Forex pair trades and quotes to your trading algorithm during live execution. Live data enables you to make real-time trades and update the value of the securities in your portfolio. + To view the Zerodha trading fees, see the + + Charges + + page on the Zerodha website. To view how we model their fees, see + + Fees + + .

    -

    Sourcing

    +

    Margin

    - The QuantConnect data provider consolidates Forex market data from OANDA. + We model + + buying power + + and + + margin calls + + to ensure your algorithm stays within the margin requirements. The amount of margin available depends on the Equity and product type. To check the amount of margin available for each asset, see the + + Margin Calculator + + on the Zerodha website.

    -

    Bar Building

    +

    Slippage

    - We aggregate ticks to build bars. + Orders through Zerodha do not experience slippage in backtests. In live trading, your orders may experience slippage.

    - In live trading, bars are built using the exchange timestamps with microsecond accuracy. This microsecond-by-microsecond processing - of the ticks can mean that the individual bars between live trading and backtesting can have slightly different ticks. As a result, it's possible for a - tick to be counted in different bars between backtesting and live trading, which can lead to bars having slightly different open, high, low, close, and volume values. + To view how we model Zerodha slippage, see + + Slippage + + .

    -

    Delivery

    +

    Fills

    - Most live trading algorithms run on co-located servers racked in Equinix. Co-location reduces several factors that can interfere with your algorithm, including downtime from internet outages, equipment repairs, and natural disasters. + We fill market orders immediately and completely in backtests. In live trading, if the quantity of your market + orders exceeds the quantity available at the top of the order book, your orders are filled according to what is + available in the order book.

    - Live data takes time to travel from the source to your algorithm. The QuantConnect data provider has a latency of 20-50 milliseconds. QuantConnect is not designed for high-frequency trading. + To view how we model Zerodha order fills, see + + Fills + + .

    -

    Historical Data

    +

    Settlements

    - When you - - request historical data - - or run - - warm-up + If you trade with a margin account, trades settle immediately +

    +

    + To view how we model settlement for Zerodha trades, see + + Settlement - , the amount of historical data you can access depends on the resolution of your data subscriptions. The following table shows the amount of trailing historical data you can access for each data resolution: + . +

    + + + +

    Security and Stability

    + + +

    + When you deploy live algorithms with Zerodha, we don't save your brokerage account credentials.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Resolution - - Available History -
    - Daily - - All historical data -
    - Hour - - All historical data -
    - Minute - - 1 year -
    - Second - - 2 months -
    - Tick - - 1 month -
    -

    Pricing

    +

    Deposits and Withdraws

    - The QuantConnect data provider serves Forex data for free. + You can deposit and withdraw cash from your brokerage account while you run an algorithm that's connected to the + account. We sync the algorithm's cash holdings with the cash holdings in your brokerage account every day at 7:45 AM + Eastern Time (ET).

    -

     

    - -
    -
    -

    QuantConnect

    -

    Futures

    -
    -
    -

    Introduction

    +

    Demo Algorithm

    - The QuantConnect data provider provides a stream of Futures trades, quotes, and open interest to your trading algorithm during live execution. Live data enables you to make real-time trades and update the value of the securities in your portfolio. + The following algorithm demonstrates the functionality of the Zerodha brokerage:

    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    -

    Sourcing

    +

    Deploy Live Algorithms

    - The QuantConnect data provider consolidates Futures market data across the following markets: + You must have an available + + live trading node + + for each live trading algorithm you deploy.

    -
      +

      + Follow these steps to deploy a live algorithm: +

      +
      1. - CBOT + + Open the project + + you want to deploy.
      2. - CME + Click the + Lightning icon + + Deploy Live + + icon.
      3. - COMEX + On the Deploy Live page, click the + + Brokerage + + field and then click + + Zerodha + + from the drop-down menu.
      4. - ICE + Enter your Kite Connect access token and key.
      5. +

        + To get your access token and key, see + + Account Types + + . Your account details aren't saved on QuantConnect. +

      6. - NYMEX + Click the + + Product Type + + field and then click one of the following options from the drop-down menu:
      7. -
    + + + + + + + + + + + + + + + + + + + + + +
    + Product Type + + Description +
    + + MIS + + + Intraday products +
    + + CNC + + + Delivery products +
    + + NRML + + + Carry forward products +
    +
  • + Click the + + Trading Segment + + field and then click one of the following options from the drop-down menu: +
  • + + + + + + + + + + + + + + + + + +
    + Trading Segment + + Description +
    + + EQUITY + + + For trading Equities on the National Stock Exchange of India (NSE) or the Bombay Stock Exchange (BSE) +
    + + COMMODITY + + + For trading commodities on the Multi Commodity Exchange of India (MCX) +
    +
  • + Click the + + History Subscription + + field and then click + + Yes + + or + + No + + from the drop-down menu. +
  • +

    + Use this field to declare whether you have a history API subscription on your Kite Connect account. +

    +
  • + Click the + + Node + + field and then click the live trading node that you want to use from the drop-down menu. +
  • +
  • + + (Optional) + + + Set up notifications + + . +
  • +
  • + Configure the + + Automatically restart algorithm + + setting. +
  • +

    + By enabling + + automatic restarts + + , the algorithm will use best efforts to restart the algorithm if it fails due to a runtime error. This can help improve the algorithm's resilience to temporary outages such as a brokerage API disconnection. +

    +
  • + Click + + Deploy + + . +
  • + +

    + The deployment process can take up to 5 minutes. When the algorithm deploys, the + + live results page + + displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings. +

    + + + +

     

    + +
    +
    +

    Brokerages

    +

    Bloomberg EMSX

    +
    +
    +

    Introduction

    + + +

    + QuantConnect enables you to run your algorithms in live mode with real-time market data. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015. +

    + Terminal link icon

    - The data is powered by the Chicago Mercantile Exchange (CME). + QuantConnect can integrate with the Bloombergâ„¢ Server API (SAPI) or Desktop API (DAPI) in different cloud environments. This integration allows research, backtesting, opitimization, and live trading through the Bloomberg APIs. Terminal Link is in no way affiliated with or endorsed by Bloombergâ„¢; it is simply an add-on. Add Terminal link to your organization to access the 1,300+ prime brokerages in the Bloomberg Execution Management System network.

    - The data provider doesn't include the CFE market. For - - Futures.Indices.VIX - - , use a combination of the QuantConnect and IB data provider. For more details about this option, see - - Hybrid QuantConnect Data Provider + QuantConnect Cloud only supports routing trades to the Bloombergâ„¢ Server API. In this environment, you can route orders to any of the prime brokerages that Bloomberg supports and you get to leverage the data, server management, and data management from QuantConnect, giving you the best of both worlds. To use Terminal Link, you need to be a member of an organization on the Trading Firm or Institution + + tier .

    -

    Bar Building

    +

    Account Types

    - We aggregate ticks to build bars. -

    -

    - In live trading, bars are built using the exchange timestamps with microsecond accuracy. This microsecond-by-microsecond processing - of the ticks can mean that the individual bars between live trading and backtesting can have slightly different ticks. As a result, it's possible for a - tick to be counted in different bars between backtesting and live trading, which can lead to bars having slightly different open, high, low, close, and volume values. + Terminal Link supports order routing via the Bloombergâ„¢ EMSX network. It's a margin account that's similiar to a FIX API, where you set the buying power in the wizard when you're deploying to a professional prime brokerage account.

    -

    Delivery

    +

    Data Providers

    - Most live trading algorithms run on co-located servers racked in Equinix. Co-location reduces several factors that can interfere with your algorithm, including downtime from internet outages, equipment repairs, and natural disasters. + To use the Bloombergâ„¢ EMSX network and SAPI on QuantConnect, you must use the + + QuantConnect data provider + + .

    + + + +

    Asset Classes

    + +

    - Live data takes time to travel from the source to your algorithm. The QuantConnect data provider has a latency of 20-50 milliseconds. QuantConnect is not designed for high-frequency trading. + Terminal Link supports trading the following asset classes:

    + -

    Historical Data

    +

    Orders

    - When you - - request historical data - - or run - - warm-up - - , the amount of historical data you can access depends on the resolution of your data subscriptions. The following table shows the amount of trailing historical data you can access for each data resolution: + Terminal Link enables you to create and manage Bloombergâ„¢ orders.

    - +

    + Order Types +

    +

    + The following table describes the available order types for each asset class that Terminal Link supports: +

    +
    - + + + - - + + + + + + + + + +
    - Resolution + + Order Type - Available History + Equity + + Equity Options + + Futures + + Index Options
    - Daily + + MarketOrder + - All historical data + green check
    - Hour + green check - All historical data + green check + + green check
    - Minute + + LimitOrder + - 1 year + green check + + green check + + green check + + green check
    - Second + + StopMarketOrder + - 2 months + green check + + green check + + green check + + green check
    - Tick + + StopLimitOrder + - 1 month + green check + + green check + + green check + + green check
    - - - -

    Pricing

    - - -

    - The QuantConnect data provider serves Futures data for free. -

    - - - -

     

    - -
    -
    -

    QuantConnect

    -

    Future Options

    -
    -
    -

    Introduction

    - - -

    - The QuantConnect data provider provides a stream of Futures Options trades, quotes, and open interest to your trading algorithm during live execution. Live data enables you to make real-time trades and update the value of the securities in your portfolio. -

    - - - -

    Sourcing

    - - -

    - The QuantConnect data provider consolidates Future Options market data across the following markets: -

    -
      -
    • - CBOT -
    • -
    • - CME -
    • -
    • - COMEX -
    • -
    • - NYMEX -
    • -
    - - - -

    Bar Building

    - - -

    - We aggregate ticks to build bars. -

    -

    - In live trading, bars are built using the exchange timestamps with microsecond accuracy. This microsecond-by-microsecond processing - of the ticks can mean that the individual bars between live trading and backtesting can have slightly different ticks. As a result, it's possible for a - tick to be counted in different bars between backtesting and live trading, which can lead to bars having slightly different open, high, low, close, and volume values. -

    - - - -

    Delivery

    - - -

    - Most live trading algorithms run on co-located servers racked in Equinix. Co-location reduces several factors that can interfere with your algorithm, including downtime from internet outages, equipment repairs, and natural disasters. -

    -

    - Live data takes time to travel from the source to your algorithm. The QuantConnect data provider has a latency of 20-50 milliseconds. QuantConnect is not designed for high-frequency trading. -

    - - - -

    Historical Data

    - - + +

    + Order Properties +

    - When you - - request historical data - - or run - - warm-up - - , the amount of historical data you can access depends on the resolution of your data subscriptions. The following table shows the amount of trailing historical data you can access for each data resolution: + We model custom order properties from the Bloomberg EMSX API. The following table describes the members of the + + TerminalLinkOrderProperties + + object that you can set to customize order execution:

    - +
    - - + + + + + + + + + + + + + + + + + + + + + + + +
    - Resolution + + Property - Available History + + Description
    - Daily + + TimeInForce + - All historical data + A + + TimeInForce + + instruction to apply to the order. The following instructions are supported: +
      +
    • + + Day + +
    • +
    • + + GoodTilCanceled + +
    • +
    • + + GoodTilDate + +
    • +
    - Hour + + Notes + - All historical data + The free form instructions that may be sent to the broker.
    - Minute + + HandlingInstruction + - 1 year + The instructions for handling the order or route. The values can be preconfigured or a value customized by the broker.
    - Second + + CustomNotes1 + - 2 months + Custom user order notes 1. For more information about custom order notes, see + + Custom Notes & Free Text Fields + + in the EMSX API documentation
    - Tick + + CustomNotes2 + - 1 month + Custom user order notes 2. +
    + + CustomNotes3 + + + Custom user order notes 3. +
    + + CustomNotes4 + + + Custom user order notes 4. +
    + + CustomNotes5 + + + Custom user order notes 5. +
    + + Account + + + The EMSX account. +
    + + Broker + + + The EMSX broker code. +
    + + Strategy + + + A + + StrategyParameters + + object that represents the EMSX order strategy details. You must append strategy parameters in the order that the EMSX API expects. + The following strategy names are supported: "DMA", "DESK", "VWAP", "TWAP", "FLOAT", "HIDDEN", "VOLUMEINLINE", "CUSTOM", "TAP", "CUSTOM2", "WORKSTRIKE", "TAPNOW", "TIMED", "LIMITTICK", "STRIKE"
    - - +
    +
    public override void Initialize()
    +{
    +    // Set the default order properties
    +    DefaultOrderProperties = new TerminalLinkOrderProperties
    +    {
    +        TimeInForce = TimeInForce.GoodTilCanceled,
    +        Strategy = new TerminalLinkOrderProperties.StrategyParameters(
    +            "VWAP",
    +            new List<TerminalLinkOrderProperties.StrategyField>
    +            {
    +                new("09:30:00"),
    +                new("10:30:00"),
    +                new(),
    +                new()
    +            }
    +         )
    +    };
    +}
     
    -

    Pricing

    - - +public override void OnData(Slice slice) +{ + // Use default order order properties + LimitOrder(_symbol, quantity, limitPrice); + + // Override the default order properties + LimitOrder(_symbol, quantity, limitPrice, + orderProperties: new TerminalLinkOrderProperties + { + TimeInForce = TimeInForce.Day, + Account = "account1" + }); + LimitOrder(_symbol, quantity, limitPrice, + orderProperties: new TerminalLinkOrderProperties + { + TimeInForce = TimeInForce.GoodTilDate(new DateTime(year, month, day)), + Account = "account2" + }); +}
    +
    def Initialize(self) -> None:
    +    # Set the default order properties
    +    self.DefaultOrderProperties = TerminalLinkOrderProperties()
    +    self.DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled
    +    self.DefaultOrderProperties.Strategy = TerminalLinkOrderProperties.StrategyParameters(
    +        "VWAP",
    +        [
    +            TerminalLinkOrderProperties.StrategyField("09:30:00"),
    +            TerminalLinkOrderProperties.StrategyField("10:30:00"),
    +            TerminalLinkOrderProperties.StrategyField(),
    +            TerminalLinkOrderProperties.StrategyField()
    +        ]
    +    )
    +
    +def OnData(self, slice: Slice) -> None:
    +    # Use default order order properties
    +    self.LimitOrder(self.symbol, quantity, limit_price)
    +    
    +    # Override the default order properties
    +    order_properties = TerminalLinkOrderProperties()
    +    order_properties.TimeInForce = TimeInForce.Day
    +    order_properties.Account = "account1"
    +    self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)
    +
    +    order_properties.TimeInForce = TimeInForce.GoodTilDate(datetime(year, month, day))
    +    order_properties.Account = "account2"
    +    self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)
    +

    - The QuantConnect data provider serves Future Options data for free. + For more information about the format that the Bloomberg EMSX API expects, see + + Create Order and Route Extended Request + + in the EMSX API documentation and the + + createOrderAndRouteWithStrat documentation + + on the MathWorks website.

    - - - -

     

    - -
    -
    -

    QuantConnect

    -

    Alternative Data

    -
    -
    -

    Introduction

    - - +

    + Get Open Orders +

    - The QuantConnect data provider can stream live alternative data into your algorithms to help you make informed trading decisions. + Terminal Link lets you + + access open orders + + .

    - - - -

    Sourcing

    - - +

    + Monitor Fills +

    - The QuantConnect data provider sources alternative data directly from - - data vendors + Terminal Link allows you to monitor orders as they fill through + + order events - . To view all of the integrated data vendors, see the - - Dataset Market + . +

    +

    + Updates +

    +

    + Terminal Link doesn't support + + order updates .

    - - - -

    Delivery

    - - +

    + Cancellations +

    - The delivery schedule of alternative data depends on the specific dataset you're using. We inject the data into your algorithms when the vendor provides the data. For most alternative datasets, the data is updated on a daily or hourly basis. Some datasets, like the - - Tiingo News Feed - - or - - Benzinga News Feed + Terminal Link enables you to + + cancel open orders - , include a live stream. In these cases, we deliver the data as a live stream to your algorithm. -

    -

    - Most live trading algorithms run on co-located servers racked in Equinix. Co-location reduces several factors that can interfere with your algorithm, including downtime from internet outages, equipment repairs, and natural disasters. + .

    +

    + Handling Splits +

    - Live data takes time to travel from the source to your algorithm. The latency of the alternative data depends on the specific dataset you're using. + If you're using raw + + data normalization + + and you have active orders with a limit, stop, or trigger price in the market for a US Equity when a + + stock split + + occurs, the following properties of your orders automatically adjust to reflect the stock split:

    +
      +
    • + Quantity +
    • +
    • + Limit price +
    • +
    • + Stop price +
    • +
    • + Trigger price +
    • +
    -

    Historical Data

    +

    Fees

    - When you - - request historical data - - or run - - warm-up + Orders filled with Terminal Link are subject to the fees of the Bloombergâ„¢ Execution Management System and your prime brokerage destination. To view how we model their fees, see + + Fees - , the amount of historical data you can access depends on the resolution of your data subscriptions. The following table shows the amount of trailing historical data you can access for each data resolution: + .

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Resolution - - Available History -
    - Daily - - All historical data -
    - Hour - - All historical data -
    - Minute - - 1 year -
    - Second - - 2 months -
    - Tick - - 1 month -
    -

    Pricing

    +

    Margin

    - Refer to the - - Dataset Market + Set your cash and holdings state in the wizard when you deploy to the Bloombergâ„¢ EMSX environment. We use these states to model + + buying power - listings. + and + + margin calls + + to ensure your algorithm stays within the margin requirements.

    -

     

    - -
    -
    -

    Data Providers

    -

    Interactive Brokers

    -
    -
    -

    Introduction

    +

    Fills

    - Interactive Brokers (IB) was founded by Thomas Peterffy in 1993 with the goal to "create technology to provide liquidity on better terms. Compete on price, speed, size, diversity of global products and advanced trading tools". IB provides access to trading Equities, ETFs, Options, Futures, Future Options, Forex, Gold, Warrants, Bonds, and Mutual Funds for clients in over - - 200 countries and territories - - with no minimum deposit. IB also provides paper trading, a trading platform, and educational services. + In live trading, LEAN routes your orders to the exchange or prime brokerage you select. The order fills and then routes back to you.

    - The Interactive Brokers (IB) data provider streams live asset prices from IB. If you use this data provider and request historical data, the historical data comes from IB. + To view how we model Bloombergâ„¢ Execution Management System order fills, see + + Fills + + .

    -

    Sourcing

    +

    Compliance

    - The IB data provider sources data directly from IB. For more information about the data source, see the - - Trader Workstation API documentation - - . + Bloombergâ„¢ is not affiliated with QuantConnect, nor does it endorse Terminal Link. A Bloombergâ„¢ SAPI permission and EMSX permission is required to use this brokerage connection, along with a Trading Firm or Institutional subscription on QuantConnect.

    - If you use the IB data provider, IB only provides the security price data. We provide the following auxiliary datasets from the Dataset Market: + The following rules apply:

    - - - -

    Universe Selection

    - - -

    - - Universe selection - - is available with the IB data provider. -

    -
    -
    UniverseSettings.Asynchronous = true;
    -AddUniverse(FundamentalUniverseSelection);
    -
    self.UniverseSettings.Asynchronous = True
    -self.AddUniverse(self.FundamentalUniverseSelection)
    -
    -

    - The universe selection data comes from our Dataset Market, not the - - TWS market scanners - - . Universe selection with the IB data provider occurs around 6-7 AM Eastern Time (ET) on Tuesday to Friday and at 2 AM ET on Sunday. Universe selection data isn't available when the IB servers are closed. To check the IB server status, see the - - Current System Status - - page on the IB website. -

    -

    - The IB data provider can stream data for up to 100 assets by default, but IB may let you stream more than 100 assets based on your commissions and equity value. For more information about quotas from IB, see the - - Market Data Pricing Overview - - page on the IB website. If your algorithm adds more than the your quota, LEAN logs an error message from IB. To increase the quota, purchase a Quote Booster from IB. -

    - - - -

    Bar Building

    - -

    - The data is a summarized snapshot of the trades and quotes at roughly 300 milliseconds per snapshot. + The following table shows the activities each of the Bloomberg technologies support:

    - - + + + + + + + + + + + + + + + + + + + +
    + Technology + + Research + + Backtesting + + Paper UAT Trading + + Live Trading +
    + Server API + + green check + + green check + + green check + + green check +
    + -

    Hybrid QuantConnect Data Provider

    +

    Set Up SAPI

    - When you - - deploy a live algorithm with the IB brokerage - - , you can use the QC data provider, the IB data provider, or both. If you use both data providers, Lean gives priority to the QuantConnect data provider. If our data provider doesn't have a stream for the securities you request, Lean uses the IB data provider. This process makes it possible to use our data provider for Equity universe selection and then place Options trades on the securities in the universe. If you use the QC data provider, the assets that you subscribe to don't contribute to the - - IB data limit - - . + The following few sections explain how to download the Bloombergâ„¢ Server API (SAPI), install it on a cloud server, and add firewall rules so it can connect to QuantConnect Cloud.

    - - - -

    Historical Data

    - - +

    + Download SAPI +

    - If you get historical data from IB through a - - history request - - or a - - warm-up period - - , the historical data has the following characteristics: + Follow these steps to download the SAPI:

    - -

    - The following quotas are in place for tick and second resolution historical data: -

    -
    • - You can have up to 50 simultaneous requests. + On the API Developer's Help Site, click + + EMSX API + + .
    • +
    • - You can make up to 60 requests within any 10-minute period. + On the EMSX API page, under the + + Server API Process + + section, click + + Link + + .
    • -
    -

    - In the preceding quotas, - - TradeBar - - and - - QuoteBar - - data count as separate requests. For example, if you request - - TradeBar - - and - - QuoteBar - - data for SPY, it counts as two requests. -

    + +
  • + On the Server API Software Install page, click the correct + + download + + icons. +
  • + +
  • + Click + + System Requirements + + . +
  • + + +

    + Install the SAPI +

    - For more information about historical data from IB, see - - Historical Data Limitations - - in the IB documentation. + Follow these steps to install the SAPI:

    - - - -

    Pricing

    - - +
      +
    1. + Spin up an E12x9 AWS instance or higher that your organization controls. +
    2. +
    3. + Run the SAPI installer on the cloud server. +
    4. +

      + For more information about this step, see + + How to install serverapi.exe + + in the EMSX API Programmers Guide. At the end of the installion, you get a registration key. +

      +
    5. + Ask Bloombergâ„¢ Support to activate your registration key. +
    6. +
    7. + Start the serverapi program. +
    8. +

      + On Windows, the default location is + + C: \ BLP \ ServerApi \ bin \ serverapi.exe + + . +

      +
    +

    + Add Firewall Rules +

    - To use IB data in your algorithms, - - subscribe to IB market data - - . We support all of the IB data subscriptions that are related to - - the securities and markets we support - - . Members usually subscribe to the following IB market data: + Follow these steps to configure the firewall rules on the AWS instance so that the SAPI can connect to QuantConnect Cloud:

    -
      +
      1. - US Securities Snapshot and Futures Value Bundle + Click + + Start + + .
      2. - US Equity and Options Add-On Streaming Bundle + Enter + + Windows Defender Firewall with Advanced Security + + and then press + + Enter + + .
      3. - CFE Enhanced Top of Book (L1 for VIX Futures) + In the left panel, click + + Inbound Rules + + .
      4. - CME S&P Indexes (L1 for SPX and NDX) + In the right panel, click + + New Rule... + + .
      5. - CBOE Streaming Market Indexes (L1 for VIX Index) + Follow the prompts to create a program rule for the serverapi.
      6. -
    -

    - To see the latest prices, check the - - Market Data Pricing Overview - - page on the IB website. IB can take up to 24 hours to process subscription requests. So after you subscribe to data, you need to wait 24 hours before you can use it in your algorithms. When you subscribe to data, IB only assigns your data subscription to one of your accounts. If you want to assign the subscription to a different account, for example, a paper trading account instead of a live trading account, then contact IB. -

    +
  • + In the Windows Defender Firewall with Advanced Security window, double-click the serverapi row. +
  • +
  • + In the serverapi window, click the + + Scope + + tab. +
  • +
  • + In the + + Remote IP address + + section, add the QuantConnect Cloud IP address, 207.182.16.137. +
  • +
  • + Click + + OK + + . +
  • +
  • + Add the QuantConnect Cloud IP address to the other row in the table that has the serverapi name. +
  • + -

     

    - -
    -
    -

    Data Providers

    -

    Samco

    -
    -
    -

    Introduction

    +

    Deploy Live Algorithms

    - Samco was founded by Jimeet Modi in 2015 with a mission of providing retail investors access to sophisticated financial technology that can assist retail investors in creating wealth at a low cost. Samco provides access to India Equities for clients in India with no minimum balance. Samco also provides stock ratings, mutual funds, and a mini-portfolio investment platform. -

    -

    - The Samco data provider streams live asset prices from Samco. If you use this data provider and request historical data, the historical data comes from Samco. + You need to + + set up the Bloomberg SAPI + + before you can deploy cloud algorithms with Terminal Link.

    - - - -

    Sourcing

    - -

    - The Samco data provider sources data directly from Samco. For more information about the data source, see the - - StockNote API documentation + You must have an available + + live trading node - . + for each live trading algorithm you deploy.

    - If you use the Samco data provider, Samco only provides the security price data. We provide the following auxiliary datasets from the Dataset Market: + Follow these steps to deploy a live algorithm:

    - - - - -

    Universe Selection

    - - -

    - Universe selection isn't available with the Samco data provider. -

    - - - -

    Bar Building

    - - -

    - The Samco data provider consolidates prices and quotes across all of the Indian exchanges. For a complete list of exchange and securities, see the - - ScripMaster - - file from the StockNote API documentation. -

    - - - -

    Alternative Data

    - - -

    - Brokerage data providers support most alternative datasets, except data that streams real-time intraday data. Streaming datasets, like the - - Tiingo News Feed - - and - - Benzinga News Feed - - , require the QuantConnect data provider. -

    - - - -

    Pricing

    - - -

    - The Samco data provider is free. To access it, you just need an active Samco account. -

    - - - -

     

    - -
    -
    -

    Data Providers

    -

    Tradier

    -
    -
    -

    Introduction

    - - -

    - Tradier was founded by Dan Raju, Peter Laptewicz, Jason Barry, Jeyashree Chidambaram, and Steve Agalloco in 2012 with the goal to "deliver a choice of low-cost, high-value brokerage services to traders". Tradier provides access to trading Equities and Options for clients in over 250 countries and territories with - - no minimum deposit for cash accounts - - . Tradier also delivers custody, clearing, execution, and billing on behalf of registered advisors. -

    -

    - The Tradier data feeds are streams of Equity and Option prices directly from Tradier. If you use this data feed and request historical data, the historical data comes from Tradier. If you deploy to the demo environment, Tradier doesn't offer streaming market data due to exchange restrictions related to delayed data, so you must use our data feed. -

    - - - -

    Sourcing

    - - -

    - The Tradier data feed comes directly from Tradier. For more information about the data source, see the - - Tradier API documentation - - . -

    -

    - If you use the Tradier data feed, Tradier only provides the security price data. We provide the following auxiliary datasets from the Dataset Market: -

    - - - - -

    Universe Selection

    - - +

    - - Universe selection + The deployment process can take up to 5 minutes. When the algorithm deploys, the + + live results page - is available with the Tradier data provider. -

    -
    -
    UniverseSettings.Asynchronous = true;
    -AddUniverse(FundamentalUniverseSelection);
    -
    self.UniverseSettings.Asynchronous = True
    -self.AddUniverse(self.FundamentalUniverseSelection)
    -
    - - - -

    Bar Building

    - - -

    - The data feed is a stream of asset prices collected by WebSockets and distributed to algorithms on the platform. + displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings.

    -

    Alternative Data

    +

     

    + +
    +
    +

    Brokerages

    +

    FIX Connections

    +
    +
    +

    Introduction

    - Brokerage data providers support most alternative datasets, except data that streams real-time intraday data. Streaming datasets, like the - - Tiingo News Feed - - and - - Benzinga News Feed - - , require the QuantConnect data provider. + The Financial Information eXchange (FIX) is the standard electronic communications protocol for front-office messaging. The FIX community includes about 300 firms, including major investment banks.

    -

    Pricing

    +

    Supported Connections

    - The Tradier data feed is free for Tradier subscription accounts. If you have a free Tradier account, you may have to pay inactivity and maintenance fees. If you have less than $2,000 in total account value and less than 2 executed trades in 1 year, the inactivity fee is $50. If you have less than 2 executed trades per month, the international account monthly maintenance fee is $20. To view the latest prices, see the - - Pricing - - page on the Tradier website. + The following FIX connections are available on QuantConnect:

    + + + + + + + + + + + + + + + + + + + + +
    + Name + + Integration Implementation + + Model Implementation +
    + Raiffeisen Bank International + + + Lean.Brokerages.RaiffeisenBankInternational + + + + RBIBrokerageModel.cs + +
    + + Wolverine + + + + Lean.Brokerages.Wolverine + + + + WolverineBrokerageModel.cs + +

     

    - +
    -
    -

    Data Providers

    -

    Zerodha

    +
    +

    Brokerages

    +

    Unsupported Brokerages

    Introduction

    - Zerodha was founded by Nithin Kamath in 2010 with the goal to break all barriers that traders and investors face in India in terms of cost, support, and technology. Zerodha provides access to India Equities for clients in India with no minimum balance required. Zerodha also provides a mutual fund investment platform and an interactive portfolio dashboard. -

    -

    - The Zerodha data feed streams live asset prices from Zerodha. If you use this data feed and request historical data, the historical data comes from Zerodha. -

    - - - -

    Sourcing

    - - -

    - The Zerodha data feed comes directly from Zerodha. For more information about the data source, see the - - Kite Connect API documentation + New brokerages can be added if the brokerage has an API that is popular, stable, and officially supported by the brokerage. To add a new brokerage to the platform, + + contact us .

    -

    - If you use the Zerodha data feed, Zerodha only provides the security price data. We provide the following auxiliary datasets from the Dataset Market: -

    - - - - -

    Universe Selection

    - - -

    - Universe selection isn't available with the Zerodha data feed. -

    - - - -

    Bar Building

    - - -

    - The data feed consolidates prices and quotes across all of the Indian exchanges. -

    - - - -

    Alternative Data

    - - -

    - Brokerage data providers support most alternative datasets, except data that streams real-time intraday data. Streaming datasets, like the - - Tiingo News Feed - - and - - Benzinga News Feed - - , require the QuantConnect data provider. -

    - - - -

    Pricing

    - - -

    - The Zerodha data feed costs ₹2000/month for retail users. To view the latest prices, see the - - What are the charges for KITE APIs? - - page on the Zerodha website. -

     

    -
    +

    Live Trading

    Deployment

    @@ -30638,7 +30808,7 @@

    Wizard

    Deploy live wizard interface

    Most of the brokerages automatically load your cash holdings, position holdings, and submitted orders so that you can view your portfolio state on the - + live results page . For brokerages that don't automatically load your holdings, you can enter your cash and position holdings in the deployment wizard. @@ -30696,7 +30866,7 @@

    Security

     

    -
    +

    Live Trading

    Notifications

    @@ -31097,7 +31267,7 @@

    Terms of Use

     

    -
    +

    Live Trading

    Results

    @@ -31124,7 +31294,7 @@

    View Live Results

    Live result interface

    The content in the live results page updates as your algorithm executes. You can close or refresh the window without interrupting the algorithm because the live trading node processes on our servers. If you close the page, you can - + view all of your live projects to open the page again. @@ -31348,7 +31518,7 @@

    Built-in Charts

    A time series of an asset's price with order event annotations. For more information about these charts, see - + Asset Plots . @@ -31993,7 +32163,7 @@

    Errors

     

    -
    +

    Live Trading

    Algorithm Control

    @@ -32023,7 +32193,7 @@

    Add Security Subscriptions

    1. Open your algorithm's - + live results page . @@ -32107,7 +32277,7 @@

      Place Manual Trades

      1. Open your algorithm's - + live results page . @@ -32189,7 +32359,7 @@

        Liquidate Positions

        1. Open your algorithm's - + live results page . @@ -32252,7 +32422,7 @@

          Stop the Algorithm

          1. Open your algorithm's - + live results page . @@ -32328,7 +32498,7 @@

            Update the Algorithm

             

            -
            +

            Live Trading

            Reconciliation

            @@ -32338,7 +32508,7 @@

            Introduction

            Algorithms usually perform differently between backtesting and live trading over the same time period. Backtests are simulations where we model reality as close as possible, but the modeling isn't always perfect. To measure the performance differences, we run an out-of-sample (OSS) backtest in parallel to all of your live trading deployments. The - + live results page displays the live equity curve and the OOS backtest equity curve of your algorithms. @@ -32589,7 +32759,7 @@

             

            -
            +

            Live Trading

            Risks

            diff --git a/single-page/Quantconnect-Lean-Cli.html b/single-page/Quantconnect-Lean-Cli.html index 7f833aa58c..22a2dfebfc 100644 --- a/single-page/Quantconnect-Lean-Cli.html +++ b/single-page/Quantconnect-Lean-Cli.html @@ -7614,7 +7614,7 @@

            Research

            -

            Parameter Optimization

            +

            Optimization

            @@ -7923,7 +7923,7 @@

            Research

            -

            Parameter Optimization

            +

            Optimization

            @@ -8188,7 +8188,7 @@

            Research

            -

            Parameter Optimization

            +

            Optimization

            @@ -8426,7 +8426,7 @@

            Research

            -

            Parameter Optimization

            +

            Optimization

            @@ -12051,7 +12051,7 @@

            Push Changes to Git

            $ lean cloud pull
          2. - Warning: Undefined variable $leanCLI in /tmp/docs/6697a086e832ee7dc062090e26478fd4b30ac8de/Resources/cli/version-control/push-changes-to-git.php on line 9 + Warning: Undefined variable $leanCLI in /tmp/docs/e4cd878f7bb065188c7dcbda70f739c63a499865/Resources/cli/version-control/push-changes-to-git.php on line 9 Open a terminal in your organization workspace and then add the project directories and the Library @@ -15749,7 +15749,7 @@

            Deploy Cloud Algorithms

          3. Enter whether you want to use the - + price data from Interactive Brokers instead of the data from QuantConnect. Enabling this feature requires you to have active Interactive Brokers market data subscriptions for all data required by your algorithm. @@ -22526,6 +22526,19 @@

            Description

            , so you don't need to use this option multiple times for the same data provider if you are not switching between them. The following table shows the available data providers and their required options in non-interactive mode:

            +

            + You can use the + + --data-provider-historical + + option to change where the data is retrieved. + This option updates the + + Lean configuration file + + , so you don't need to use this option multiple times for the same data provider if you are not switching between them. + The following table shows the available data providers and their required options in non-interactive mode: +

            @@ -23039,6 +23052,12 @@

            Options

            . + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + +
            @@ -24428,7 +24447,7 @@

            Options

            Whether the - + Interactive Brokers data provider must be used instead of the one from QuantConnect ( @@ -24473,11 +24492,11 @@

            Options

            - + live to use the live environment or - + paper to use the developer sandbox. @@ -32012,6 +32031,12 @@

            Options

            .
            @@ -33731,6 +33756,230 @@

            Description

            . You can provide this option multiple times to configure multiple constraints.

            +

            + You can use the + + --data-provider-historical + + option to change where the data is retrieved. + This option updates the + + Lean configuration file + + , so you don't need to use this option multiple times for the same data provider if you are not switching between them. + The following table shows the available data providers and their required options in non-interactive mode: +

            + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
            + + --data-provider-historical + + + Required Options +
            + + AlphaVantage + + + + --alpha-vantage-api-key + +
            + + --alpha-vantage-price-plan + +
            + + IEX + + + + --iex-cloud-api-key + +
            + + --iex-price-plan + +
            + + IQFeed + + + + --iqfeed-iqconnect + +
            + + --iqfeed-username + +
            + + --iqfeed-password + +
            + + --iqfeed-version + +
            + + --iqfeed-host + +
            + + Local + + + N/A +
            + + Polygon + + + + --polygon-api-key + +
            + + QuantConnect + + + N/A +
            + + "Terminal Link" + + + + --terminal-link-connection-type + +
            + + --terminal-link-environment + +
            + + --terminal-link-server-host + +
            + + --terminal-link-server-port + +
            + + --terminal-link-emsx-broker + +
            + + --terminal-link-openfigi-api-key + +
            + + --terminal-link-server-auth-id + + if you use + + --terminal-link-connection-type SAPI + +
            +

            + You can use the + + --download-data + + flag as an alias for + + --data-provider-historical QuantConnect + + . This data provider automatically downloads the required data files when your backtest requests them. After it downloads a data file, it stores it in your local + + data + + directory so that in future runs, it won't have to download it again. If the file contain data for multiple days (for example, daily Equity price data files), the + + ApiDataProvider + + re-downloads the file if your local version is at least 7 days old. To adjust this setting, update the + + downloader-data-update-period + + value in your + + Lean configuration + + file. +

            Example non-interactive usage:

            @@ -33967,26 +34216,48 @@

            Options

            The 'statistic operator value' pairs configuring the constraints of the optimization. May be used multiple times.
            - --release + --data-provider-historical - Compile C# projects in release configuration instead of debug. + The historical data source.
            - --image <value> + --download-data + + + Update the + + Lean configuration file + + to download data from the QuantConnect API, alias for + + --data-provider-historical QuantConnect + + . +
            + + --release + + + Compile C# projects in release configuration instead of debug. +
            + + --image <value> @@ -34046,54 +34317,232 @@

            Options

            Use the local LEAN engine image instead of pulling the latest version.
            + + --iqfeed-iqconnect <path> + + + The path to your IQConnect binary. +
            + + --iqfeed-username <value> + + + Your IQFeed username. +
            + + --iqfeed-password <value> + + + Your IQFeed password. +
            + + --iqfeed-version <value> + + + The product version of your IQFeed developer account. +
            + + --iqfeed-host + + + The IQFeed host address. +
            + + --polygon-api-key <value> + + + Your + + Polygon.io + + API Key. +
            + + --iex-cloud-api-key + + + Your IEX Cloud API Key. +
            + + --iex-price-plan + + + Your IEX Cloud price plan. + + Launch + + , + + Grow + + , or + + Enterprise + + . +
            + + --alpha-vantage-api-key + + + Your Alpha Vantage API Key. +
            + + --alpha-vantage-price-plan + + + Your Alpha Vantage price plan. + + Free + + , + + Plan30 + + , + + Plan75 + + , + + Plan150 + + , + + Plan300 + + , + + Plan600 + + , or + + Plan1200 + + . +
            + + --terminal-link-connection-type <value> + + + The Terminal Link connection type, which must be + + SAPI + + or + + DAPI + + . +
            + + --terminal-link-server-auth-id <value> + + + Your unique user identifier (UUID). The UUID is a unique integer identifier that's assigned to each Bloomberg Anywhere user. If you don't know your UUID, contact Bloomberg. +
            + + --terminal-link-environment <value> + + + The environment to run in, which must be + + Production + + or + + Beta + + . +
            + + --terminal-link-server-host <value> + + + The host on which the Terminal Link server is running. +
            + + --terminal-link-server-port <value> + + + The port on which the Terminal Link server is running. +
            + + --terminal-link-openfigi-api-key <value> + + + The Open FIGI API key to use for mapping Options. +
            @@ -35120,16 +35569,6 @@

            Options

            The historical data source.
            - - --data-provider-historical - - - The historical data source. -
            @@ -35274,6 +35713,12 @@

            Options

            .
            diff --git a/single-page/Quantconnect-Local-Platform.html b/single-page/Quantconnect-Local-Platform.html index 909fe56493..25a77c8db7 100644 --- a/single-page/Quantconnect-Local-Platform.html +++ b/single-page/Quantconnect-Local-Platform.html @@ -62,9 +62,10 @@

            Table of Content

          4. 4.2 Files
          5. 4.3 Shared Libraries
          6. 4.4 Version Control
          7. -
          8. 5 Data Management
          9. +
          10. 5 Datasets
          11. 5.1 Getting Started
          12. 5.2 Downloading Data
          13. +
          14. 5.3 Polygon
          15. 6 Backtesting
          16. 6.1 Getting Started
          17. 6.2 Deployment
          18. @@ -3819,7 +3820,7 @@

            Keyboard Shortcuts

            1. Open a project @@ -5123,17 +5124,17 @@

              Push Changes to Git

               

              - +
              -

              Data Management

              +

              Datasets

              - +
              -

              Data Management

              +

              Datasets

              Getting Started

              @@ -5266,7 +5267,7 @@

              • - + A brokerage data provider
              • @@ -5299,7 +5300,7 @@

                When you deploy algorithms to QuantConnect Cloud, you can use any of - + the data providers we support in the cloud . Your live algorithms run on our co-located servers that have 10 GB transfer speeds and low latency. @@ -5308,10 +5309,10 @@

                 

                - +
                -

                Data Management

                +

                Datasets

                Downloading Data

                @@ -5360,6 +5361,167 @@

                +

                 

                + +
                +
                +

                Datasets

                +

                Polygon

                +
                +
                +

                Introduction

                + + +

                + Polygon was founded by Quinton Pike in 2017 with the goal to "break down the barriers that have traditionally limited access to high-quality financial data for all". Polygon provides institutional-grade Equity, Option, Index, Forex, and Crypto data for business and educational purposes. +

                +

                + The Polygon data provider streams live asset prices from Polygon. If you use this data provider and request historical data, the historical data comes from Polygon. +

                + + + +

                Sourcing

                + + +

                + The Polygon data feed comes directly from Polygon. For more information about the data source, see the + + Polygon API documentation + + . +

                +

                + If you use the Polygon data provider, Polygon only provides the security price data. If you trade US Equities or US Equity Options, you'll also need to + + download the US Equity Security Master with the CLI + + . +

                + + + +

                Universe Selection

                + + +

                + + Universe Selection + + is available with the Polygon data provider if you download the data from the + + Dataset Market + + . The dataset listings show how to download the universe selection data with the CLI. For live trading, you'll need to periodically download the new data from QuantConnect Cloud, which you can automate with Python scripts. For example, the following tutorials explain how to download historical data and download daily updates: +

                + + + + +

                Bar Building

                + + +

                + The data feed is a stream of asset prices collected by WebSockets and distributed to algorithms on the platform. +

                + + + +

                Alternative Data

                + + +

                + Third-party data providers support most alternative datasets, except data that streams real-time intraday data. Streaming datasets, like the + + Tiingo News Feed + + and + + Benzinga News Feed + + , require the QuantConnect data provider. +

                + + + +

                Research

                + + +

                + The Polygon data provider is not currently supported for the Local Platform Research Environment. +

                + + + +

                Backtesting

                + + +

                + The Polygon data provider is not currently supported for backtesting on Local Platform. +

                + + + +

                Optimization

                + + +

                + The Polygon data provider is not currently supported for optimization on Local Platform. +

                + + + +

                Live Trading

                + + +

                + The Polygon data provider is not currently supported for live trading on Local Platform. +

                +

                + If you deploy local live algorithms that trade US Equities or US Equity Options, you'll need to periodically update your US Equity Security Master. Weekly updates are sufficient in most cases. +

                +

                + If you deploy local live algorithms that rely on US Equity universe data, you'll need to download the latest data files every trading day. For an example Python script that updates local US Equity Coarse Universe files, see + + Download Daily Updates + + . For an example Python script that updates local US ETF Constituents files, see + + Download Daily Updates + + . To update + + alternative datasets that support universe selection + + , see the CLI commands in their respective dataset listing. +

                + + + +

                Pricing

                + + +

                + To view the prices of the Polygon API packages, see the + + Simple Pricing + + page on the Polygon website. +

                + + +

                 

                @@ -8027,7 +8189,7 @@

                Rename Notebooks

                .

            - Warning: Undefined variable $videoLink in /tmp/docs/6697a086e832ee7dc062090e26478fd4b30ac8de/Resources/getting-started/projects/rename-files.php on line 10 + Warning: Undefined variable $videoLink in /tmp/docs/e4cd878f7bb065188c7dcbda70f739c63a499865/Resources/getting-started/projects/rename-files.php on line 10 @@ -9084,7 +9246,7 @@

            Data Providers

            Local Platform currently supports several - + brokerage data providers . To use other data providers, diff --git a/single-page/Quantconnect-Research-Environment.html b/single-page/Quantconnect-Research-Environment.html index f3a23ea48a..943047e958 100644 --- a/single-page/Quantconnect-Research-Environment.html +++ b/single-page/Quantconnect-Research-Environment.html @@ -477,7 +477,7 @@

            Rename Notebooks

            . - Warning: Undefined variable $videoLink in /tmp/docs/6697a086e832ee7dc062090e26478fd4b30ac8de/Resources/getting-started/projects/rename-files.php on line 10 + Warning: Undefined variable $videoLink in /tmp/docs/e4cd878f7bb065188c7dcbda70f739c63a499865/Resources/getting-started/projects/rename-files.php on line 10 @@ -1215,7 +1215,7 @@

            Set Time Zone

            -Warning: Undefined variable $cCodePrefix in /tmp/docs/6697a086e832ee7dc062090e26478fd4b30ac8de/Resources/initialization/set-time-zone.php on line 8
            +Warning: Undefined variable $cCodePrefix in /tmp/docs/e4cd878f7bb065188c7dcbda70f739c63a499865/Resources/initialization/set-time-zone.php on line 8
             SetTimeZone("Europe/London");
             qb.SetTimeZone(NodaTime.DateTimeZone.Utc);
             qb.SetTimeZone(TimeZones.Chicago);
            @@ -3108,7 +3108,7 @@ 

            Data Normalization

            corporate actions . -Warning: Undefined variable $isWritingAlgorithms in /tmp/docs/6697a086e832ee7dc062090e26478fd4b30ac8de/Resources/securities/data-normalization.php on line 1 +Warning: Undefined variable $isWritingAlgorithms in /tmp/docs/e4cd878f7bb065188c7dcbda70f739c63a499865/Resources/securities/data-normalization.php on line 1 By default, LEAN adjusts US Equity data for splits and dividends to produce a smooth price curve, but the following data normalization modes are available:

            @@ -9948,7 +9948,7 @@

            Data Normalization

            The data normalization mode doesn't affect data from history request for Futures contracts. -Warning: Undefined variable $additionalInformation in /tmp/docs/6697a086e832ee7dc062090e26478fd4b30ac8de/Resources/securities/data-normalization-raw-only.php on line 1 +Warning: Undefined variable $additionalInformation in /tmp/docs/e4cd878f7bb065188c7dcbda70f739c63a499865/Resources/securities/data-normalization-raw-only.php on line 1 If you change the data normalization mode, it won't change the outcome.

            @@ -16532,7 +16532,7 @@

            var allHistoryQuoteBars = qb.History<QuoteBar>(qb.Securities.Keys, TimeSpan.FromDays(3), Resolution.Minute); -Warning: Undefined variable $supportsTicks in /tmp/docs/6697a086e832ee7dc062090e26478fd4b30ac8de/Resources/datasets/research-environment/get-historical-data.php on line 93 +Warning: Undefined variable $supportsTicks in /tmp/docs/e4cd878f7bb065188c7dcbda70f739c63a499865/Resources/datasets/research-environment/get-historical-data.php on line 93 // OpenInterest objects var singleHistoryOpenInterest = qb.History<OpenInterest>("SPX", TimeSpan.FromDays(2)); @@ -16572,7 +16572,7 @@

            all_history_quote_bars = qb.History[QuoteBar](qb.Securities.Keys, timedelta(days=3), Resolution.Minute) -Warning: Undefined variable $supportsTicks in /tmp/docs/6697a086e832ee7dc062090e26478fd4b30ac8de/Resources/datasets/research-environment/get-historical-data.php on line 137 +Warning: Undefined variable $supportsTicks in /tmp/docs/e4cd878f7bb065188c7dcbda70f739c63a499865/Resources/datasets/research-environment/get-historical-data.php on line 137 # OpenInterest objects single_history_open_interest = qb.History[OpenInterest]("SPX", timedelta(days=2)) @@ -16634,7 +16634,7 @@

            var allHistoryQuoteBars = qb.History<QuoteBar>(qb.Securities.Keys, startTime, endTime, Resolution.Minute); -Warning: Undefined variable $supportsTicks in /tmp/docs/6697a086e832ee7dc062090e26478fd4b30ac8de/Resources/datasets/research-environment/get-historical-data.php on line 177 +Warning: Undefined variable $supportsTicks in /tmp/docs/e4cd878f7bb065188c7dcbda70f739c63a499865/Resources/datasets/research-environment/get-historical-data.php on line 177 // OpenInterest objects var singleHistoryOpenInterest = qb.History<OpenInterest>("SPX", startTime, endTime); @@ -16674,7 +16674,7 @@

            all_history_quote_bars = qb.History[QuoteBar](qb.Securities.Keys, start_time, end_time, Resolution.Minute) -Warning: Undefined variable $supportsTicks in /tmp/docs/6697a086e832ee7dc062090e26478fd4b30ac8de/Resources/datasets/research-environment/get-historical-data.php on line 221 +Warning: Undefined variable $supportsTicks in /tmp/docs/e4cd878f7bb065188c7dcbda70f739c63a499865/Resources/datasets/research-environment/get-historical-data.php on line 221 # OpenInterest objects single_history_open_interest = qb.History[OpenInterest]("SPX", start_time, end_time) diff --git a/single-page/Quantconnect-Writing-Algorithms.html b/single-page/Quantconnect-Writing-Algorithms.html index 66ac8a24ad..d0bcc29256 100644 --- a/single-page/Quantconnect-Writing-Algorithms.html +++ b/single-page/Quantconnect-Writing-Algorithms.html @@ -1802,7 +1802,7 @@

            Algorithm Time Zone

            -Warning: Undefined variable $cCodePrefix in /tmp/docs/6697a086e832ee7dc062090e26478fd4b30ac8de/Resources/initialization/set-time-zone.php on line 8
            +Warning: Undefined variable $cCodePrefix in /tmp/docs/e4cd878f7bb065188c7dcbda70f739c63a499865/Resources/initialization/set-time-zone.php on line 8
             SetTimeZone("Europe/London");
             SetTimeZone(NodaTime.DateTimeZone.Utc);
             SetTimeZone(TimeZones.Chicago);
            @@ -6085,7 +6085,7 @@ 

            Set Time Zone

            -Warning: Undefined variable $cCodePrefix in /tmp/docs/6697a086e832ee7dc062090e26478fd4b30ac8de/Resources/initialization/set-time-zone.php on line 8
            +Warning: Undefined variable $cCodePrefix in /tmp/docs/e4cd878f7bb065188c7dcbda70f739c63a499865/Resources/initialization/set-time-zone.php on line 8
             SetTimeZone("Europe/London");
             SetTimeZone(NodaTime.DateTimeZone.Utc);
             SetTimeZone(TimeZones.Chicago);
            @@ -8084,11 +8084,11 @@ 

            Introduction

            US Equities dataset listing . To trade US Equities live, you can use the - + QuantConnect data provider or one of the - + brokerage data providers . @@ -9155,7 +9155,7 @@

            Ticks

            If - + we detect a tick that may be suspicious , we set its @@ -12212,6 +12212,11 @@

            Holidays

            2025-01-20
            + 2025-02-17 +
            @@ -12813,7 +12818,7 @@

            Introduction

            OnData method. Historical data for backtesting is unavailable. To trade India Equities live, you can use one of the - + brokerage data providers . @@ -15176,7 +15181,7 @@

            Introduction

            US Equity Options dataset listing . To trade Equity Options live, you can use one of the - + brokerage data providers . We currently only support American-style Options for US Equity Options. @@ -17821,6 +17826,11 @@

            Holidays

            2025-01-20 + + + 2025-02-17 + + @@ -18426,7 +18436,7 @@

            Introduction

            CoinAPI datasets . To trade Crypto live, you can use the - + QuantConnect data provider . @@ -19642,7 +19652,7 @@

            Introduction

            Binance Crypto Future Price Data dataset listing . To trade Crypto Futures live, you can use the - + QuantConnect data provider . @@ -20799,7 +20809,7 @@

            Introduction

            FOREX dataset listing . To trade Forex live, you can use the - + QuantConnect data provider . @@ -26399,11 +26409,11 @@

            Introduction

            US Futures dataset listing . To trade Futures live, you can use the - + QuantConnect data provider or one of the - + brokerage data providers . @@ -473785,11 +473795,11 @@

            Introduction

            US Future Options dataset listing . To trade Future Options live, you can use the - + QuantConnect data feed or one of the - + brokerage data providers . We currently only support American-style Options for Future Options. @@ -475531,7 +475541,7 @@

            Introduction

            US Cash Indices dataset listing . To trade live with Index data, you can use one of the - + brokerage data providers . @@ -482285,7 +482295,7 @@

            Introduction

            US Index Options dataset listing . To trade Index Options live, you can use one of the - + brokerage data providers . Index Options are exclusively European-style Options. @@ -490102,7 +490112,7 @@

            Introduction

            CFD dataset listing . To trade CFDs live, you can use our - + QuantConnect data provider . @@ -584169,7 +584179,7 @@

            Example Applications

            -
          19. @@ -593074,7 +593084,7 @@

            Consolidate Quote Ticks

            - Warning: Undefined variable $resolveConsolidatorExtraArgsPy in /tmp/docs/6697a086e832ee7dc062090e26478fd4b30ac8de/03 Writing Algorithms/18 Consolidating Data/02 Consolidator Types/01 Time Period Consolidators/05 Consolidate Quote Ticks.php on line 20 + Warning: Undefined variable $resolveConsolidatorExtraArgsPy in /tmp/docs/e4cd878f7bb065188c7dcbda70f739c63a499865/03 Writing Algorithms/18 Consolidating Data/02 Consolidator Types/01 Time Period Consolidators/05 Consolidate Quote Ticks.php on line 20

            @@ -643946,7 +643956,7 @@

            Settlement

            DelayedSettlementModel with the -Warning: Undefined variable $includeLinks in /tmp/docs/6697a086e832ee7dc062090e26478fd4b30ac8de/Resources/reality-modeling/default-settlement-models.php on line 13 +Warning: Undefined variable $includeLinks in /tmp/docs/e4cd878f7bb065188c7dcbda70f739c63a499865/Resources/reality-modeling/default-settlement-models.php on line 13 default settlement rules @@ -643962,7 +643972,7 @@

            Settlement

            DelayedSettlementModel with the -Warning: Undefined variable $includeLinks in /tmp/docs/6697a086e832ee7dc062090e26478fd4b30ac8de/Resources/reality-modeling/default-settlement-models.php on line 18 +Warning: Undefined variable $includeLinks in /tmp/docs/e4cd878f7bb065188c7dcbda70f739c63a499865/Resources/reality-modeling/default-settlement-models.php on line 18 default settlement rules @@ -776606,7 +776616,7 @@

            Introduction

            These types of universes operate on daily schedule. In backtests, they select assets at midnight. In live trading, the selection timing depends on the - + data provider you use. @@ -780007,7 +780017,7 @@

            Introduction

            These types of universes operate on daily schedule. In backtests, they select assets at midnight. In live trading, the selection timing depends on the - + data provider you use. @@ -790169,8 +790179,8 @@

            Introduction

            Data providers provide a stream of asset prices and quotes delivered to your trading algorithm during live execution. You need live data provider to inject data into your algorithm so that you can make real-time trading decisions and so that the values of the securities in your portfolio update in real-time. You can source data from QuantConnect, brokerage, or a third-party source. To view the available data providers you can use in QuantConnect cloud, see - - Data Providers + + Datasets . To view the available data providers you can use with local algorithms, see the