Difference between revisions of "StockYard"

From Quantitative Analysis Software Courses
Jump to navigation Jump to search
Line 61: Line 61:
 
   Agent: Agent 1
 
   Agent: Agent 1
 
   Time Stamp: 3
 
   Time Stamp: 3
   Ping Excahnge and wake up again in 6 minutes
+
   Ping Exchange and wake up again in 6 minutes
   Exchange Recieved Ping Message from agent|  Time Stamp: 3
+
   Exchange Received Ping Message from agent|  Time Stamp: 3
   Agent Recieved Ping Message from exchange Time Stamp: 3
+
   Agent Received Ping Message from exchange Time Stamp: 3
 
   ----------
 
   ----------
 
   Agent: Agent 2
 
   Agent: Agent 2
 
   Time Stamp: 5
 
   Time Stamp: 5
   Ping Excahnge and wake up again in 10 minutes
+
   Ping Exchange and wake up again in 10 minutes
   Exchange Recieved Ping Message from agent|  Time Stamp: 5
+
   Exchange Received Ping Message from agent|  Time Stamp: 5
   Agent Recieved Ping Message from exchange Time Stamp: 5
+
   Agent Received Ping Message from exchange Time Stamp: 5
 
   ----------
 
   ----------
 
   Agent: Agent 1
 
   Agent: Agent 1
 
   Time Stamp: 6
 
   Time Stamp: 6
   Ping Excahnge and wake up again in 9 minutes
+
   Ping Exchange and wake up again in 9 minutes
   Exchange Recieved Ping Message from agent|  Time Stamp: 6
+
   Exchange Received Ping Message from agent|  Time Stamp: 6
   Agent Recieved Ping Message from exchange Time Stamp: 6
+
   Agent Received Ping Message from exchange Time Stamp: 6
 
   ----------
 
   ----------
 
   .......
 
   .......
Line 81: Line 81:
 
   Agent: Agent 1
 
   Agent: Agent 1
 
   Time Stamp: 21
 
   Time Stamp: 21
   Ping Excahnge and wake up again in 24 minutes
+
   Ping Exchange and wake up again in 24 minutes
   Exchange Recieved Ping Message from agent|  Time Stamp: 21
+
   Exchange Received Ping Message from agent|  Time Stamp: 21
   Agent Recieved Ping Message from exchange Time Stamp: 21
+
   Agent Received Ping Message from exchange Time Stamp: 21
 
   ----------
 
   ----------
 
   Agent: Agent 1
 
   Agent: Agent 1
 
   Time Stamp: 24
 
   Time Stamp: 24
   Ping Excahnge and wake up again in 27 minutes
+
   Ping Exchange and wake up again in 27 minutes
   Exchange Recieved Ping Message from agent|  Time Stamp: 24
+
   Exchange Received Ping Message from agent|  Time Stamp: 24
   Agent Recieved Ping Message from exchange Time Stamp: 24
+
   Agent Received Ping Message from exchange Time Stamp: 24
  
 
  <h1>How to Configure</h1>
 
  <h1>How to Configure</h1>
Line 95: Line 95:
 
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>
   Entern Exchange Name: NASDAQ
+
   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

Revision as of 19:21, 2 February 2017

StockYard logo.png



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/
several support packages are required beyond the ML4T virtual machine:
  pip install seaborn
  pip install bintrees

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 and bintrees as above.

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 in config4.py

  • Import the agent
  • Create object and add it to the list of agents

Step3 : Run bootstrap.py The program executes by running the Bootstrap file.
Go to the directory where the repository is present and type in the following command.

 python bootstrap.py

Sample Output

The following is a sample output shown in the terminal

 ----------
 Id: 1
 Name: NASDAQ
 Type: exchange
 ----------
 Id: 1
 Name: Agent 1
 Exchange: NASDAQ
 Type: trader
 ----------
 Id: 2
 Name: Agent 2
 Exchange: NASDAQ
 Type: trader
 ----------
 Kernel Runner started
 time stamp: 0, awakening all messages
 Agent Agent 1 Started, Time Stamp: 0
 Agent Agent 2 Started, Time Stamp: 0
 ----------
 Agent: Agent 1
 Time Stamp: 3
 Ping Exchange and wake up again in 6 minutes
 Exchange Received Ping Message from agent|  Time Stamp: 3
 Agent Received Ping Message from exchange Time Stamp: 3
 ----------
 Agent: Agent 2
 Time Stamp: 5
 Ping Exchange and wake up again in 10 minutes
 Exchange Received Ping Message from agent|  Time Stamp: 5
 Agent Received Ping Message from exchange Time Stamp: 5
 ----------
 Agent: Agent 1
 Time Stamp: 6
 Ping Exchange and wake up again in 9 minutes
 Exchange Received Ping Message from agent|  Time Stamp: 6
 Agent Received Ping Message from exchange Time Stamp: 6
 ----------
 .......
 ----------
 Agent: Agent 1
 Time Stamp: 21
 Ping Exchange and wake up again in 24 minutes
 Exchange Received Ping Message from agent|  Time Stamp: 21
 Agent Received Ping Message from exchange Time Stamp: 21
 ----------
 Agent: Agent 1
 Time Stamp: 24
 Ping Exchange and wake up again in 27 minutes
 Exchange Received Ping Message from agent|  Time Stamp: 24
 Agent Received Ping Message from exchange Time Stamp: 24

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