Getting Started¶
The below instructions use the traderion-0.1 trading bot version as an example. The same instructions apply to newer trading bot versions.
This guide assumes you have done the following:
- You have created a new folder, "Trading_bots", which will contain the package source zip-file downloaded: traderion-0.1
- You have downloaded traderion-0.1.zip found at the bottom of the Welcome page (Download 0.1 version) in the previously created "Trading_bots" folder.
- You have unzipped the package source zip file into your "Trading_bots" folder
- You have installed Python 3.7 or higher installed (alternatively, you can use Anaconda)
- You were assigned a Traderion user account (username and password)
Project Setup¶
On Linux and macOS:¶
Open a Terminal window and run the commands bellow.
Change directory to the trading-bot directory:
cd path-to-trading-bot-directory
If the trading-bot package files are in
/Users/john/Desktop/Trading_bots/traderion-0.1
, the command becomes: Replace "john" with your machine user
cd /Users/john/Desktop/Trading_bots/traderion-0.1
Create a virtual environment:
python -m venv traderion
or if you are using Anaconda
conda create --name traderion python=3.7
Activate the environment:
source traderion/bin/activate
or if you are using Anaconda
conda activate traderion
Install the package:
cd traderion-0.1 && pip install . && cd ..
Install pandas
pip install pandas
Copy one of the examples in your root traderion-0.1 bot folder:
cp /Users/john/Desktop/Trading_bots/traderion-0.1/examples/clients_bot.py main.py
or
cp /Users/john/Desktop/Trading_bots/traderion-0.1/examples/ema_bot.py main.py
This command creates a main.py file in the trading bot directory, which you can use to deploy the trading bot into the trading simulator.
On Windows (only with Anaconda)¶
Open an Anaconda Prompt from the Start menu.
Create a new environment:
conda create --name traderion python=3.7
Activate the environment:
activate traderion
Go to the tradingbot folder:
cd path-to-tradingbot
If the trading-bot package files are in
C:\Users\algotest\Desktop\Trading_bots\traderion-0.1
, your command becomes:
cd ``C:\Users\algotest\Desktop\Trading_bots\traderion-0.1
Install the traderion package:
cd traderion-0.1 && pip install . && cd ..
Install pandas:
pip install pandas
Copy one of the examples:
copy examples\clients_bot.py main.py
or
copy examples\ema_bot.py main.py
This command creates a main.py file in the trading bot directory, which you can use to deploy the trading bot into the trading simulator.
Trading Session¶
In order to run a trading bot, you will need an active trading session on the platform.
Go to https://simulator.traderion.com/ and create a new session (from the scenarios tab).
Note: When you are in an official training session, you don't need to create a new one. Your trainer has already created the session for the class.
After you join the session, you will be redirected to the trading screen. The url should look like this:
https://simulator.traderion.com/treasury/?r=12345
The number after ?r=
is your current trading session number. We call the trading session a room. The number is the room_id.
You can now open the main.py file and replace the mock credentials in main function (at the bottom of the file) with your actual credentials (username, password, room_id), found at the very end of the file.
To start the bot, in the terminal prompt you just run:
python main.py
The bot will run while the room is not finished. To stop the bot, just press CTRL + C.
Congratulations! You can now start adding your own custom logic to the bot!