Getting Started with Traderion¶
Welcome to Traderion! This comprehensive guide will walk you through setting up your trading bot environment step by step, with detailed explanations for beginners.
What You'll Need¶
Before we begin, make sure you have:
- A dedicated folder for your trading projects (we recommend naming it "Trading_bots")
- The Traderion package downloaded (traderion-latest.zip)
- Python 3.8 or higher installed (or Anaconda, which we recommend)
- Your Traderion account credentials (username and password)
Why Anaconda?¶
We recommend using Anaconda for several important reasons:
- Simplified environment management: Anaconda makes it easy to create isolated Python environments with specific versions and dependencies
- Pre-installed scientific packages: It comes with many data science libraries pre-installed
- Cross-platform compatibility: Works consistently across Windows, macOS, and Linux
- Easy package management: The conda package manager handles dependencies better than pip for scientific packages
- GUI interface option: Anaconda Navigator provides a graphical interface for those who prefer not to use the command line
Step 1: Prepare Your Environment¶
Installation Instructions for Anaconda¶
On Windows¶
- Download and install Anaconda from Anaconda's official website.
- Follow the installation instructions provided during the setup wizard.
- Extract the downloaded zip file manually:
- Right-click on
traderion-latest.zipand select "Extract All..." - Choose your project folder (e.g.,
C:\Users\YourUsername\Desktop\Trading_bots\traderion-latest) and extract.
On Mac/Linux¶
- Open Terminal.
- Download and install Anaconda by running the following commands:
# For macOS curl -O https://repo.anaconda.com/archive/Anaconda3-2023.07-2-MacOSX-x86_64.sh bash Anaconda3-2023.07-2-MacOSX-x86_64.sh # For Linux curl -O https://repo.anaconda.com/archive/Anaconda3-2023.07-2-Linux-x86_64.sh bash Anaconda3-2023.07-2-Linux-x86_64.sh - Follow the installation instructions provided during the setup.
- Extract the downloaded zip file:
mkdir traderion-latest unzip traderion-latest.zip -d traderion-latest
Create and Activate an Anaconda Environment¶
- Open the Anaconda Prompt on Windows or Terminal on Mac/Linux.
-
Create a new environment:
This creates an isolated Python environment named "traderion" with Python 3.8.conda create --name traderion python=3.8 -
Activate the environment:
This switches your terminal to use the newly created environment.conda activate traderion -
Go to your Trading_bots folder:
- On Windows:
(Replace "YourUsername" with your actual Windows username) If this command was successful, you should see "(traderion) C:\Users\YourUsername\Desktop\traderion-latest>" in terminal
cd C:\Users\YourUsername\Desktop\Trading_bots\traderion-latest -
On Mac/Linux:
(You can replace this path with wherever you saved thecd ~/Desktop/Trading_bots/traderion-latesttraderion-latestfolder)The
cdcommand (change directory) navigates to your project folder.
Step 2: Install Required Packages¶
-
Install the Traderion package:
This command installs the Traderion package from the current directory. The dot (pip install ..) tells pip to look for a setup.py file in the current directory. -
Install pandas (a required library):
Pandas is a powerful data analysis library that our trading strategies use for calculations and data manipulation.pip install pandas
Step 3: Prepare Your Bot¶
Choose one of the example bots to start with:
On Windows:¶
# For client interaction bot
copy examples\clients_bot.py main.py
# Or for EMA strategy bot
copy examples\ema_bot.py main.py
On Mac/Linux:¶
# For client interaction bot
cp examples/clients_bot.py main.py
# Or for EMA strategy bot
cp examples/ema_bot.py main.py
This creates a main.py file that you'll use to run your bot. We're copying an example file to use as a starting point.
Step 4: Set Up Your Trading Session¶
- Go to https://simulator.traderion.com/
- Log in with your Traderion credentials
- Create a new session (from the Scenarios tab)
- If you're in a training session, your instructor will provide the session details
- Note the room ID from the URL (it looks like
?r=12345) - This number is crucial as it connects your bot to the specific trading session
Step 5: Configure and Run Your Bot¶
- Open main.py in a text editor
- Find these lines at the bottom of the file:
bot = MyBot('username', 'password', room_id) bot.run() - Replace with your actual credentials:
- username: Your Traderion username
- password: Your Traderion password
-
room_id: The number from your trading session URL
-
Run your bot:
This command executes your bot script, connecting it to the Traderion platform using your credentials.python main.py
Your bot is now running! You should see output in your terminal showing the bot's activity. To stop it, press CTRL + C.
Troubleshooting Common Issues¶
Connection Problems¶
- Verify your internet connection
- Double-check your username and password
- Ensure the room ID is correct and the room is active
Package Installation Issues¶
- Make sure your Python environment is activated
- Try updating pip:
pip install --upgrade pip - If you see permission errors, try adding
--userto your pip install commands
Bot Not Responding ( or stuck in )¶
- Ensure that the Traderion credentials are correct
- Ensure that the training room that you are trying to connect to is running
- Verify that your bot script has the correct imports
- Ensure you're running the script from the correct directory
Next Steps¶
- Explore the Framework - Learn about the architecture of Traderion
- Create Your First Bot - Build a custom trading bot
- Learn About Testing - Test and evaluate your bot's performance
Downloading the Project¶
To download the Traderion package:
- Click here: Download Traderion Latest Version
- Save the file to your computer
- Extract the zip file to your Trading_bots folder
- Follow the installation instructions above