{"id":19553605,"url":"https://github.com/quantconnect/lean.brokerages.tradier","last_synced_at":"2025-04-26T20:32:11.372Z","repository":{"id":62646513,"uuid":"474112900","full_name":"QuantConnect/Lean.Brokerages.Tradier","owner":"QuantConnect","description":"Tradier Brokerage Implementation","archived":false,"fork":false,"pushed_at":"2025-04-03T21:24:15.000Z","size":145,"stargazers_count":3,"open_issues_count":6,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-04T18:01:49.105Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QuantConnect.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-25T17:54:10.000Z","updated_at":"2024-12-19T17:06:22.000Z","dependencies_parsed_at":"2024-01-29T19:42:28.873Z","dependency_job_id":"bff971da-39e6-4752-abed-67b2060b1265","html_url":"https://github.com/QuantConnect/Lean.Brokerages.Tradier","commit_stats":null,"previous_names":[],"tags_count":1469,"template":false,"template_full_name":"QuantConnect/Lean.Brokerages.Template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuantConnect%2FLean.Brokerages.Tradier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuantConnect%2FLean.Brokerages.Tradier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuantConnect%2FLean.Brokerages.Tradier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuantConnect%2FLean.Brokerages.Tradier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QuantConnect","download_url":"https://codeload.github.com/QuantConnect/Lean.Brokerages.Tradier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251051563,"owners_count":21528788,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T04:23:59.682Z","updated_at":"2025-04-26T20:32:09.986Z","avatar_url":"https://github.com/QuantConnect.png","language":"C#","readme":"![header-cheetah](https://user-images.githubusercontent.com/79997186/184224088-de4f3003-0c22-4a17-8cc7-b341b8e5b55d.png)\n\n\u0026nbsp;\n\u0026nbsp;\n\u0026nbsp;\n\n## Introduction\n\nThis repository hosts the Tradier Brokerage Plugin Integration with the QuantConnect LEAN Algorithmic Trading Engine. LEAN is a brokerage agnostic operating system for quantitative finance. Thanks to open-source plugins such as this [LEAN](https://github.com/QuantConnect/Lean) can route strategies to almost any market.\n\n[LEAN](https://github.com/QuantConnect/Lean) is maintained primarily by [QuantConnect](https://www.quantconnect.com), a US based technology company hosting a cloud algorithmic trading platform. QuantConnect has successfully hosted more than 200,000 live algorithms since 2015, and trades more than $1B volume per month.\n\n\n### About Tradier\n\n\u003cp align=\"center\"\u003e\n\u003cpicture \u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://user-images.githubusercontent.com/79997186/188235199-45cb05cc-c47a-40a3-805b-7e45ab666d8d.png\"\u003e\n  \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://user-images.githubusercontent.com/79997186/188235221-21b40e87-eb08-44fa-9402-2dd1418eb622.png\"\u003e\n  \u003cimg alt=\"introduction\" width=\"20%\"\u003e\n\u003c/picture\u003e\n\u003cp\u003e\n\nTradier 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](https://brokerage.tradier.com/support). Tradier also delivers custody, clearing, execution, and billing on behalf of registered advisors.\n\nFor more information about the Tradier brokerage, see  the [QuantConnect-Tradier Integration Page](https://www.quantconnect.com/docs/v2/our-platform/live-trading/brokerages/tradier). \n\n## Using the Brokerage Plugin\n  \n### Deploying Tradier with VSCode User Interace\n\n  You can deploy using a visual interface in the QuantConnect cloud. For instructions, see the [QuantConnect-Tradier Integration Page](https://www.quantconnect.com/docs/v2/our-platform/live-trading/brokerages/tradier). \n\n![deploy-tradier](https://user-images.githubusercontent.com/38889814/188247546-9aac048c-f271-403e-903e-0f9bbfe95b0c.gif)\n\n  In the QuantConnect Cloud Platform, you can harness the QuantConnect Live Data Feed or the Tradier Live Data Feed. For most users, this is substantially cheaper and easier than self-hosting.\n  \n### Deploying Tradier with LEAN CLI\n\nFollow these steps to start local live trading with the Tradier brokerage:\n\n1.  Open a terminal in your [CLI root directory](https://www.quantconnect.com/docs/v2/lean-cli/initialization/directory-structure#02-lean-init).\n2.  Run `lean live \"\u003cprojectName\u003e\"` to start a live deployment wizard for the project in `./\u003cprojectName\u003e` and then enter the brokerage number.\n\n\t```\n    $ lean live \"My Project\"\n    Select a brokerage:\n    1) Paper Trading\n    2) Interactive Brokers\n    3) Tradier\n    4) OANDA\n    5) Bitfinex\n    6) Coinbase Pro\n    7) Binance\n    8) Zerodha\n    9) Samco\n    10) Terminal Link\n    11) Atreyu\n    12) Trading Technologies\n    13) Kraken\n    14) FTX \n    Enter an option: \n\t```\n\n\n3.  Enter your Tradier account ID and access token.\n\n    ```\n    $ lean live \"My Project\"\n    Account id: VA000001\n    Access token: ****************\n    ```\n\n    To get these credentials, see your [Settings/API Access page](https://dash.tradier.com/settings/api) on the Tradier website.\n\n4.  Enter whether the developer sandbox should be used.\n\n    ```\n    $ lean live \"My Project\"\n    Use the developer sandbox? (live, paper): live\n    ```\n\n5.  Enter the number of the data feed to use and then follow the steps required for the data connection.\n\n    ```\n    $ lean live \"My Project\"\n    Select a data feed:\n    1) Interactive Brokers\n    2) Tradier\n    3) Oanda\n    4) Bitfinex\n    5) Coinbase Pro\n    6) Binance\n    7) Zerodha\n    8) Samco\n    9) Terminal Link\n    10) Trading Technologies\n    11) Kraken\n    12) FTX\n    13) IQFeed\n    14) Polygon Data Feed\n    15) Custom data only\n    To enter multiple options, separate them with comma.:\n    ```\n\n    If you select IQFeed, see [IQFeed](https://www.quantconnect.com/docs/v2/lean-cli/live-trading/other-data-feeds/iqfeed) for set up instructions.  \n    If you select Polygon Data Feed, see [Polygon](https://www.quantconnect.com/docs/v2/lean-cli/live-trading/other-data-feeds/polygon) for set up instructions.\n\n6.  View the result in the `\u003cprojectName\u003e/live/\u003ctimestamp\u003e` directory. Results are stored in real-time in JSON format. You can save results to a different directory by providing the `--output \u003cpath\u003e` option in step 2.\n\nIf you already have a live environment configured in your Lean configuration file, you can skip the interactive wizard by providing the `--environment \u003cvalue\u003e` option in step 2. The value of this option must be the name of an environment which has `live-mode` set to `true`.\n\n\n## Account Types\n\nTradier supports cash and margin accounts.\n\n## Order Types and Asset Classes\n\nThe following table describes the available order types for each asset class that Tradier supports:\n\n| Order Type  | Equity | Equity Options |\n| ----------- | ----------- | ----------- |\n| `MarketOrder` | Yes | Yes |\n| `LimitOrder` | Yes | Yes |\n| `LimitIfTouchedOrder` | Yes | Yes |\n| `StopMarketOrder` | Yes | Yes |\n| `StopLimitOrder` | Yes | Yes |\n| `ExerciseOption` | No | Yes |\n\n\n## Downloading Data\n\nFor local deployment, the algorithm needs to download the following datasets:\n\n- [US Equities Security Master](https://www.quantconnect.com/datasets/quantconnect-us-equity-security-master) provided by QuantConnect\n- [US Equities](https://www.quantconnect.com/datasets/algoseek-us-equities)\n- [US Coarse Universe](https://www.quantconnect.com/datasets/quantconnect-us-coarse-universe-constituents)\n- [US Equity Options](https://www.quantconnect.com/datasets/algoseek-us-equity-options)\n\n## Brokerage Model\n\nLean models the brokerage behavior for backtesting purposes. The margin model is used in live trading to avoid placing orders that will be rejected due to insufficient buying power.\n\nYou can set the Brokerage Model with the following statements\n\n    SetBrokerageModel(BrokerageName.TradierBrokerage, AccountType.Cash);\n    SetBrokerageModel(BrokerageName.TradierBrokerage, AccountType.Margin);\n\n[Read Documentation](https://www.quantconnect.com/docs/v2/our-platform/live-trading/brokerages/tradier)\n\n### Fees\n\nWe model the order fees of Tradier. The following table shows the fees of each asset class:\n\n| Asset Class | Fee | \n| ----------- | ----------- |\n| Equities | $0 | \n| Options | $0.35/contract | \n\nThere is a $9 fee to exercise Option contracts.\n\nTo check the latest fees, see the [Pricing](https://brokerage.tradier.com/pricing) page on the Tradier website.\n\n### Margin\n\nWe model buying power and margin calls to ensure your algorithm stays within the margin requirements.\n\n[Read Documentation](https://www.quantconnect.com/docs/v2/our-platform/live-trading/brokerages/tradier)\n\n#### Buying Power\n\nIn the US, Tradier allows up to 2x leverage on Equity trades for margin accounts. In other countries, Tradier may offer different amounts of leverage. To figure out how much leverage you can access, check with your local legislation or contact a Tradier representative. We model the US version of Tradier leverage by default.\n\n#### Margin Calls\n\nRegulation T margin rules apply. When the amount of margin remaining in your portfolio drops below 5% of the total portfolio value, you receive a [warning](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/margin-calls#08-Monitor-Margin-Call-Events). When the amount of margin remaining in your portfolio drops to zero or goes negative, the portfolio sorts the generated margin call orders by their unrealized profit and executes each order synchronously until your portfolio is within the margin requirements.\n\n#### Pattern Day Trading\n\nIf all of the following statements are true, you are classified as a pattern day trader:\n\n- You reside in the United States.\n- You trade in a margin account.\n- You execute 4+ intraday US Equity trades within 5 business days.\n- Your intraday US Equity trades represent more than 6% of your total trades.\n\nPattern day traders must maintain a minimum equity of $25,000 in their margin account to continue trading. For more information about pattern day trading, see [Am I a Pattern Day Trader?](https://www.finra.org/investors/learn-to-invest/advanced-investing/day-trading-margin-requirements-know-rules) on the FINRA website.\n\nThe `PatternDayTradingMarginModel` doesn't enforce minimum equity rules and doesn't limit your trades, but it adjusts your available leverage based on the market state. During regular market hours, you can use up to 4x leverage. During extended market hours, you can use up to 2x leverage.\n\n```\nsecurity.MarginModel = new PatternDayTradingMarginModel();\n```\n\n### Slippage\n\nOrders through Tradier do not experience slippage in backtests. In paper trading and live trading, your orders may experience slippage.\n\n### Fills\n\nWe 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.\n\n### Settlements\n\nIf you trade with a margin account, trades settle immediately. If you trade with a cash account, Equity trades settle 3 days after the transaction date (T+3) and Option trades settle on the business day following the transaction (T+1).\n\n\n### Deposits and Withdraws\n\nYou 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).\n\n\n\u0026nbsp;\n\u0026nbsp;\n\u0026nbsp;\n\n![whats-lean](https://user-images.githubusercontent.com/79997186/184042682-2264a534-74f7-479e-9b88-72531661e35d.png)\n\n\u0026nbsp;\n\u0026nbsp;\n\u0026nbsp;\n\nLEAN Engine is an open-source algorithmic trading engine built for easy strategy research, backtesting, and live trading. We integrate with common data providers and brokerages, so you can quickly deploy algorithmic trading strategies.\n\nThe core of the LEAN Engine is written in C#, but it operates seamlessly on Linux, Mac and Windows operating systems. To use it, you can write algorithms in Python 3.8 or C#. QuantConnect maintains the LEAN project and uses it to drive the web-based algorithmic trading platform on the website.\n\n## Contributions\n\nContributions are warmly very welcomed but we ask you to read the existing code to see how it is formatted, commented and ensure contributions match the existing style. All code submissions must include accompanying tests. Please see the [contributor guide lines](https://github.com/QuantConnect/Lean/blob/master/CONTRIBUTING.md).\n\n## Code of Conduct\n\nWe ask that our users adhere to the community [code of conduct](https://www.quantconnect.com/codeofconduct) to ensure QuantConnect remains a safe, healthy environment for\nhigh quality quantitative trading discussions.\n\n## License Model\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You\nmay obtain a copy of the License at\n\n\u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquantconnect%2Flean.brokerages.tradier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquantconnect%2Flean.brokerages.tradier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquantconnect%2Flean.brokerages.tradier/lists"}