{"id":18245,"date":"2022-10-24T17:47:49","date_gmt":"2022-10-24T17:47:49","guid":{"rendered":"https:\/\/algotrading101.com\/learn\/?p=18245"},"modified":"2023-11-25T20:48:37","modified_gmt":"2023-11-25T20:48:37","slug":"live-algo-trading-hosting-vultr","status":"publish","type":"post","link":"https:\/\/algotrading101.com\/learn\/live-algo-trading-hosting-vultr\/","title":{"rendered":"Live Algo Trading on the Cloud &#8211; Vultr"},"content":{"rendered":"<div class=\"pvc_clear\"><\/div><p id=\"pvc_stats_18245\" class=\"pvc_stats total_only  \" data-element-id=\"18245\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p><div class=\"pvc_clear\"><\/div><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"364\" height=\"364\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/09\/vultr.webp\" alt=\"\" class=\"wp-image-17618\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/09\/vultr.webp 364w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/09\/vultr-300x300.webp 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/09\/vultr-150x150.webp 150w\" sizes=\"(max-width: 364px) 100vw, 364px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\">Table of contents:<\/h2>\n\n\n\n<ol>\n<li><a href=\"#vultr-algorithmic-trading-cloud\">What does live algorithmic trading on the Cloud mean?<\/a><\/li>\n\n\n\n<li><a href=\"#prerequisite-basic-guide\">Rerequisite &#8211; Basic Guide<\/a><\/li>\n\n\n\n<li><a href=\"#cloud-pros\">What are the pros of deploying your trading strategies to the Cloud?<\/a><\/li>\n\n\n\n<li><a href=\"#cloud-cons\">What are the cons of deploying your trading strategies to the Cloud?<\/a><\/li>\n\n\n\n<li><a href=\"#vultr-cloud-service\">What is the Cloud Service?<\/a><\/li>\n\n\n\n<li><a href=\"#cloud-use\">What is the Cloud used for?&nbsp;<\/a><\/li>\n\n\n\n<li><a href=\"#cloud-providers\">What cloud providers are good?<\/a><\/li>\n\n\n\n<li><a href=\"#vultr\">What is Vultr?<\/a><\/li>\n\n\n\n<li><a href=\"#vultr-pros\">Why should I use Vultr?<\/a><\/li>\n\n\n\n<li><a href=\"#vultr-cons\">Why shouldn\u2019t I use Vultr?<\/a><\/li>\n\n\n\n<li><a href=\"#vultr-offer\">What does Vultr offer?<\/a><\/li>\n\n\n\n<li><a href=\"#vultr-start\">How to get started with Vultr?<\/a><\/li>\n\n\n\n<li><a href=\"#vultr-kraken-bot-trading-algorithm\">Kraken Bot Trading Algorithm<\/a><\/li>\n\n\n\n<li><a href=\"#vultr-server\">How to set up a Vultr server for trading?<\/a><\/li>\n\n\n\n<li><a href=\"#vultr-github\">How to connect GitHub with Vultr?<\/a><\/li>\n\n\n\n<li><a href=\"#vultr-run-trading-algorithm\">How to run a trading algorithm with Vultr?<\/a><\/li>\n\n\n\n<li><a href=\"#vultr-learn-more\">Where can I learn more about Vultr?<\/a><\/li>\n<\/ol>\n\n\n\n<a name=\"vultr-algorithmic-trading-cloud\">\n\n\n\n<h2 class=\"wp-block-heading\">What does live algorithmic trading on the Cloud mean?<\/h2>\n\n\n\n<p>Live algorithmic trading on the Cloud means that your trading bots can use the cloud provider\u2019s resources to run 24\/7 while being efficiently maintainable.<\/p>\n\n\n\n<p>This is article, we will demonstrate how to deploy a live algorithmic trading strategy to the cloud server using Vultr and Github.<\/p>\n\n\n\n<a name=\"prerequisite-basic-guide\">\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisite \u2013 Basic Guide<\/h2>\n\n\n\n<p>If you are new to deploying strategies to the cloud, do check out ou<a href=\"https:\/\/algotrading101.com\/learn\/live-algo-trading-on-the-cloud-aws\/\">r basic guide using AWS<\/a>.<\/p>\n\n\n\n<p>We covered how to:<\/p>\n\n\n\n<ul>\n<li>Choose a location for your server<\/li>\n\n\n\n<li>Input your secret keys<\/li>\n\n\n\n<li>Deploy a trading script using Github<\/li>\n\n\n\n<li>Set Telegram notifications when trades and key events happen<\/li>\n<\/ul>\n\n\n\n<a name=\"cloud-pros\">\n\n\n\n<h2 class=\"wp-block-heading\">What are the pros of deploying your trading strategies to the Cloud?<\/h2>\n\n\n\n<ul>\n<li><strong>Cloud services are easily available<\/strong>\u2013 they allow the user to access them at any time, from anywhere, and from almost any device.<\/li>\n\n\n\n<li><strong>Can lower fees<\/strong>\u2013 cloud computing can lower the costs and provide you with a good connection and hardware that saves you money in the long run.<\/li>\n\n\n\n<li><strong>Easy to maintain<\/strong>&nbsp;\u2013 you can upload your trading strategies to the cloud and get them running 24\/7 with minimal effort.<\/li>\n\n\n\n<li><strong>Is scalable<\/strong>&nbsp;\u2013 you can store almost limitless amounts of data in the cloud.<\/li>\n\n\n\n<li><strong>Straightforward to set up<\/strong>&nbsp;\u2013 setting up your cloud server is quite easy.<\/li>\n<\/ul>\n\n\n\n<a name=\"cloud-cons\">\n\n\n\n<h2 class=\"wp-block-heading\">What are the cons of deploying your trading strategies to the Cloud?<\/h2>\n\n\n\n<ul>\n<li><strong>Security risks<\/strong>&nbsp;\u2013 your data is being stored by a third-party provider and if a security breach happens your data is at high risk.<\/li>\n\n\n\n<li><strong>Depends on the internet connection<\/strong>&nbsp;\u2013 even though this is the same case when executing trading strategies by yourself, the cloud service provider can also suffer from downtime and other natural risks.<\/li>\n\n\n\n<li><strong>Data confidentiality risk&nbsp;<\/strong>\u2013 your privacy is of utmost importance and when using a third-party cloud provider you can\u2019t be too sure that you\u2019re the only one accessing your data or being able to see it.<\/li>\n\n\n\n<li><strong>Can get pricey<\/strong> &#8211; sometimes cloud service architecture can get complicated and users can set up suboptimal features which can accrue large bills.<\/li>\n<\/ul>\n\n\n\n<a name=\"vultr-cloud-service\">\n\n\n\n<h2 class=\"wp-block-heading\">What is the Cloud Service?<\/h2>\n\n\n\n<p>A Cloud Service offers cloud computing as a service with the intent to deliver affordable, easy, and efficient access to diverse resources without the need to have your own hardware or infrastructure.<\/p>\n\n\n\n<a name=\"cloud-use\">\n\n\n\n<h2 class=\"wp-block-heading\">What is Cloud used for?<\/h2>\n\n\n\n<p>Cloud services have many purposes for which they could be used and here are some of the most common ones:<\/p>\n\n\n\n<ul>\n<li><strong>Algorithmic trading&nbsp;<\/strong>\u2013 cloud services allow algorithmic traders to run multiple bots that trade the market.<\/li>\n\n\n\n<li><strong>Big data storage&nbsp;<\/strong>\u2013 clouds offer an almost limitless storage capacity which is excellent when dealing with big data.<\/li>\n\n\n\n<li><strong>Backup and recovery<\/strong>&nbsp;\u2013 clouds can be continually backed up and you can easily recover data from them. They also offer good disaster recovery.<\/li>\n\n\n\n<li><strong>Test and Development<\/strong>&nbsp;\u2013 cloud services are great when testing and developing your applications and trading strategies.<\/li>\n\n\n\n<li><strong>Model training&nbsp;<\/strong>\u2013 when doing machine learning work, model training can take up to several months, and running it on a cloud can save you computing power and in some cases even money.<\/li>\n<\/ul>\n\n\n\n<a name=\"cloud-providers\">\n\n\n\n<h2 class=\"wp-block-heading\">What cloud providers are good?<\/h2>\n\n\n\n<p>There are many cloud services and picking a quality one is important. In order to make your decisions process easier I will mention a few that are on top of their cloud game:<\/p>\n\n\n\n<ul>\n<li><a href=\"https:\/\/algotrading101.com\/learn\/live-algo-trading-on-the-cloud-aws\/\">Amazon Web Services (AWS)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/algotrading101.com\/learn\/algo-trading-deployment-microsoft-azure\/\">Microsoft Azure<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/algotrading101.com\/learn\/algo-trading-deployment-google-cloud-platform\/\">Google Cloud Platform<\/a><\/li>\n\n\n\n<li>Vultr<\/li>\n\n\n\n<li>Server Space<\/li>\n\n\n\n<li>IBM Cloud Services<\/li>\n\n\n\n<li>Oracle<\/li>\n<\/ul>\n\n\n\n<a name=\"vultr\">\n\n\n\n<h2 class=\"wp-block-heading\">What is Vultr?<\/h2>\n\n\n\n<p>Vultr is a cloud service that offers interesting features to deploy cloud servers, bare metal, and storage worldwide. It is different from other cloud providers as it focuses on quality instead of quantity by using highly performant CPUs and NVMe SSDs.<\/p>\n\n\n\n<a name=\"vultr-pros\">\n\n\n\n<h2 class=\"wp-block-heading\">Why should I use Vultr?<\/h2>\n\n\n\n<ul>\n<li>Vultr is easy to use and beginner friendly<\/li>\n\n\n\n<li>Vultr features the &#8220;pay as you go&#8221; pricing structure<\/li>\n\n\n\n<li>Focuses on performance<\/li>\n\n\n\n<li>Offers optimized cloud computing resources with no noisy neighbors.<\/li>\n\n\n\n<li>Has a great SDK<\/li>\n\n\n\n<li>Features out-of-box solutions<\/li>\n\n\n\n<li>Offers low latency which makes it great for traders<\/li>\n<\/ul>\n\n\n\n<a name=\"vultr-cons\">\n\n\n\n<h2 class=\"wp-block-heading\">Why shouldn&#8217;t I use Vultr?<\/h2>\n\n\n\n<ul>\n<li>Vultr could use more regions (currently has 27)<\/li>\n\n\n\n<li>Vultr is expensive when compared to alternatives<\/li>\n\n\n\n<li>It can be hard to move to another provider<\/li>\n\n\n\n<li>Doesn&#8217;t feature a plethora of services like other providers (it focuses on quality and speed)<\/li>\n\n\n\n<li>Might be overkill for some non-high-frequency applications<\/li>\n<\/ul>\n\n\n\n<a name=\"vultr-offer\">\n\n\n\n<h2 class=\"wp-block-heading\">What does Vultr offer?<\/h2>\n\n\n\n<p>Vultr offers several different services that make it competitive which are the following:<\/p>\n\n\n\n<ul>\n<li><strong>(Optimized) Cloud Compute<\/strong> &#8211; VMs for common workloads. The optimized ones are more expensive and feature performant CPUs and SSDs.<\/li>\n\n\n\n<li><strong>Bare Metal<\/strong> &#8211; automated dedicated servers with zero virtualization<\/li>\n\n\n\n<li><strong>Kubernetes<\/strong> &#8211; a service to run your containers<\/li>\n\n\n\n<li><strong>Load Balancers<\/strong> &#8211; enable horizontal scaling<\/li>\n\n\n\n<li><strong>Cloud GPUs<\/strong> &#8211; Nvidia GPUs<\/li>\n\n\n\n<li><strong>Managed Database<\/strong> &#8211; the out-of-box database solution<\/li>\n\n\n\n<li><strong>Object and Block storage<\/strong><\/li>\n<\/ul>\n\n\n\n<a name=\"vultr-start\">\n\n\n\n<h2 class=\"wp-block-heading\">How to get started with Vultr?<\/h2>\n\n\n\n<p>To get started with <a href=\"https:\/\/www.vultr.com\/\">Vultr<\/a>, you will need to go to their website and create an account by clicking the blue &#8220;Sign up&#8221; button in the upper right corner of your screen.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"445\" height=\"477\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/09\/vultr_account.webp\" alt=\"\" class=\"wp-image-17615\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/09\/vultr_account.webp 445w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/09\/vultr_account-280x300.webp 280w\" sizes=\"(max-width: 445px) 100vw, 445px\" \/><\/figure>\n\n\n\n<p>Then, provide your email and create a password. When done, click the blue &#8220;Create Account&#8221; button. After that, you will be asked to link a payment method from the list of payment methods they offer. You can do an instant deposit to your account or just link it without any deposit.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"656\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/09\/vultr_payment-1024x656.webp\" alt=\"\" class=\"wp-image-17616\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/09\/vultr_payment-1024x656.webp 1024w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/09\/vultr_payment-300x192.webp 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/09\/vultr_payment-768x492.webp 768w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/09\/vultr_payment.webp 1223w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>For the purpose of this guide, we&#8217;ll need less than $10 so if you want to min-max it don&#8217;t do a deposit.<\/p>\n\n\n\n<p>When done, navigate to the Products tab that is on the left side of your screen. Here, we will configure the server that we want. We want a simple &#8220;Cloud Compute&#8221; and for the CPU &amp; Storage Technology, we can go with the regular package.<\/p>\n\n\n\n<p>For the server location, it is best to pick one that is close to your exchange servers. If you want to learn how to find this out, visit our <a href=\"https:\/\/algotrading101.com\/learn\/live-algo-trading-on-the-cloud-aws\/\">AWS article<\/a>. After that, we will select Ubuntu (22.04 LTS) as our server image. For the server size, we can go with the smallest one.<\/p>\n\n\n\n<p>The rest can be left as is.<\/p>\n\n\n\n<a name=\"vultr-kraken-bot-trading-algorithm\">\n\n\n\n<h2 class=\"wp-block-heading\">Kraken Bot Trading Algorithm<\/h2>\n\n\n\n<p>In this article, we will want to deploy a Kraken Bot Trading Algorithm to a Vultr instance. This will be a simple strategy and the deployment process will be very similar to the one we showcased in the <a href=\"https:\/\/algotrading101.com\/learn\/live-algo-trading-on-the-cloud-aws\/\">AWS article<\/a>.<\/p>\n\n\n\n<p>Let us explain how this strategy works and where you can learn how to code one.<\/p>\n\n\n\n<p>The main idea behind the strategy will be to buy ETH when BTC moves 5% in the last 5 minutes. For this to work, we will pull BTC prices in 5-minute intervals and calculate the percentage difference.<\/p>\n\n\n\n<p>If this difference is more or equal to 5% we will buy ETH, if the requirement isn\u2019t reached we will continue to loop. The strategy also features error management, logging, and environmental variables.<\/p>\n\n\n\n<p>Error management is used to catch errors that might occur, logging is used so we can obtain data about our bot and what it\u2019s been up to while running on the server and environmental variables allow us to interact with the bot.<\/p>\n\n\n\n<p>The code below is what our trading strategy looks like and here you can find an article about<a>&nbsp;<\/a><a href=\"https:\/\/algotrading101.com\/learn\/kraken-api-guide\/\">Kraken<\/a>&nbsp;and how to code a similar strategy by yourself.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code># Import the libraries and load the API Keys\nimport time, logging, os\nimport pandas as pd\nimport krakenex\nfrom pykrakenapi import KrakenAPI\n\n# Create environment variables\ntrack_ticker = os.environ.get(&#39;ticker_to_track&#39;)\ntrade_ticker = os.environ.get(&#39;ticker_to_trade&#39;)\napi_key = os.environ.get(&#39;api_key&#39;)\nsecret_key = os.environ.get(&#39;secret_key&#39;)\nlogname = os.environ.get(&#39;my_log_name&#39;) # Name of the saved log file\n\napi = krakenex.API(key=api_key, secret=secret_key)\nkraken = KrakenAPI(api)\n\n# Set up the logging\nfor handler in logging.root.handlers[:]:\n    logging.root.removeHandler(handler)\n\n\nlogging.basicConfig(level=logging.INFO, format=&#39;%(asctime)s: %(levelname)s: %(message)s&#39;, \n                    filename=logname, filemode=&#39;a&#39;)\nconsole = logging.StreamHandler()\nconsole.setLevel(logging.INFO)\nformatter = logging.Formatter(&#39;%(asctime)s: %(levelname)s: %(message)s&#39;)\nconsole.setFormatter(formatter)\nlogging.getLogger(&#39;&#39;).addHandler(console)\n\n# Create the main script logic\nwhile True:\n    logging.info(&#39;--------- Start of current 5 minute period ---------&#39;)\n    logging.info(pd.Timestamp.now())\n    \n    try:\n        BTC_old = float((kraken.get_ticker_information(track_ticker))[&#39;b&#39;][0][0])\n    except Exception as e:\n        logging.warning(&#39;Error obtaining data&#39;)\n\n    time.sleep(300)\n    \n    try:\n        BTC_new = float((kraken.get_ticker_information(track_ticker))[&#39;b&#39;][0][0])\n    except Exception as e:\n        logging.warning(&#39;Error obtaining data&#39;)\n    \n    percent = ((BTC_new - BTC_old)*100) \/ BTC_old\n    \n    logging.info(f&#39;BTC moved {percent:.2f}% over the last 5 minutes&#39;)\n    \n    if percent &gt;= 5:\n        \n        try:\n            ETH = float((kraken.get_ticker_information(trade_ticker))[&#39;a&#39;][0][0]) + 2\n        except Exception as e:\n            logging.warning(&#39;Error obtaining data&#39;)\n        \n        try:\n            response = kraken.add_standard_order(pair=trade_ticker, type=&#39;buy&#39;, ordertype=&#39;limit&#39;, \n                                                 volume=&#39;0.007&#39;, price=ETH, validate=False)\n        except Exception as e:\n            logging.warning(&#39;Error placing order&#39;)\n            \n        logging.info(f&#39;Order details:\\n{response}&#39;)\n        \n        time.sleep(2)\n        \n        try:\n            check_order = kraken.query_orders_info(response[&#39;txid&#39;][0])\n        except Exception as e:\n            logging.warning(&#39;Error checking order&#39;)\n    \n        if check_order[&#39;status&#39;][0] == &#39;open&#39; or &#39;closed&#39;:\n            logging.info(&#39;Order completed sucessfully&#39;)\n            break\n        else:\n            logging.info(&#39;Order rejected&#39;)\n            break\n    else:\n        logging.info(&#39;--------- End of current 5 minute period ---------&#39;)<\/code><\/pre><\/div>\n\n\n\n<p>The above strategy is just an example and the code of &#8220;real&#8221; trading strategies is way more complicated, cleaner, and in more files.<\/p>\n\n\n\n<a name=\"vultr-server\">\n\n\n\n<h2 class=\"wp-block-heading\">How to set up a Vultr server for trading?<\/h2>\n\n\n\n<p>To set up our Vultr server for trading, we will need to make sure that we have Python and Git installed. We first check if they are installed by running <code>python3 --version<\/code> and <code>git --version<\/code>. <\/p>\n\n\n\n<p>If they are not installed you will need to run <code>sudo pip install &lt;name&gt;<\/code>. You will be asked by the terminal emulator to agree to the installation terms. This can be done by pressing &#8220;Y&#8221; on your keyboard and clicking enter.<\/p>\n\n\n\n<p>The purpose of git is to pull our trading algorithm code from a private GitHub repository. To do this, we will need to make a connection between our server and the GitHub repository.<\/p>\n\n\n\n<a name=\"vultr-github\">\n\n\n\n<h2 class=\"wp-block-heading\">How to connect GitHub with Vultr?<\/h2>\n\n\n\n<p>To connect your Vultr server to GitHub, you will need to utilize the SSH (Secure Shell) method and Git.<\/p>\n\n\n\n<p>This process can be viewed as being consisted of 3 principal steps:<\/p>\n\n\n\n<ol>\n<li>Create your special \u201ckeys\u201d (like the API and secret key)<\/li>\n\n\n\n<li>Upload the public key to GitHub<\/li>\n\n\n\n<li>Use the keys when interacting with GitHub<\/li>\n<\/ol>\n\n\n\n<p>Let\u2019s create the keys. Write the following command in your terminal to create them:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>ssh-keygen<\/code><\/pre><\/div>\n\n\n\n<p>Then give it a name and the passphrase can be left blank. I\u2019ll name it \u201cvultr-algotrading\u201d.<\/p>\n\n\n\n<p>Now that your key is created, you can find it by writing the following commands. The first one is&nbsp;<code>ls<\/code>&nbsp;that will list all the folders that are in your AWS instance.<\/p>\n\n\n\n<p>The \u201cvultr-algotrading\u201d key can be viewed as our secret while the \u201calgotrading.pub\u201d key is the public aka API key. For us to import the key to our GitHub we need to read it first. To read it we write <code>cat.vultr-algotrading.pub<\/code>.<\/p>\n\n\n\n<p>Copy the contents of the public key as we will need to add that to our GitHub. To do so, go over to your GitHub account -&gt; Setting -&gt; SSH and GPG keys.<\/p>\n\n\n\n<p>When there, click on the green \u201cNew SSH key button\u201d. Then give it a name and input the key. Then add the key and input your password when prompted. If you\u2019ve done everything correctly the SSH should be ready.<\/p>\n\n\n\n<p>Now we will instantiate the private key by writing <code>eval \"$(ssh-agent)\"<\/code> and then <code>ssh-add vultr-algotrading<\/code>.<\/p>\n\n\n\n<p>The two code snippets above often need to be typed in your Terminal every time you run the Vultr instance. Now, let us pull our trading strategy from a private repository.<\/p>\n\n\n\n<p>Go over to your repository on GitHub, click on the green \u201cCode\u201d dropdown button, select SSH and copy the URL and write the following in your terminal:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>git clone &lt;SSH-URL-HERE&gt;<\/code><\/pre><\/div>\n\n\n\n<p>We have successfully connected our GitHub account to Vultr and obtained the trading algorithm code. The next step is to install our libraries, setup environment variables, and run the algorithm.<\/p>\n\n\n\n<a name=\"vultr-run-trading-algorithm\">\n\n\n\n<h2 class=\"wp-block-heading\">How to run a trading algorithm with Vultr?<\/h2>\n\n\n\n<p>To run a trading algorithm with Vultr, we will need to make sure that all the libraries are installed, that the environment is set, and that the code is ready.<\/p>\n\n\n\n<p>If you have many dependencies (Libraries) you can utilize the pipreqs library that will export all the libraries your script is using into a .txt file. To install the libraries from such a file you would write <code>sudo pip3 install -r &lt;name&gt;.txt<\/code>.<\/p>\n\n\n\n<p>As we use only 3 dependencies we can create a txt file (<code>touch requirements.txt<\/code>) and add the following lines to it:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>pandas==1.4.4\nkrakenex==2.1.0\npykrakenapi==0.3.1<\/code><\/pre><\/div>\n\n\n\n<p>An alternative is to install them 1 by 1. Whichever suits you best.<\/p>\n\n\n\n<p>The next step is to set up the environment variables. To do so, we use the export command and write the values for each of the env variables.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>export ticker_to_track=&#39;BTCUSD&#39;\nexport ticker_to_trade=&#39;ETHUSD&#39;\nexport my_log_name=&#39;log_kraken&#39;\nexport api_key=&#39;&#39;\nexport secret_key=&#39;&#39;<\/code><\/pre><\/div>\n\n\n\n<p>Finally, to run the script we write <code>python3 main.py<\/code>. And our script is working. You can confirm this by the logs that are appearing. To keep your script running, we will use the screen command. <\/p>\n\n\n\n<p>First, let&#8217;s stop the script by pressing CTRL+C and create a screen by writing <code>screen -S &lt;screen-name&gt;<\/code>. When inside the screen run the strategy the same way we did before. To detach from a screen press CTRL+A+D.<\/p>\n\n\n\n<p>To attach back to a screen run <code>screen -a &lt;screen-name&gt;<\/code>. You can create multiple screens and run multiple bots with them. To delete a screen attach to it, stop the script and write <code>exit<\/code>. If you wish to destroy all screens and their processes run <code>pkill screen<\/code>.<\/p>\n\n\n\n<p>You can also create a Telegram bot that will notify you about your trading algorithms. You can even create ones that allow you to start\/stop, change configuration and query your trading strategies. To learn how to make a notification one, visit our <a href=\"https:\/\/algotrading101.com\/learn\/live-algo-trading-on-the-cloud-aws\/\">AWS article<\/a>.<\/p>\n\n\n\n<a name=\"vultr-learn-more\">\n\n\n\n<h2 class=\"wp-block-heading\">Where can I learn more about Vultr?<\/h2>\n\n\n\n<p>To learn more about Vultr, I recommend reading through their <a href=\"https:\/\/my.vultr.com\/docs\/\">documentation<\/a> which is well written.<\/p>\n\n\n\n<p> <br><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_18245\" class=\"pvc_stats total_only  \" data-element-id=\"18245\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n<p>Table of contents: What does live algorithmic trading on the Cloud mean? Live algorithmic trading on the Cloud means that your trading bots can use the cloud provider\u2019s resources to run 24\/7 while being efficiently maintainable. This is article, we will demonstrate how to deploy a live algorithmic trading strategy to the cloud server using [&hellip;]<\/p>\n","protected":false},"author":14,"featured_media":17618,"comment_status":"closed","ping_status":"closed","sticky":true,"template":"","format":"standard","meta":{"_lmt_disableupdate":"no","_lmt_disable":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[3,2],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Live Algo Trading on the Cloud - Vultr - AlgoTrading101 Blog<\/title>\n<meta name=\"description\" content=\"Deploy a live algorithmic trading strategy to the cloud server using Vultr and Github.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/algotrading101.com\/learn\/live-algo-trading-hosting-vultr\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Live Algo Trading on the Cloud - Vultr - AlgoTrading101 Blog\" \/>\n<meta property=\"og:description\" content=\"Deploy a live algorithmic trading strategy to the cloud server using Vultr and Github.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/algotrading101.com\/learn\/live-algo-trading-hosting-vultr\/\" \/>\n<meta property=\"og:site_name\" content=\"Quantitative Trading Ideas and Guides - AlgoTrading101 Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-24T17:47:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-25T20:48:37+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/09\/vultr.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"364\" \/>\n\t<meta property=\"og:image:height\" content=\"364\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\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=\"11 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Live Algo Trading on the Cloud - Vultr - AlgoTrading101 Blog","description":"Deploy a live algorithmic trading strategy to the cloud server using Vultr and Github.","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:\/\/algotrading101.com\/learn\/live-algo-trading-hosting-vultr\/","og_locale":"en_US","og_type":"article","og_title":"Live Algo Trading on the Cloud - Vultr - AlgoTrading101 Blog","og_description":"Deploy a live algorithmic trading strategy to the cloud server using Vultr and Github.","og_url":"https:\/\/algotrading101.com\/learn\/live-algo-trading-hosting-vultr\/","og_site_name":"Quantitative Trading Ideas and Guides - AlgoTrading101 Blog","article_published_time":"2022-10-24T17:47:49+00:00","article_modified_time":"2023-11-25T20:48:37+00:00","og_image":[{"width":364,"height":364,"url":"http:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/09\/vultr.webp","type":"image\/webp"}],"author":"Igor Radovanovic","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Igor Radovanovic","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/algotrading101.com\/learn\/live-algo-trading-hosting-vultr\/#article","isPartOf":{"@id":"https:\/\/algotrading101.com\/learn\/live-algo-trading-hosting-vultr\/"},"author":{"name":"Igor Radovanovic","@id":"https:\/\/algotrading101.com\/learn\/#\/schema\/person\/a7ae60c112a73b7c3fe14ac56726a0ae"},"headline":"Live Algo Trading on the Cloud &#8211; Vultr","datePublished":"2022-10-24T17:47:49+00:00","dateModified":"2023-11-25T20:48:37+00:00","mainEntityOfPage":{"@id":"https:\/\/algotrading101.com\/learn\/live-algo-trading-hosting-vultr\/"},"wordCount":2106,"publisher":{"@id":"https:\/\/algotrading101.com\/learn\/#organization"},"articleSection":["Programming","Trading"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/algotrading101.com\/learn\/live-algo-trading-hosting-vultr\/","url":"https:\/\/algotrading101.com\/learn\/live-algo-trading-hosting-vultr\/","name":"Live Algo Trading on the Cloud - Vultr - AlgoTrading101 Blog","isPartOf":{"@id":"https:\/\/algotrading101.com\/learn\/#website"},"datePublished":"2022-10-24T17:47:49+00:00","dateModified":"2023-11-25T20:48:37+00:00","description":"Deploy a live algorithmic trading strategy to the cloud server using Vultr and Github.","breadcrumb":{"@id":"https:\/\/algotrading101.com\/learn\/live-algo-trading-hosting-vultr\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/algotrading101.com\/learn\/live-algo-trading-hosting-vultr\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/algotrading101.com\/learn\/live-algo-trading-hosting-vultr\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/algotrading101.com\/learn\/"},{"@type":"ListItem","position":2,"name":"Live Algo Trading on the Cloud &#8211; Vultr"}]},{"@type":"WebSite","@id":"https:\/\/algotrading101.com\/learn\/#website","url":"https:\/\/algotrading101.com\/learn\/","name":"Quantitative Trading Ideas and Guides - AlgoTrading101 Blog","description":"Authentic Stories about Algorithmic trading, coding and life.","publisher":{"@id":"https:\/\/algotrading101.com\/learn\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/algotrading101.com\/learn\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/algotrading101.com\/learn\/#organization","name":"AlgoTrading101","url":"https:\/\/algotrading101.com\/learn\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/algotrading101.com\/learn\/#\/schema\/logo\/image\/","url":"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2020\/11\/AlgoTrading101-Lucas-Liew.jpg","contentUrl":"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2020\/11\/AlgoTrading101-Lucas-Liew.jpg","width":1200,"height":627,"caption":"AlgoTrading101"},"image":{"@id":"https:\/\/algotrading101.com\/learn\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/algotrading101.com\/learn\/#\/schema\/person\/a7ae60c112a73b7c3fe14ac56726a0ae","name":"Igor Radovanovic","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/algotrading101.com\/learn\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d46175c509b3ee240a1e2bbe735a4d1e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d46175c509b3ee240a1e2bbe735a4d1e?s=96&d=mm&r=g","caption":"Igor Radovanovic"},"sameAs":["https:\/\/igorradovanovic.com","https:\/\/www.linkedin.com\/in\/igor-radovanovic-profile"],"url":"https:\/\/algotrading101.com\/learn\/author\/igor\/"}]}},"modified_by":"Lucas Liew","_links":{"self":[{"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/posts\/18245"}],"collection":[{"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/comments?post=18245"}],"version-history":[{"count":6,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/posts\/18245\/revisions"}],"predecessor-version":[{"id":22312,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/posts\/18245\/revisions\/22312"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/media\/17618"}],"wp:attachment":[{"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/media?parent=18245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/categories?post=18245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/tags?post=18245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}