-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathREADME.txt
139 lines (97 loc) · 4.59 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
=====================================================================
ALGORITHMIC PAIRS TRADING - README
Github repository: https://github.com/TejasM/Algotrading
---------------------------------------------------------------------
This is the documentation for the Pairs Trading Algorithm Implementation.
See also DesignDocument.pdf
Group 04
Tejas Mehta 997486581
Neil Newman 997382443
Stefan Hadjis 997701170
Submission for ECE358
=====================================================================
The following key files are included:
-------------------------------------
The release includes an executable, test files, as well as all source code.
The project can be built using Visual Studio 2010 (perhaps earlier versions).
(All locations with respect to the Algotrading/ directory)
AlgoTrading.vcxproj
- The Visual Studio 2010 Project file
./Release/AlgoTrading.exe
- The executable GUI
- See below for using the GUI
./TestSocketClient
- The source code for the project
./Examples
- Contains example input input files for PairsTrading and EMA, MACD.
=====================================================================
Steps to use the GUI
--------------------
1. Run: ./Release/AlgoTrading.exe
2. Ensure that you are logged into TWS
3. Click Connect and accept incoming connection attempt
4. Click Input and specify an action code and input file Path
IMPORTANT NOTE: This path must be an absolute directory, e.g.:
C:\ECE358\Algotrading\Examples\pair.txt
5. See DesignDocument.pdf for information on action codes and input,
as well as the Examples folder for example include files.
Outputs that require file output will be in the form of output files
written to the root directory. Other data such as account requests,
errors, and small unimportant data will be displayed their respective
list boxes in the GUI.
Another thing to note is at times the client returns the following
error message: Error Code: 200| Error Msg: No security definition has
been found for the request. On researching the problem we have come
to the conclusion that this is not our fault and is due to
disconnection of the TWS from the server while recieve data.
Bar Sizes in multiples of 5 are the only bar sizes supported. Even
then the real time data will be printed every 5 secs but the EMA
outpu files will only be updated every bar size seconds (though) it
will still say 5s data.
=====================================================================
Summary of Input Files
----------------------
canemacrossover.txt
- Cancel the EMA crossover.
- Contains the id of the one that we want to stop.
canemacrossverstopwin.txt
- Cancel the EMA crossover with stop win/loss.
- Contains the id of the one that we want to stop.
canpair.txt
- Cancel the pair tradings
- Contains the id of the first id fo the pairs
emacstopwin.txt
- Start the ema crossover with stop win/loss strategy
- Inputs are as follows: id, stock, order size, d1, d2, fast, slow
emac.txt
- Start with ema crossover strategy
- Inputs are as follows: id, stock, order size, fast, slow
pair.txt
- Start the pairs trading strategy
- Inputs are as follows: id1, stock1, id2, stock2, id3, stock3, id4, stock4, id5, stock5, id6, stock6
order.txt
- Place an order
- Inputs are as follows: order id, stock, order action, order size, order type, lmt price
=====================================================================
List of Key Source Files - please read alongside comments in the code
---------------------------------------------------------------------
The following source files in ./TestSocketClient contain the implementation
of our algorithm. Below is a short description of each, but see the
comments in each file as a main source of documentation.
1. PairsTrading.h and PairsTrading.cpp
- Implementation of our algorithmic Pairs Trading algorithm
- See Design Document: This implements the a four state Finite State Machine
2. Stock.h, Stock.cpp
- Defines the stock object. In addition to keeping information such as the
current EMA and MACD objects associated with each stock, this class writes
the indicator data to files and places orders.
3. EMA.h, EMA.cpp
- Contains implementation of both MACD and EMA classes which are instantiated
by the stock class.
4. EMACrossover.h, EMACrossover.cpp
- Implements the EMACrossover strategy both the stop win/loss and the standard
crossover strategy.
5. client2Dlg.h, client2Dlg.cpp
- Changes made to implement the GUI and Communication Layer
- The main function of the Communication Layer is the parseFunction which deals with
each action code and performs the necessary action.