{"id":206683,"date":"2024-05-15T10:29:12","date_gmt":"2024-05-15T14:29:12","guid":{"rendered":"https:\/\/ibkrcampus.com\/?p=206683"},"modified":"2024-08-13T16:15:13","modified_gmt":"2024-08-13T20:15:13","slug":"lean-engine-on-aws-and-interactive-brokers-guide","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/lean-engine-on-aws-and-interactive-brokers-guide\/","title":{"rendered":"LEAN Engine (on AWS) and Interactive Brokers Guide"},"content":{"rendered":"\n<p><em>The article &#8220;LEAN Engine (on AWS) and Interactive Brokers Guide&#8221; first appeared on <a href=\"https:\/\/algotrading101.com\/learn\/lean-engine-aws-interactive-brokers-guide\/\">AlgoTrading101<\/a> blog.<\/em><\/p>\n\n\n\n<p>Table of contents:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>What is the LEAN Engine?<\/li>\n\n\n\n<li>What is LEAN Engine used for?<\/li>\n\n\n\n<li>What is QuantConnect?<\/li>\n\n\n\n<li>What is Interactive Brokers?<\/li>\n\n\n\n<li>Why should I use the LEAN Engine?<\/li>\n\n\n\n<li>Why shouldn\u2019t I use the LEAN Engine?<\/li>\n\n\n\n<li>How to get started with the LEAN Engine and AWS?<\/li>\n\n\n\n<li>How to set up your AWS cloud server for the LEAN Engine?<\/li>\n\n\n\n<li>How to run a bot on Interactive Brokers with LEAN Engine?<\/li>\n\n\n\n<li>How to stop a LEAN Engine bot from running?<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-what-is-the-lean-engine\">What is the LEAN Engine?<\/h2>\n\n\n\n<p>The LEAN Engine is an open-sourced algorithmic trading engine. The LEAN Engine is built by QuantConnect and seamlessly integrated with it.<\/p>\n\n\n\n<p><a>Link to the repository:&nbsp;<\/a><a href=\"https:\/\/github.com\/QuantConnect\/Lean\/tree\/master\">QuantConnect\/Lean: Lean Algorithmic Trading Engine by QuantConnect (Python, C#) (github.com)<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-what-is-lean-engine-used-for\">What is LEAN Engine used for?<\/h2>\n\n\n\n<p>The LEAN Engine is mostly used by algorithmic traders who want to backtest their trading strategies and\/or deploy them in a live market.<\/p>\n\n\n\n<p>We will demonstrate how to connect the LEAN engine to your Interactive Brokers\u2019 account.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-what-is-quantconnect\">What is QuantConnect?<\/h2>\n\n\n\n<p>QuantConnect is an algorithmic trading platform that lets you develop, test and execute strategies. It integrates with many brokers and exchanges and is often used by algorithmic traders. You can read more about it below:<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-quantitative-trading-ideas-and-guides-algotrading-101-blog wp-block-embed-quantitative-trading-ideas-and-guides-algotrading-101-blog\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"GIbk59n9sH\"><a href=\"https:\/\/algotrading101.com\/learn\/quantconnect-guide\/\">QuantConnect &#8211; A Complete Guide<\/a><\/blockquote><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;QuantConnect &#8211; A Complete Guide&#8221; &#8212; Quantitative Trading Ideas and Guides - AlgoTrading101 Blog\" src=\"https:\/\/algotrading101.com\/learn\/quantconnect-guide\/embed\/#?secret=GMq4HmTwmM#?secret=GIbk59n9sH\" data-secret=\"GIbk59n9sH\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">What is Interactive Brokers?<\/h2>\n\n\n\n<p>Interactive Brokers (IBKR) is an online brokerage that offers trading solutions for traders, investors, and advisors, with global access to stocks, options, futures, currencies, bonds, and funds.<\/p>\n\n\n\n<p><a>Website:&nbsp;<\/a><a href=\"https:\/\/www.interactivebrokers.co.uk\/en\/home.php\">https:\/\/www.interactivebrokers.co.uk\/en\/home.php<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why should I use the LEAN Engine?<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>LEAN Engine is easy to use.<\/li>\n\n\n\n<li>LEAN Engine is fast and performant.<\/li>\n\n\n\n<li>Has a highly modular design.<\/li>\n\n\n\n<li>Allows the use of custom data.<\/li>\n\n\n\n<li>Has Visual Studio and JupyterLab integrations.<\/li>\n\n\n\n<li>Has access to live data streams.<\/li>\n\n\n\n<li>Costs you less to self-host it.<\/li>\n\n\n\n<li>Higher sense of privacy.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Why shouldn\u2019t I use the LEAN Engine?<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>LEAN Engine might be harder to use for beginners.<\/li>\n\n\n\n<li>LEAN Engine uses your local resources vs the QuantConnect Web UI that offers external ones.<\/li>\n\n\n\n<li>Requires setup and a running server.<\/li>\n\n\n\n<li>Requires more overhead.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">How to get started with the LEAN Engine and AWS?<\/h2>\n\n\n\n<p>To get started with the LEAN Engine, we will need to have a few things ready and those are the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A QuantConnect account<\/li>\n\n\n\n<li>QuantConnect account User ID and Token<\/li>\n\n\n\n<li>An IBKR account<\/li>\n\n\n\n<li>An AWS Account and EC2 instance<\/li>\n\n\n\n<li>Python and Docker<\/li>\n<\/ul>\n\n\n\n<p><a>You can follow our&nbsp;<\/a><a href=\"https:\/\/algotrading101.com\/learn\/quantconnect-guide\/\">QuantConnect<\/a>&nbsp;article to get a sense of the overall platform and get your account ready. To obtain the User ID and Token, navigate to your profile settings by clicking the Account icon in the upper right corner of your screen.<\/p>\n\n\n\n<p>When there, scroll down until you see hyperlinked text that states \u201cRequest Email With Token and Your User-Id for API Requests\u201d, click and you will get an email from QuantConnect with the information you need. Make sure to keep this secret.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1094\" height=\"579\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/lean-ibkr-algotrading101.jpg\" alt=\"\" class=\"wp-image-206690 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/lean-ibkr-algotrading101.jpg 1094w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/lean-ibkr-algotrading101-700x370.jpg 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/lean-ibkr-algotrading101-300x159.jpg 300w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/lean-ibkr-algotrading101-768x406.jpg 768w\" data-sizes=\"(max-width: 1094px) 100vw, 1094px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1094px; aspect-ratio: 1094\/579;\" \/><\/figure>\n\n\n\n<p>For an IBKR account, navigate to their&nbsp;<a href=\"https:\/\/www.interactivebrokers.co.uk\/en\/home.php\">landing page<\/a>&nbsp;and click the red \u201cOpen Account\u201d button. Then, follow through their guides and UI to have the account verified and set up. Make sure to know your Username and Password as we will need them.<\/p>\n\n\n\n<p>To set up your Amazon Web Services (AWS) account you can follow&nbsp;<a href=\"https:\/\/algotrading101.com\/learn\/live-algo-trading-on-the-cloud-aws\/\">this blog post<\/a>. When it comes to spinning up an EC2 server, you can pick a good location as shown in the blog post, and an Ubuntu t2.small instance should be enough for this article.<\/p>\n\n\n\n<p>One important detail is to provision at least 50GB or so of memory to your EC2 instance as the docker containers that LEAN uses are very bulky and not well optimized for size.<\/p>\n\n\n\n<p>In the following section, I\u2019ll show you how to set up Python and Docker.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to set up your AWS cloud server for the LEAN Engine?<\/h2>\n\n\n\n<p>To set up your cloud server for the LEAN Engine you will need to perform 5 steps which are the following:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create a User<\/li>\n\n\n\n<li>Install Docker<\/li>\n\n\n\n<li>Create a Python virtual environment<\/li>\n\n\n\n<li>Install LEAN<\/li>\n\n\n\n<li>Configure LEAN Engine<\/li>\n<\/ol>\n\n\n\n<p>It is always good to start with updating and upgrading your fresh servers as they will often have new security updates to be made. To do this, we run:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ sudo apt-get update &amp;&amp; sudo apt-get upgrade<\/pre>\n\n\n\n<p>After this has been completed, we move on to create a new user. I will call the user \u201calgotrader\u201d but you can choose any name. To create a user, we write:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ adduser algotrader<\/pre>\n\n\n\n<p>Then, you will be prompted to fill in some information about your user, you can keep most things blank or as detailed as you wish. I will keep most things blank for this article. We will add the user to the superuser group:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ usermod -aG sudo algotrader<\/pre>\n\n\n\n<p>Now, let us install Docker by running the following set of commands:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ sudo apt install apt-transport-https ca-certificates curl software-properties-common\n$ curl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg | sudo gpg --dearmor -o \/usr\/share\/keyrings\/docker-archive-keyring.gpg\n$ echo \"deb [arch=$(dpkg --print-architecture) signed-by=\/usr\/share\/keyrings\/docker-archive-keyring.gpg] https:\/\/download.docker.com\/linux\/ubuntu $(lsb_release -cs) stable\" | sudo tee \/etc\/apt\/sources.list.d\/docker.list &gt; \/dev\/null\n$ sudo apt update\n$ apt-cache policy docker-ce\n$ sudo apt install docker-ce\n$ docker<\/pre>\n\n\n\n<p>Once this is ready, we will want to install the dependencies that we need into our virtual environment. But first, let\u2019s create a folder for our main workspace:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ mkdir qc-ib\n$ cd qc-ib\/<\/pre>\n\n\n\n<p>I recommend having the latest version of pip on the ready:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ sudo apt install python3-pip<\/pre>\n\n\n\n<p>Now, we will create a Python virtual environment that will contain all of our dependencies:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ sudo apt install python3.10-venv\n$ python3 -m venv venv\n$ source venv\/bin\/activate\n$ pip install lean<\/pre>\n\n\n\n<p>Now, we are ready to configure the LEAN Engine. To do this we run:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ lean init<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1069\" height=\"256\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/algotrading-lean-ibkr-api.jpg\" alt=\"\" class=\"wp-image-206687 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/algotrading-lean-ibkr-api.jpg 1069w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/algotrading-lean-ibkr-api-700x168.jpg 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/algotrading-lean-ibkr-api-300x72.jpg 300w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/algotrading-lean-ibkr-api-768x184.jpg 768w\" data-sizes=\"(max-width: 1069px) 100vw, 1069px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1069px; aspect-ratio: 1069\/256;\" \/><\/figure>\n\n\n\n<p>We need to log into our QuantConnect account through LEAN and pull our projects into the server. To do this, we write:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ lean login<\/pre>\n\n\n\n<p>This will prompt you for your User ID and Token that was emailed to you in one of our previous steps.<\/p>\n\n\n\n<p>Now we can run lean init again and it will get the Docker image on our server and start the setup process. Make sure to select Python as your language of choice when prompted. At the end of this process, you will see two new things in your directory which are the&nbsp;<code>lean.json<\/code>&nbsp;file and the&nbsp;<code>data<\/code>&nbsp;folder.<\/p>\n\n\n\n<p>Once this is done, you can run this command to pull your scripts:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ lean cloud pull<\/pre>\n\n\n\n<p>Nice! We have our server working and the LEAN Engine pumping, now let\u2019s connect IBKR to it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to run a bot on Interactive Brokers with LEAN Engine?<\/h2>\n\n\n\n<p>To run a bot[1] on Interactive Brokers with LEAN Engine, all you need to do is start your bot go through the prompts that will ask you a few questions, and get it going. To do so you write:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ lean live 'QC-SCRIPT-NAME'<\/pre>\n\n\n\n<p><a>[1] If you don\u2019t know how to code a QuantConnect bot, read&nbsp;<\/a><a href=\"https:\/\/if%20you%20don't%20know%20how%20to%20code%20a%20quantconnect%20bot,%20read%20this%20article%20first)\/\" target=\"_blank\" rel=\"noreferrer noopener\">this article<\/a>&nbsp;first.<\/p>\n\n\n\n<p>Although this works, it does require you to have a subscription to IBKR data feeds and similar. For the purpose of this article, I\u2019ll request delayed market data and run the following command that will answer these prompts directly:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ lean live \"QC-SCRIPT-NAME\" --brokerage \"Interactive Brokers\" \\ \n    --data-feed \"Interactive Brokers\" \\\n    --ib-enable-delayed-streaming-data true \\\n    --ib-user-name yourusername \\\n    --ib-account youraccount \\\n    --ib-password yourpassword<\/pre>\n\n\n\n<p>Take note that this will likely require you to have 2FA on IBKR disabled or only be using the mobile phone version of it. You can do this reconfiguration inside your IBKR account.<\/p>\n\n\n\n<p>If your 2FA and credentials for IBKR were correct, you will see the bot running and showing its logs. If you update your script, you will need to run the pull command again to get the updated version. Don\u2019t forget to stop the bot before pulling.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to stop a LEAN Engine bot from running?<\/h2>\n\n\n\n<p>To stop a LEAN Engine bot from running, you will need to press CTRL+C on your keyboard to stop the LEAN Engine. You can also write&nbsp;<code>lean live stop \"QC-SCRIPT-NAME\"<\/code>.<\/p>\n\n\n\n<p>Another thing that you can check is the docker container directly and stop it:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ sudo docker ps\n<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ sudo docker stop &lt;CONTAINER-ID&gt;\n<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We will demonstrate how to connect the LEAN engine to your Interactive Brokers\u2019 account.<\/p>\n","protected":false},"author":815,"featured_media":197427,"comment_status":"open","ping_status":"closed","sticky":true,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[339,343,349,338,341],"tags":[851,15277,575,9742,595,8032],"contributors-categories":[13746],"class_list":{"0":"post-206683","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-data-science","8":"category-programing-languages","9":"category-python-development","10":"category-ibkr-quant-news","11":"category-quant-development","12":"tag-algo-trading","13":"tag-docker","14":"tag-ibkr-api","15":"tag-lean","16":"tag-python","17":"tag-quantconnect","18":"contributors-categories-algotrading101"},"pp_statuses_selecting_workflow":false,"pp_workflow_action":"current","pp_status_selection":"publish","acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>LEAN Engine (on AWS) and Interactive Brokers Guide<\/title>\n<meta name=\"description\" content=\"We will demonstrate how to connect the LEAN engine to your Interactive Brokers\u2019 account.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/206683\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"LEAN Engine (on AWS) and Interactive Brokers Guide\" \/>\n<meta property=\"og:description\" content=\"We will demonstrate how to connect the LEAN engine to your Interactive Brokers\u2019 account.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/lean-engine-on-aws-and-interactive-brokers-guide\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2024-05-15T14:29:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-08-13T20:15:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/digital-landscape.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"563\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Igor Radovanovic\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Igor Radovanovic\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t    \"@context\": \"https:\\\/\\\/schema.org\",\n\t    \"@graph\": [\n\t        {\n\t            \"@type\": \"NewsArticle\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/lean-engine-on-aws-and-interactive-brokers-guide\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/lean-engine-on-aws-and-interactive-brokers-guide\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Igor Radovanovic\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/b43b33f424bad38d84a7b78eb0193592\"\n\t            },\n\t            \"headline\": \"LEAN Engine (on AWS) and Interactive Brokers Guide\",\n\t            \"datePublished\": \"2024-05-15T14:29:12+00:00\",\n\t            \"dateModified\": \"2024-08-13T20:15:13+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/lean-engine-on-aws-and-interactive-brokers-guide\\\/\"\n\t            },\n\t            \"wordCount\": 1250,\n\t            \"commentCount\": 0,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/lean-engine-on-aws-and-interactive-brokers-guide\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/10\\\/digital-landscape.jpg\",\n\t            \"keywords\": [\n\t                \"Algo Trading\",\n\t                \"Docker\",\n\t                \"IBKR API\",\n\t                \"LEAN\",\n\t                \"Python\",\n\t                \"QuantConnect\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Data Science\",\n\t                \"Programming Languages\",\n\t                \"Python Development\",\n\t                \"Quant\",\n\t                \"Quant Development\"\n\t            ],\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"CommentAction\",\n\t                    \"name\": \"Comment\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/lean-engine-on-aws-and-interactive-brokers-guide\\\/#respond\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/lean-engine-on-aws-and-interactive-brokers-guide\\\/\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/lean-engine-on-aws-and-interactive-brokers-guide\\\/\",\n\t            \"name\": \"LEAN Engine (on AWS) and Interactive Brokers Guide | IBKR Campus US\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\"\n\t            },\n\t            \"primaryImageOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/lean-engine-on-aws-and-interactive-brokers-guide\\\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/lean-engine-on-aws-and-interactive-brokers-guide\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/10\\\/digital-landscape.jpg\",\n\t            \"datePublished\": \"2024-05-15T14:29:12+00:00\",\n\t            \"dateModified\": \"2024-08-13T20:15:13+00:00\",\n\t            \"description\": \"We will demonstrate how to connect the LEAN engine to your Interactive Brokers\u2019 account.\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/lean-engine-on-aws-and-interactive-brokers-guide\\\/\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"ImageObject\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/lean-engine-on-aws-and-interactive-brokers-guide\\\/#primaryimage\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/10\\\/digital-landscape.jpg\",\n\t            \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/10\\\/digital-landscape.jpg\",\n\t            \"width\": 1000,\n\t            \"height\": 563,\n\t            \"caption\": \"Quant\"\n\t        },\n\t        {\n\t            \"@type\": \"WebSite\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"name\": \"IBKR Campus US\",\n\t            \"description\": \"Financial Education from Interactive Brokers\",\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"SearchAction\",\n\t                    \"target\": {\n\t                        \"@type\": \"EntryPoint\",\n\t                        \"urlTemplate\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/?s={search_term_string}\"\n\t                    },\n\t                    \"query-input\": {\n\t                        \"@type\": \"PropertyValueSpecification\",\n\t                        \"valueRequired\": true,\n\t                        \"valueName\": \"search_term_string\"\n\t                    }\n\t                }\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"Organization\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\",\n\t            \"name\": \"Interactive Brokers\",\n\t            \"alternateName\": \"IBKR\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"logo\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\",\n\t                \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"width\": 669,\n\t                \"height\": 669,\n\t                \"caption\": \"Interactive Brokers\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\"\n\t            },\n\t            \"publishingPrinciples\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/about-ibkr-campus\\\/\",\n\t            \"ethicsPolicy\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/cyber-security-notice\\\/\"\n\t        },\n\t        {\n\t            \"@type\": \"Person\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/b43b33f424bad38d84a7b78eb0193592\",\n\t            \"name\": \"Igor Radovanovic\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/igor-radovanovic\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"LEAN Engine (on AWS) and Interactive Brokers Guide","description":"We will demonstrate how to connect the LEAN engine to your Interactive Brokers\u2019 account.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/206683\/","og_locale":"en_US","og_type":"article","og_title":"LEAN Engine (on AWS) and Interactive Brokers Guide","og_description":"We will demonstrate how to connect the LEAN engine to your Interactive Brokers\u2019 account.","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/lean-engine-on-aws-and-interactive-brokers-guide\/","og_site_name":"IBKR Campus US","article_published_time":"2024-05-15T14:29:12+00:00","article_modified_time":"2024-08-13T20:15:13+00:00","og_image":[{"width":1000,"height":563,"url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/digital-landscape.jpg","type":"image\/jpeg"}],"author":"Igor Radovanovic","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Igor Radovanovic","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/lean-engine-on-aws-and-interactive-brokers-guide\/#article","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/lean-engine-on-aws-and-interactive-brokers-guide\/"},"author":{"name":"Igor Radovanovic","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/b43b33f424bad38d84a7b78eb0193592"},"headline":"LEAN Engine (on AWS) and Interactive Brokers Guide","datePublished":"2024-05-15T14:29:12+00:00","dateModified":"2024-08-13T20:15:13+00:00","mainEntityOfPage":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/lean-engine-on-aws-and-interactive-brokers-guide\/"},"wordCount":1250,"commentCount":0,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/lean-engine-on-aws-and-interactive-brokers-guide\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/digital-landscape.jpg","keywords":["Algo Trading","Docker","IBKR API","LEAN","Python","QuantConnect"],"articleSection":["Data Science","Programming Languages","Python Development","Quant","Quant Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/lean-engine-on-aws-and-interactive-brokers-guide\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/lean-engine-on-aws-and-interactive-brokers-guide\/","url":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/lean-engine-on-aws-and-interactive-brokers-guide\/","name":"LEAN Engine (on AWS) and Interactive Brokers Guide | IBKR Campus US","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/lean-engine-on-aws-and-interactive-brokers-guide\/#primaryimage"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/lean-engine-on-aws-and-interactive-brokers-guide\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/digital-landscape.jpg","datePublished":"2024-05-15T14:29:12+00:00","dateModified":"2024-08-13T20:15:13+00:00","description":"We will demonstrate how to connect the LEAN engine to your Interactive Brokers\u2019 account.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/lean-engine-on-aws-and-interactive-brokers-guide\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/lean-engine-on-aws-and-interactive-brokers-guide\/#primaryimage","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/digital-landscape.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/digital-landscape.jpg","width":1000,"height":563,"caption":"Quant"},{"@type":"WebSite","@id":"https:\/\/ibkrcampus.com\/campus\/#website","url":"https:\/\/ibkrcampus.com\/campus\/","name":"IBKR Campus US","description":"Financial Education from Interactive Brokers","publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ibkrcampus.com\/campus\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ibkrcampus.com\/campus\/#organization","name":"Interactive Brokers","alternateName":"IBKR","url":"https:\/\/ibkrcampus.com\/campus\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","width":669,"height":669,"caption":"Interactive Brokers"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/"},"publishingPrinciples":"https:\/\/www.interactivebrokers.com\/campus\/about-ibkr-campus\/","ethicsPolicy":"https:\/\/www.interactivebrokers.com\/campus\/cyber-security-notice\/"},{"@type":"Person","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/b43b33f424bad38d84a7b78eb0193592","name":"Igor Radovanovic","url":"https:\/\/www.interactivebrokers.com\/campus\/author\/igor-radovanovic\/"}]}},"jetpack_featured_media_url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/digital-landscape.jpg","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/206683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/users\/815"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=206683"}],"version-history":[{"count":0,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/206683\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media\/197427"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=206683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=206683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=206683"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=206683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}