Getting Started =============== This guide assumes you have the following prerequisites: * this documentation * the Traderion Python package: *traderion2-[x].0.zip* (traderion2-1.0.zip, traderion2-2.0.zip or traderion2-3.0.zip) found on the Download links from the Main page. * Python 3.5 or higher installed for version 1.0 and 2.0 and Python 3.8 for version 3.0 * a Traderion user account Installation ------------ We will use the traderion2-3.0.zip version as an example. If you plan on using the other versions, simply replace the name of the zip file on all steps. ! The command to run Python may vary depending on your system configuration. Common aliases include python, python3, python3.x (e.g., python3.8). ============== Linux & MacOS ============== 1. Extract the zip file into a directory: ``unzip traderion2-3.0.zip -d traderion2-3.0`` 2. Go to the root directory and create a virtual environment: ``cd traderion2-3.0 && cd sim.quant.api && python3 -m venv venv`` 3. Activate the virtual enviornment: ``source venv/bin/activate`` 4. Install the packages: ``python3 -m pip install -r requirements.txt`` 5. You can now remove the compressed file: ``rm -r ../../traderion2-3.0.zip`` ======= Windows ======= 1. Extract the zip file into a directory: ``Expand-Archive traderion2-3.0.zip -d traderion2-3.0`` 2. Go to the root directory: ``cd traderion2-3.0; cd sim.quant.api`` Step 3 involves activating a virtual environment. Below are three different methods to accomplish this. a) Using venv for virtual environment 3a. Create a virtual environment: ``python3 -m venv .myenv`` 4a. Activate the environment: ``.myenv\Scripts\activate`` b) Using conda instead of venv If you want to use conda instead of venv, replace steps 3a and 4a with steps 3b and 4b: 3b. Use this to create a virtual environment with conda: ``conda create --name traderion python=3.8`` 4b. Activate the conda environment: ``conda activate traderion`` c) Using pipenv instead of venv If you want to use pipenv instead of venv, replace steps 3a and 4a with steps 3c and 4c: 3c. Create and activate a virtualenvironment with venv: ``pipenv shell`` 4c. Install the requiremenets: ``pipenv install -r requirements.txt`` 5. Install the dependencies: ``python3 -m pip install -r requirements.txt`` 6. Copy a bot example into the parent directory, edit the file with the desired details (room_id, username, password), and run it: ``copy examples/composite_bot.py main.py`` ``python3 main.py`` *!!* In order to activate virtual environments, you might also need to run the following in admin mode: ``Set-ExecutionPolicy Unrestricted`` Running your first bot ---------------------- 1. Copy our example bot to your project directory: ``cp /path/to/examples/random_bot.py main.py`` If the trading-bot package files are in /Users/john/Desktop/Trading_bots/traderion2-3.0, the command becomes the following: (Replace "john" with your machine user) ``cd /Users/john/Desktop/Trading_bots/traderion2-3.0`` 2. Create a trading session on the Traderion platform and join it. After you join the session, the url should look like this: ``https://sim.traderion.com/trading//dealing`` ```` in the above url is a number that uniquely identifies your session. We call it a *room id*. 3. Open *main.py* and fill in your *username*, *password* and *room_id* in the **main** function. 4. Run the example with ``python main.py`` The bot will run until the room is finished. To stop the bot earlier, just press **CTRL + C**. When using a multi-asset bot like composite_bot, you may need to define strategy profiles for each asset. The corresponding Swift IDs, which must be used in the str_map object within the composite_bot.py module, can be found by running the bot with the --info parameter: ``python3.8 main.py --info`` Congratulations! You can now start adding your own custom logic to the bot.