Automated Trading Setup Steps
If you are looking for how to update your TARVIS trading bot configuration to include alts/btc or add more exchanges to your configuration you can find a guide here.
If you are looking for how to upgrade your TARVIS trading bot to a new version I’ve moved the documentation. You can find it here.
Automated Trading Pilot - Automated Trading Setup Steps
Below are the setup steps in order to setup Automated Trading (AT) for TARVIS. There are pre-requisites before getting started. You’ll need to perform the following actions.
Please read through our Automated Trading Pilot FAQ.
Decide if you want assistance with setup/installation ($500)
Sign the agreement for Automated Trading. If you need the contract feel free to fill out a support ticket to let us know.
Install the app Signal (https://signal.org/en/) in order for us to securely share setup credentials with you. Set disappearing messages in the privacy settings for 1h.
If we’re helping you with the installation, please be sure to setup a meeting with us (which should be figured out in the DocuSign email) so we can meet via Zoom to perform the installation. Please also let us know what your account setup will look like, and whether you’re looking to use dYdX or WOO X or a combination of both.
Step 1 - Receive Credentials Via Signal
The first step of the setup will be to receive two sets of credentials:
Your API key to communicate with our TARVIS servers
Your logging key/credentials
We’ll send each to you over the Signal app that you should have downloaded as a pre-req.
Step 2 - Create GCP Account/CSP Account
For our installations we’ll be getting everyone setup with Google Cloud. They provide a great incentive to join with $300 in free credits/90 days free for TARVIS users. The server setup costs about $6/mo so it should be completely covered for the first 90 days.
All the following setup steps will be through Google Cloud.
Step 3 - Create a Server (Compute Engine on GCP)
Once you’ve created your GCP account and can login, you’ll search for “Compute Engine” in the top bar and select the Compute Engine option.
Next, you’ll create a new VM instance by clicking on the “Create Instance” button.
Next we’ll want to create the VM Instance (the server). We’ll use the following configuration for the server.
NOTE - we used Ubuntu 22.04 LTS Minimal (x86/64 newest build date) here but here are all of the available options that should work:
Debian 12 (Bookworm): Python 3.11
Ubuntu 22.04 LTS (Jammy): Python 3.10
Linux Mint 21 (Vanessa): Python 3.10
Configuration
Name: tarvis-tradingbot
Region: Outside USA, like europe-west6 (Zurich, Switzerland)
Series: N1
Machine type: f1-micro (1 vCPU, 614 MB memory)
Confidential VM service: No
Boot disk:
Operating system: Ubuntu
Version: Ubuntu 22.04 LTS Minimal (x86/64 newest build date)
Boot disk type: Standard persistent disk
Size: 10 GB
The price should come down to $5.94 with the configuration.
Here is also the configuration for the boot disk you’ll want to use.
Once you’ve setup the boot disk configuration and the correct server configuration you can go ahead and create the server by clicking “create” at the bottom of the page.
Step 4 - Setup Firewall Rule for SSH Access to the VM Instance
In order to access the server you’ve now created, we’ll need to allow the ability to SSH into the server.
We’ll want to now search for “Firewall” in the search bar at the top, and choose “Firewall” from the dropdown.
You’ll then want to choose to create a “Firewall Rule” on the page.
You’ll setup a firewall rule with the following configuration:
Name: allow-ssh
Network: default (assuming the VM instance is in this network)
Priority: 1000 (probably fine in most cases)
Direction: Ingress
Action: Allow
Targets: All instances in the network
Source filter: IPv4 ranges
Source IPv4 ranges: 0.0.0.0/0
Specified protocols and ports: TCP port 22
Once you’ve put in the configuration hit “create” at the bottom of the page.
Step 5 - Install TARVIS Trading Bot on Server
Now that you’ve setup SSH access to your server we’ll setup the Trading Bot on your server. This part becomes more technical and requires technical knowledge to setup.
You’ll want to SSH into your server and perform the following actions. You can SSH into your server by searching for Compute Engine again. You’ll see next to your server’s name (tarvis-tradingbot) a button called “SSH”. You’ll click this button and it will log you into your server. From there you’ll run each of these commands one by one (not including the number)
sudo apt-get install curl
curl https://us-west1-apt.pkg.dev/doc/repo-signing-key.gpg | sudo apt-key add -
echo "deb https://us-west1-apt.pkg.dev/projects/tarvis-test apt main" | \
sudo tee -a /etc/apt/sources.list.d/artifact-registry.list
sudo apt-get update
Next we’ll install the trading bot by running the following line of code.
sudo apt-get install tarvis-tradingbot
The last step is to install vim for the next steps.
sudo apt-get install vim
Step 6 - Setup Credentials on Server
At this point the trading bot should be installed and we simply need to configure it with the credentials needed.
Setup Logging Credentials
You can setup the logging credentials by taking the credentials passed to you through Signal and performing the following actions.
Download sublime text editor
Paste the credentials into a new sublime text file called “gcp-client-logging.json”
Save the file on your desktop
SSH into your server through GCP
Choose “Upload File” in the top right corner
Upload the gcp-client-logging.json file from your desktop
use the command
sudo cp gcp-client-logging.json /etc/tarvis-tradingbot/gcp-client-logging.json
I’ve provided images below.
Download Sublime Text Editor, paste the credentials into a new sublime text file called “gcp-client-logging.json” and save the file on your desktop.
SSH into your server through GCP
Choose “Upload File” in the top right corner
Upload the gcp-client-logging.json file from your desktop
use the command sudo cp gcp-client-logging.json /etc/tarvis-tradingbot/gcp-client-logging.json
Step 7 - Download Configurator and perform setup
We’ve created a configurator which you’ll be able to run on your computer in order to setup your TARVIS tradingbot. The configurator runs on your computer and the information doesn’t leave your computer, therefore your credentials & secrets should be kept completely safe.
You’ll start by downloading the configurator here. You can download it and move the zipped folder to your desktop and open it there.
Below are instructions on running the configurator on both a PC and a Mac.
Running the Configurator on a Mac
You’ll follow the following steps in order to run the Configurator and get your configuration files for testing and go live.
Make sure you have Python downloaded. If you need to check, use Spotlight on your computer (you can access by holding down command and then pressing spacebar). Search for Terminal. Enter “python3” in the Terminal and hit enter. If you don’t have Python installed you’ll see a popup asking you install developer tools. You’ll want to hit enter and follow the instructions to install.
Download the configurator
Move the configurator to your desktop and double click the folder to unzip the folder
Open the unzipped folder and make sure the folder name is “config_formatter” as its the expected folder path
Inside the unzipped folder double click to run run_config_formatter.command
Approve the running of the command file, you may need to right click the command file and choose to run in Terminal.
You may need to open the url (http://127.0.0.1:5000/) in Safari if Chrome doesn’t allow you to access the Configurator’s page which can happen.
Running the Configurator on a PC
The PC setup requires more work to get up and running as we will run a PowerShell due to likely inconsistencies between Windows machines.
Make sure you have Python downloaded. In your computer’s menu search bar, search for Python and make sure to download it from the Microsoft store, or you can go to the Microsoft store and search and download Python.
Download the configurator
Move the configurator to your desktop and double click the folder to unzip the folder
Open the unzipped folder and make sure the folder name is “config_formatter” as its the expected folder path
Open the application Windows Powershell ISE
In the top left corner, choose File -> Open -> run_config_formatter.ps1 which will open the PowerShell script
Naturally, Windows doesn’t allow for scripts to run therefore we need to allow them to run by using the first command in the script. You’ll copy the command
Set-ExecutionPolicy Unrestricted -Scope Process
and paste in the blue terminal space below and hit enter. You’ll be prompted whether you’d like to run the script and you should click “Yes”.Now you can run the script by going to File -> Run in the top left corner. After you click Run you’ll see another warning asking if you’re sure you want to run the script, choose “Run Once”. You may need to go back to the browser and refresh the page at http://127.0.0.1:5000/
Performing your setup
The configurator should automatically open in your browser
You’ll put in your secrets, in the example I’ve put fake values for each exchange. You’ll want to input your actual secrets.
There are many error checks and notifications to help inform you if you filled in your credentials properly. If you did, you’ll see the following info notification
You should now have 2 new files in your configformatter folder. config_live.json and config.json. config.json will be what you’ll use to run testing and config_live.json will be what you’ll run after we’re done testing to go live.
We’ll upload both of these files to your server, just like we did for your logging config file.
We’ll then start testing by putting your test config file (config.json) in the right location on your server so tarvis-tradingbot can use it. We’ll do this by running the command sudo cp config.json /etc/tarvis-tradingbot/config.json
Running the Configurator on a Mac
Download the configurator, move the configurator to your desktop and double click the folder to unzip the folder. Open the unzipped folder. Inside the unzipped folder double click to run run_config_formatter.command
Approve the running of the file
Unlock the Security & Privacy page by putting in your password in the bottom left corner. Choose “Open Anyway” for the run_config_formatter.command file.
Choose “Open” on the file when you try and run it.
Running the Configurator on a PC
Download the configurator, move the configurator to your desktop and double click the folder to unzip the folder, open the unzipped folder and make sure the folder name is “config_formatter” as its the expected folder path.
Open the application Windows Powershell ISE. In the top left corner, choose File -> Open -> run_config_formatter (the powershell script) which will open the PowerShell script. Naturally, Windows doesn’t allow for scripts to run therefore we need to allow them to run by using the first command in the script. You’ll copy the command Set-ExecutionPolicy Unrestricted -Scope Process
and paste in the blue terminal space below and hit enter. You’ll be prompted whether you’d like to run the script and you should click “Yes”.
Now you can run the script by going to File -> Run in the top left corner. After you click Run you’ll see another warning asking if you’re sure you want to run the script, choose “Run Once”. You may need to go back to the browser and refresh the page at http://127.0.0.1:5000/
Performing your setup
The configurator should automatically open in your browser. You’ll put in your secrets, in the example I’ve put fake values for each exchange. You’ll want to input your actual secrets. There are many error checks and notifications to help inform you if you filled in your credentials properly.
If you did, you’ll see the following info notification saying the Configuration is complete.
You should now have 2 new files in your config_formatter folder. config_live.json and config.json. config.json will be what you’ll use to run testing and config_live.json will be what you’ll run after we’re done testing to go live.
We’ll upload both of these files to your server, just like we did for your logging config file. We’ll then start testing by putting your test config file (config.json) in the right location on your server so tarvis-tradingbot can use it.
We’ll do this by running the command sudo cp config.json /etc/tarvis-tradingbot/config.json
Now that you’ve setup your account and secrets, we can run automated testing for your account to ensure everything is running properly.
Step 8 - Run Automated Testing
As part of automated testing, TARVIS will perform a test trade every 5 minutes with the set position limit size ($100). You should see TARVIS create a long position, setting stop limits 20% away (these are for safety), and then closing the trade 5 minutes later. This should be followed by creating a short position, setting stop limits 20% away, and closing the short.
the following should be performed in every exchange account you setup with ETH specifically:
Open a long position with set position limit value of $100
Set stop limit 20% below current price (for safety)
Close long position
Open short position with set position limit value of $100
Set stop limit 20% above current price (for safety)
Close short position
Repeat of steps 1-6
Once you see steps 1-6 occur in your account, you can stop automated testing from running.
Here are the commands we’ll run:
sudo systemctl enable tarvis-tradingbot
sudo systemctl start tarvis-tradingbot
This will kick off automated testing.
You can check on the status & log messages from tarvis-tradingbot by using the following command:
sudo systemctl status tarvis-tradingbot
Step 9 - Run Automated Trading
Now that automated testing is done running you can switch to automated trading with TARVIS!
We’ll first stop the automated testing from running:
sudo systemctl stop tarvis-tradingbot
We’ll now swap the configuration for the live configuration. We can do this by running:
sudo cp config_live.json /etc/tarvis-tradingbot/config.json
This will switch it from running automated testing to live data that matches whats being shown in Discord.
Now that you have the final configuration, we’ll restart Automated Trading to run again and its good to go!
sudo systemctl start tarvis-tradingbot
You can always check on the status of its trades by using:
systemctl status tarvis-tradingbot
Lastly, be sure to close out any trade that may be lingering from Automated Testing by hand in your accounts.