Difference between revisions of "StockYard"
(Market Simulator (Demo)) |
|||
(17 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | + | [[File:StockYard logo.png|right]] | |
− | + | <br> | |
+ | <br> | ||
<h1>Introduction</h1> | <h1>Introduction</h1> | ||
− | + | StockYard is a market simulator. The main idea behind the it is to build a virtual environment where various trading strategies can be tested. | |
+ | The system is implemented using a discrete event simulator and also uses the concept of time wraps. | ||
+ | The system would mainly consist of multiple agents having different trading strategies incorporated in them and would compete against each other in the stock exchange. | ||
+ | By building this system we hope to better understand the trading strategies and how they work in real world scenarios where external factors play a major role in the performance of an agent. | ||
+ | Note: The current code is an initial prototype for a stock exchange market simulator. | ||
+ | <br> | ||
<h1>How to Download & Install</h1> | <h1>How to Download & Install</h1> | ||
Note: To install and run the command you need to have git installed in your computer. And have permission to the qsrgsim repository<br> | Note: To install and run the command you need to have git installed in your computer. And have permission to the qsrgsim repository<br> | ||
<h2>Download & Setup</h2> | <h2>Download & Setup</h2> | ||
− | To download the repository type in the following command<br> | + | To download the repository type in the following command.<br> |
git clone https://github.gatech.edu/tb34/qsrgsim/ | git clone https://github.gatech.edu/tb34/qsrgsim/ | ||
+ | Alternatively, the repository can be downloaded as a zip file and unzipped in a convenient location. | ||
+ | |||
+ | several support packages are required beyond the ML4T virtual machine if using the ML4T VM is convenient: | ||
+ | pip install seaborn | ||
+ | pip install bintrees | ||
+ | pip install pyhamcrest | ||
+ | |||
+ | If starting from scratch one of the simplest install methods is to install Anaconda2 which installs python 2.7 and most of the packages with their dependencies. Then from the Anaconda prompt install seaborn, bintrees and pyhamcrest as above. | ||
+ | |||
+ | Also, the repository contains a file requirements.txt that list the various packages required and the entire group can be installed with the following command: | ||
+ | pip install -r requirements.txt | ||
<h1>How to Run</h1> | <h1>How to Run</h1> | ||
− | The program executes by running the | + | Step 1: Create necessary files |
− | python | + | * Create user directory under qsrgsim/ traders/ |
+ | * Create trade agent file as <user_name>_agent.py | ||
+ | * Create an __init__.py under the same folder | ||
+ | * the file format should be similar to qsrgsim/traders/vgeorge6/ which you can use as an initial reference for your work | ||
+ | * The trading logic should be present in the "strat" method of <user_name>_agent.py | ||
+ | |||
+ | Step 2: Add user agent based object using config4_new.py as an example. | ||
+ | * Import the agent. For example: | ||
+ | import traders.vgeorge6.vgeorge6_agent as vg | ||
+ | * Create object and add it to the list of agents. For example: | ||
+ | temp = vg.Trader(42, "vgeorge6"+str(42),exchange.id,interval_time,kernel_1,"vgeorge6",wakeup_time,counter,volatility,stocks,initial_price,initital_qty) | ||
+ | trade_agents.append(temp) | ||
+ | |||
+ | |||
+ | Step3 : Run stockyard.py with a command line argument specifying the desired config file | ||
+ | The program executes by running the stockyard file.<br> | ||
+ | Go to the directory where the repository is present and type in the following command. | ||
+ | python stockyard.py config4_new | ||
<h2>Sample Output</h2> | <h2>Sample Output</h2> | ||
− | The following is a sample output shown in the terminal | + | The following is a sample output shown in the terminal: |
− | + | ||
− | + | ******************** | |
− | + | Stock Yard | |
− | + | Version 0.0.1 | |
− | + | ******************** | |
− | + | ||
− | + | Simulation Started: | |
− | + | Start Date: 2008-03-08 | |
− | + | End Date: 2008-03-08 | |
− | + | number of days 1 | |
− | + | Excahnge 0 Start of Simulation received | |
− | + | Agent 99 Start of Simulation received | |
− | + | ||
− | + | Exchange Recieved: Start of Day 1 | |
− | + | Agent 99 Start message for Day 1 | |
− | + | Exchange Open | |
− | + | Simulation Completed | |
− | + | Total time for simulation run = 1 seconds and 718000 micro seconds | |
− | + | ||
− | + | Process finished with exit code 0 | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<h1>How to Configure</h1> | <h1>How to Configure</h1> | ||
Line 70: | Line 73: | ||
We would be moving it to a properties file(csv/text format) from which the various key-value parameters can be read | We would be moving it to a properties file(csv/text format) from which the various key-value parameters can be read | ||
<h2>Configuration Example</h2> | <h2>Configuration Example</h2> | ||
− | + | Enter Exchange Name: NASDAQ | |
Enter Duration of run: 24 | Enter Duration of run: 24 | ||
Enter Number of Trading Agents: 2 | Enter Number of Trading Agents: 2 | ||
Line 83: | Line 86: | ||
<h1>Description of Software Component</h1> | <h1>Description of Software Component</h1> | ||
Coming up later | Coming up later | ||
+ | <h1>Resources</h1> | ||
+ | NASDAQ's message (OUCH) API document http://nasdaqtrader.com/content/technicalsupport/specifications/TradingProducts/OUCH4.2.pdf |
Latest revision as of 20:29, 27 February 2017
Contents
Introduction
StockYard is a market simulator. The main idea behind the it is to build a virtual environment where various trading strategies can be tested.
The system is implemented using a discrete event simulator and also uses the concept of time wraps.
The system would mainly consist of multiple agents having different trading strategies incorporated in them and would compete against each other in the stock exchange.
By building this system we hope to better understand the trading strategies and how they work in real world scenarios where external factors play a major role in the performance of an agent.
Note: The current code is an initial prototype for a stock exchange market simulator.
How to Download & Install
Note: To install and run the command you need to have git installed in your computer. And have permission to the qsrgsim repository
Download & Setup
To download the repository type in the following command.
git clone https://github.gatech.edu/tb34/qsrgsim/
Alternatively, the repository can be downloaded as a zip file and unzipped in a convenient location.
several support packages are required beyond the ML4T virtual machine if using the ML4T VM is convenient: pip install seaborn pip install bintrees pip install pyhamcrest
If starting from scratch one of the simplest install methods is to install Anaconda2 which installs python 2.7 and most of the packages with their dependencies. Then from the Anaconda prompt install seaborn, bintrees and pyhamcrest as above.
Also, the repository contains a file requirements.txt that list the various packages required and the entire group can be installed with the following command:
pip install -r requirements.txt
How to Run
Step 1: Create necessary files
- Create user directory under qsrgsim/ traders/
- Create trade agent file as <user_name>_agent.py
- Create an __init__.py under the same folder
- the file format should be similar to qsrgsim/traders/vgeorge6/ which you can use as an initial reference for your work
- The trading logic should be present in the "strat" method of <user_name>_agent.py
Step 2: Add user agent based object using config4_new.py as an example.
- Import the agent. For example:
import traders.vgeorge6.vgeorge6_agent as vg
- Create object and add it to the list of agents. For example:
temp = vg.Trader(42, "vgeorge6"+str(42),exchange.id,interval_time,kernel_1,"vgeorge6",wakeup_time,counter,volatility,stocks,initial_price,initital_qty) trade_agents.append(temp)
Step3 : Run stockyard.py with a command line argument specifying the desired config file
The program executes by running the stockyard file.
Go to the directory where the repository is present and type in the following command.
python stockyard.py config4_new
Sample Output
The following is a sample output shown in the terminal:
******************** Stock Yard Version 0.0.1 ******************** Simulation Started: Start Date: 2008-03-08 End Date: 2008-03-08 number of days 1 Excahnge 0 Start of Simulation received Agent 99 Start of Simulation received Exchange Recieved: Start of Day 1 Agent 99 Start message for Day 1 Exchange Open Simulation Completed Total time for simulation run = 1 seconds and 718000 micro seconds Process finished with exit code 0
How to Configure
The configuration of the Agents and its properties are currently in a Q&A format as shown above.
We would be moving it to a properties file(csv/text format) from which the various key-value parameters can be read
Configuration Example
Enter Exchange Name: NASDAQ Enter Duration of run: 24 Enter Number of Trading Agents: 2 Enter Agent ID: 1 Enter Agent Name: Agent 1 Interval time for ping: 3 Enter Agent ID: 2 Enter Agent Name: Agent 2 Interval time for ping: 5
Description of API
Coming up later
Description of Software Component
Coming up later
Resources
NASDAQ's message (OUCH) API document http://nasdaqtrader.com/content/technicalsupport/specifications/TradingProducts/OUCH4.2.pdf