Updating Your Configuration

Updating Your Configuration

At any point you can update your configuration to add more exchanges, or change the leverage usage in your accounts using this guide.

We’ll perform the following steps in this guide:

  1. Download your existing configuration

  2. Download and run the Configurator

  3. Use the Configurator to change any details about your configuration such as changing leverage usage or adding exchanges

  4. Upload your new configuration, run testing, and go live

Step 1 - Download your existing configuration

We will start by first downloading your existing configuration to your computer so we don’t need to gather credentials/secrets you’ve already setup.

If you want to add a new exchange you can gather your secrets to enter them when you perform your config setup. I’ve added some links to documentation on how to get your secrets from those exchanges.

woo x account secrets

dYdX account secrets

You can follow these steps to get the required credentials for dYdX:

  1. From the dydx Perpetuals exchange, right-click anywhere on your web browser, and select Inspect to open Developer Tools

  2. Go to Application > Local Storage > https://trade.dydx.exchange

  3. Select STARK_KEY_PAIRS and click the drop-down next to your wallet address to get the stark private key

  4. Select API_KEY_PAIRS and click the drop-down next to your wallet address to get the API key, secret key, and passphrase

binance account secrets

We’ll perform the following steps in order to download your existing configuration

  1. SSH into your server through GCP portal

  2. Choose “Download File” in the top right corner and download the path /etc/tarvis-tradingbot/config.json

SSH into your server through GCP portal

Choose “Download File” in the top right corner and download the path /etc/tarvis-tradingbot/config.json

Step 2 - Download and run Configurator

We’ve created a configurator which you’ll be able to run on your computer in order to upgrade your TARVIS trading bot. 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.

  1. 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 window and hit enter. If you don’t have Python installed you’ll see a popup asking you to install developer tools. You’ll want to hit enter and follow the instructions to install.

  2. Download the configurator

  3. Move the configurator to your desktop and double click the folder to unzip the folder

  4. Open the unzipped folder and make sure the folder name is “config_formatter” as its the expected folder path

  5. Inside the unzipped folder double click to run run_config_formatter.command

  6. Approve the running of the command file, you may need to right click the command file and choose to run in Terminal.

  7. 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.

  1. 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.

  2. Download the configurator

  3. Move the configurator to your desktop and double click the folder to unzip the folder

  4. Open the unzipped folder and make sure the folder name is “config_formatter” as its the expected folder path

  5. Open the application Windows Powershell ISE

  6. In the top left corner, choose File -> Open -> run_config_formatter.ps1 which will open the PowerShell script

  7. 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”.

  8. 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

  1. The configurator should automatically open in your browser

  2. 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.

  3. 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

  4. 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.

  5. We’ll upload both of these files to your server, just like we did for your logging config file.

  6. 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/

At this point your Configurator should be running in the browser at http://127.0.0.1:5000

3 - Setup your new configuration

Next we’ll use the configurator to update your configuration, then we’ll update it on your server, run testing, then go live.

  1. Download Sublime Text which is a text editor which is helpful for reading JSON.

  2. Open your config.json file we downloaded earlier from your server in Sublime Text.

  3. You’ll then copy all of the contents of your configuration and paste it into the Upload Your Previous Configuration File form field. This will automatically take out all of our existing secrets so you dont need to manually enter them causing potential issues.

  4. Next, enter any additional exchanges that you wanted to setup that aren’t in the configuration file by entering their credentials (for example if your current configuration is setup for just woo x but you wanted to add dYdX, you could enter your dYdX credentials in the form fields).

  5. Lastly, make sure to fill in all necessary Configuration information for all exchanges used. If you miss any details the Configurator has built in error handling which should catch any issues and warn you with messages on the following page.

I will use an example below having dYdX and WOO X already setup and adding an exchange setup for Binance.

Open your config.json file we downloaded earlier from your server in Sublime Text. You’ll then copy all of the contents of your configuration and paste it into the Upload Your Previous Configuration File form field. This will automatically gather all existing secrets so you dont need to manually enter them causing potential issues.

Next, enter any additional exchanges that you wanted to setup that aren’t in the configuration file by entering their credentials (for example if your current configuration is setup for just woo x but you wanted to add dYdX, you could enter your dYdX credentials in the form fields). Lastly, make sure to fill in all necessary Configuration information for all exchanges used. If you miss any details the Configurator has built in error handling which should catch any issues and warn you with messages on the following page.

In the example below the previous configuration file had dydx and woo x and I’ve added a configuration for Binance.

Once you hit “Configure” you can see the message outputs providing info on what actions were taken. It was able to gather the secrets from the previous configuration for WOO X and dYdX.

Step 4 - Upload your configs to your server

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. 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

We’ll upload both of these files to your server. 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 5 - Run Automated Testing

We’ll start by first updating your TARVIS tradingbot in case theres any updates. You can do that by following the instructions here.

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:

  1. Open a long position with set position limit value of $100

  2. Set stop limit 20% below current price (for safety)

  3. Close long position

  4. Open short position with set position limit value of $100

  5. Set stop limit 20% above current price (for safety)

  6. Close short position

  7. 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 6 - Go live

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.