├── .gitignore
├── README.md
├── Trading_Platform_GUI
├── AlgorithmicTrading.pro.user
├── AnalysisData.cpp
├── AnalysisData.h
├── AnalysisDisplays.cpp
├── AnalysisDisplays.h
├── CamelPushButton.cpp
├── CamelPushButton.h
├── DisplayAnalysis.cpp
├── DisplayAnalysis.h
├── DisplayAnalysis.ui
├── GlobalIncludes.h
├── Makefile
├── MyDateTableWidgetItem.h
├── MyTabWindow.h
├── MyTableWidgetItem.h
├── ParamAnalysisHelper.cpp
├── ParamAnalysisHelper.h
├── ParamSet.cpp
├── ParamSet.h
├── ParseCSVData.cpp
├── ParseCSVData.h
├── ParseInputCSVData.cpp
├── ParseInputCSVData.h
├── QuantPara.cpp
├── QuantPara.h
├── QuantitativeAnalysisDisplay.cpp
├── QuantitativeAnalysisDisplay.h
├── QuantitativeAnalysisDisplay.ui
├── ReturnsAnalysis.cpp
├── ReturnsAnalysis.h
├── SummaryForm.cpp
├── SummaryForm.h
├── TradeSimulator.cpp
├── TradeSimulator.h
├── icon.ico
├── iconise.rc
├── main.cpp
├── mainwindow.cpp
├── mainwindow.h
├── mainwindow.ui
├── qt.config
├── resources.qrc
├── resources
│ ├── analyse.jpg
│ ├── barchart.png
│ ├── displayanalysis.png
│ ├── export_csv.png
│ ├── file_csv.png
│ ├── globe.gif
│ ├── letterB.png
│ ├── letterS.png
│ ├── logo.png
│ ├── run.png
│ ├── run_program.gif
│ └── terminal.gif
├── summaryform.ui
└── tradesimulator.ui
├── src
├── CSVReader.cpp
├── CSVReader.h
├── CSVWriter.cpp
├── CSVWriter.h
├── GlobalIncludes.h
├── Logger.cpp
├── Logger.h
├── MomentumStrategy.cpp
├── MomentumStrategy.h
├── MomentumStrategyData.cpp
├── MomentumStrategyData.h
├── MutantFrogStrategy.cpp
├── MutantFrogStrategy.h
├── Params.cpp
├── Params.h
├── Strategy.cpp
├── Strategy.h
├── StrategyResult.cpp
├── StrategyResult.h
├── TradeDay.cpp
├── TradeDay.h
├── TradingInfluences.cpp
├── TradingInfluences.h
├── UnitTester.cpp
├── UnitTester.h
├── example.param
├── main.cpp
├── makefile
└── makefile_linux
└── tools
├── External Tester
└── tester.py
├── Mass Data Generator
└── generator.py
└── Trock Equity Data Generator
└── TrockEquityDataGen.c
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | *.swp
3 | *.swo
4 | *.o
5 | AlgorithmicTrading
6 | *.csv
7 | a.out
8 | *.log
9 | tools/External Tester/TrockEquityDataGen.exe
10 | tools/Trock Equity Data Generator/TrockEquityDataGen.exe
11 | tools/External Tester/trockAT.exe
12 | build-AlgorithmicTrading-Desktop_Qt_5_4_1_MinGW_32bit-Debug/
13 | build-AlgorithmicTrading-Desktop_Qt_5_4_1_MinGW_32bit-Release/
14 | *.pro
15 | *.
16 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Algorithmic Trading Application
2 | =========
3 | **This was part of the project outcome for the SENG3011 course in Semester 1, 2015**
4 |
5 | Algorithm modules designed to make money on the equity market.
6 | The Trock Testing Platform is a GUI which can utilise stragegy modules made by ourselves or other teams.
7 | The Testing Platform features quantitive analysis, the ability to run different stragegy modules, the ability to analyse order CSV files, and much more.
8 |
9 | The Testing Platform was written using Qt and is cross compatible with Windows, MAC OS and Linux operating systems.
10 | Both the Testing Platform and backend were written in C++ with speed being a top priority.
11 | The latest iteration of the software is incredibly effecient and can analyse huge input files within seconds.
12 |
13 | Images
14 | -----
15 |
16 |
Analytics Summary:
17 |
18 | 
19 |
20 | Analysis Tab:
21 |
22 | 
23 |
24 | Graph View:
25 |
26 | 
27 |
28 | Quantitative Analysis Tab:
29 |
30 | 
31 |
32 | Quantitative Analysis:
33 |
34 | 
35 |
36 | Run Strategy:
37 |
38 | 
39 |
40 | Trade Simulator Tab:
41 |
42 | 
43 |
44 | Trade Simulator:
45 |
46 | 
47 |
48 |
49 | License
50 | ----
51 | Free to use.
52 |
--------------------------------------------------------------------------------
/Trading_Platform_GUI/AlgorithmicTrading.pro.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | EnvironmentId
7 | {141aedd6-cedd-4afc-bf04-1ad8e1c854d0}
8 |
9 |
10 | ProjectExplorer.Project.ActiveTarget
11 | 0
12 |
13 |
14 | ProjectExplorer.Project.EditorSettings
15 |
16 | true
17 | false
18 | true
19 |
20 | Cpp
21 |
22 | CppGlobal
23 |
24 |
25 |
26 | QmlJS
27 |
28 | QmlJSGlobal
29 |
30 |
31 | 2
32 | UTF-8
33 | false
34 | 4
35 | false
36 | 80
37 | true
38 | true
39 | 1
40 | true
41 | false
42 | 0
43 | true
44 | 0
45 | 8
46 | true
47 | 1
48 | true
49 | true
50 | true
51 | false
52 |
53 |
54 |
55 | ProjectExplorer.Project.PluginSettings
56 |
57 |
58 |
59 | ProjectExplorer.Project.Target.0
60 |
61 | Desktop Qt 5.4.1 MinGW 32bit
62 | Desktop Qt 5.4.1 MinGW 32bit
63 | qt.54.win32_mingw491_kit
64 | 0
65 | 0
66 | 0
67 |
68 | O:/Dropbox/Github/Algorithmic-Trading/build-AlgorithmicTrading-Desktop_Qt_5_4_1_MinGW_32bit-Debug
69 |
70 |
71 | true
72 | qmake
73 |
74 | QtProjectManager.QMakeBuildStep
75 | false
76 | true
77 |
78 | false
79 | false
80 |
81 |
82 | true
83 | Make
84 |
85 | Qt4ProjectManager.MakeStep
86 |
87 | false
88 |
89 |
90 |
91 | 2
92 | Build
93 |
94 | ProjectExplorer.BuildSteps.Build
95 |
96 |
97 |
98 | true
99 | Make
100 |
101 | Qt4ProjectManager.MakeStep
102 |
103 | true
104 | clean
105 |
106 |
107 | 1
108 | Clean
109 |
110 | ProjectExplorer.BuildSteps.Clean
111 |
112 | 2
113 | false
114 |
115 | Debug
116 |
117 | Qt4ProjectManager.Qt4BuildConfiguration
118 | 2
119 | true
120 |
121 |
122 | O:/Dropbox/Github/Algorithmic-Trading/build-AlgorithmicTrading-Desktop_Qt_5_4_1_MinGW_32bit-Release
123 |
124 |
125 | true
126 | qmake
127 |
128 | QtProjectManager.QMakeBuildStep
129 | false
130 | true
131 |
132 | false
133 | false
134 |
135 |
136 | true
137 | Make
138 |
139 | Qt4ProjectManager.MakeStep
140 |
141 | false
142 |
143 |
144 |
145 | 2
146 | Build
147 |
148 | ProjectExplorer.BuildSteps.Build
149 |
150 |
151 |
152 | true
153 | Make
154 |
155 | Qt4ProjectManager.MakeStep
156 |
157 | true
158 | clean
159 |
160 |
161 | 1
162 | Clean
163 |
164 | ProjectExplorer.BuildSteps.Clean
165 |
166 | 2
167 | false
168 |
169 | Release
170 |
171 | Qt4ProjectManager.Qt4BuildConfiguration
172 | 0
173 | true
174 |
175 | 2
176 |
177 |
178 | 0
179 | Deploy
180 |
181 | ProjectExplorer.BuildSteps.Deploy
182 |
183 | 1
184 | Deploy locally
185 |
186 | ProjectExplorer.DefaultDeployConfiguration
187 |
188 | 1
189 |
190 |
191 |
192 | false
193 | false
194 | false
195 | false
196 | true
197 | 0.01
198 | 10
199 | true
200 | 1
201 | 25
202 |
203 | 1
204 | true
205 | false
206 | true
207 | valgrind
208 |
209 | 0
210 | 1
211 | 2
212 | 3
213 | 4
214 | 5
215 | 6
216 | 7
217 | 8
218 | 9
219 | 10
220 | 11
221 | 12
222 | 13
223 | 14
224 |
225 | 2
226 |
227 | AlgorithmicTrading
228 |
229 | Qt4ProjectManager.Qt4RunConfiguration:O:/Dropbox/Github/Algorithmic-Trading/Trading_Platform_GUI/AlgorithmicTrading.pro
230 |
231 | AlgorithmicTrading.pro
232 | false
233 | false
234 |
235 | 3768
236 | false
237 | true
238 | false
239 | false
240 | true
241 |
242 | 1
243 |
244 |
245 |
246 | ProjectExplorer.Project.TargetCount
247 | 1
248 |
249 |
250 | ProjectExplorer.Project.Updater.FileVersion
251 | 18
252 |
253 |
254 | Version
255 | 18
256 |
257 |
258 |
--------------------------------------------------------------------------------
/Trading_Platform_GUI/AnalysisData.cpp:
--------------------------------------------------------------------------------
1 | #include "AnalysisData.h"
2 |
3 | namespace std {
4 |
5 | AnalysisData::AnalysisData(string company) : company(company) {
6 | totalDaysTrading = 0;
7 | priceLow = -1;
8 | priceHigh = -1;
9 | }
10 |
11 | AnalysisData::~AnalysisData() {
12 |
13 | }
14 |
15 | void AnalysisData::addNextTradeData(signal tradeSignal, string date, double price, int volume) {
16 | TradeData trade;
17 | trade.date = date;
18 | trade.tradeSignal = tradeSignal;
19 | trade.price = price;
20 | if (price > priceHigh || priceHigh == -1) {
21 | priceHigh = price;
22 | } else if (price < priceLow || priceLow == -1) {
23 | priceLow = price;
24 | }
25 | if (tradeDataAvailable() == 0) {
26 | trade.tradeDayOffset = 0;
27 | totalDaysTrading = 1;
28 | } else {
29 | trade.tradeDayOffset = daysDifference(lastTradeDate(), trade.date) + totalDaysTrading - 1;
30 | totalDaysTrading = trade.tradeDayOffset + 1; //offset to lastest day + 1
31 | }
32 | tradeData.push_back(trade);
33 | }
34 |
35 | int AnalysisData::tradeDataAvailable() {
36 | return tradeData.size();
37 | }
38 |
39 | string AnalysisData::firstTradeDate() {
40 | return tradeData[0].date;
41 | }
42 |
43 | string AnalysisData::lastTradeDate() {
44 | return tradeData[tradeDataAvailable() - 1].date;
45 | }
46 |
47 | string AnalysisData::getCompany() {
48 | return company;
49 | }
50 |
51 | int AnalysisData::daysTrading() {
52 | return totalDaysTrading;
53 | }
54 |
55 | double AnalysisData::highestPrice() {
56 | return priceHigh;
57 | }
58 |
59 | double AnalysisData::lowestPrice() {
60 | return priceLow;
61 | }
62 |
63 | int AnalysisData::daysDifference(string dateFrom, string dateTo) {
64 |
65 | Date from = Helper::parseDate(dateFrom);
66 | Date to = Helper::parseDate(dateTo);
67 |
68 | if (from.day == -1 || to.day == -1 || from.month == -1 || to.month == -1 || from.year == -1 || to.year == -1) {
69 | return -1; //error, date parse failed
70 | }
71 |
72 | int diff = 0;
73 |
74 | while (from.year < to.year || (from.year == to.year && (from.month < to.month || (from.month == to.month && from.day < to.day)) ) ) {
75 | diff++;
76 | from.day++;
77 | if (from.day > Helper::daysInMonth(from.month, from.year)) {
78 | from.day = 1;
79 | from.month++;
80 | if (from.month > 12) {
81 | from.month = 1;
82 | from.year++;
83 | }
84 | }
85 | }
86 |
87 | return diff;
88 | }
89 |
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/Trading_Platform_GUI/AnalysisData.h:
--------------------------------------------------------------------------------
1 | #ifndef ANALYSISDATA_H
2 | #define ANALYSISDATA_H
3 |
4 | #include "GlobalIncludes.h"
5 |
6 | #include
7 | #include
8 |
9 |
10 | namespace std {
11 |
12 | enum signal {
13 | BUY,
14 | SELL
15 | };
16 |
17 | struct TradeData {
18 | signal tradeSignal;
19 | string date;
20 | double price;
21 | int tradeDayOffset; //days from the start of trading
22 | };
23 |
24 |
25 | class AnalysisData
26 | {
27 |
28 | private:
29 | vector tradeData;
30 | string company;
31 | int totalDaysTrading;
32 | double priceLow;
33 | double priceHigh;
34 |
35 | int daysDifference(string dateFrom, string dateTo);
36 |
37 | public:
38 | AnalysisData(string company);
39 | ~AnalysisData();
40 |
41 | void addNextTradeData(signal tradeSignal, string date, double price, int volume);
42 |
43 | int tradeDataAvailable();
44 | inline TradeData getData(int index) {return tradeData[index];}
45 |
46 | string firstTradeDate();
47 | string lastTradeDate();
48 |
49 | int daysTrading(); //total days, first - last trade date
50 |
51 | string getCompany();
52 |
53 | double highestPrice();
54 | double lowestPrice();
55 |
56 | };
57 |
58 | }
59 |
60 | #endif // ANALYSISDATA_H
61 |
62 |
63 |
--------------------------------------------------------------------------------
/Trading_Platform_GUI/AnalysisDisplays.cpp:
--------------------------------------------------------------------------------
1 | #include "AnalysisDisplays.h"
2 | #include "DisplayAnalysis.h"
3 | #include "SummaryForm.h"
4 | #include "MyTabWindow.h"
5 |
6 | #include "mainwindow.h"
7 | #include "ui_mainwindow.h"
8 |
9 | AnalysisDisplays* __analysisDisplays = nullptr;
10 |
11 | AnalysisDisplays::AnalysisDisplays()
12 | {
13 | currentDisplayId = 0;
14 | parseCSV = nullptr;
15 | }
16 |
17 | AnalysisDisplays::~AnalysisDisplays()
18 | {
19 | if (parseCSV != nullptr) delete parseCSV;
20 | }
21 |
22 | AnalysisDisplays *AnalysisDisplays::instance() {
23 | if (__analysisDisplays == nullptr) {
24 | __analysisDisplays = new AnalysisDisplays();
25 | }
26 | return __analysisDisplays;
27 | }
28 |
29 |
30 | void AnalysisDisplays::showCheckList(std::string csvFile, QListWidget* lw, QWidget *parent) {
31 |
32 | parseCSV = new std::ParseCSVData(csvFile);
33 |
34 | //Add checkboxes to list for each company
35 | for (std::string eqType : parseCSV->getAllEquityTypes()) {
36 | const QString itemName = eqType.c_str();
37 | QListWidgetItem *item = new QListWidgetItem(itemName, lw);
38 | item->setFlags(item->flags() | Qt::ItemIsUserCheckable); // set checkable flag
39 | item->setCheckState(Qt::Unchecked); // AND initialize check state
40 | lw->addItem(item);
41 | listItems.push_back(item);
42 | }
43 |
44 |
45 | }
46 |
47 | vector> AnalysisDisplays::exportAnalysisData(){
48 | vector eqTypeList;
49 | for (QListWidgetItem *wi: listItems) {
50 | if(wi->checkState()) {
51 | eqTypeList.push_back(wi->text().toStdString());
52 | }
53 | }
54 | return SummaryForm::export_Summary(this->parseCSV, eqTypeList);
55 | }
56 | void AnalysisDisplays::showAnalysisDisplays(QWidget *parent) {
57 |
58 | QMainWindow *mw = new QMainWindow(parent);
59 |
60 | mw->setWindowTitle("Equity Strategy Analysis");
61 | mw->setMinimumSize(750, 700);
62 |
63 | MyTabWidget *tabw = new MyTabWidget(mw, this->parseCSV);
64 | mw->setCentralWidget(tabw);
65 |
66 | //Load summary tab
67 | SummaryForm *summary = new SummaryForm(tabw);
68 | std::string summaryText = "Summary";
69 | tabw->addTab(summary, summaryText.c_str());
70 | tabw->addEqType(summaryText);
71 |
72 | //Create vector of checked equities
73 | vector eqTypeList;
74 | for (QListWidgetItem *wi: listItems) {
75 | if (wi->checkState()) {
76 | eqTypeList.push_back(wi->text().toStdString());
77 | }
78 | }
79 |
80 | //Set total returns
81 | summary->setTotalNetReturns(this->parseCSV, eqTypeList);
82 | summary->show();
83 |
84 | //Load company tabs
85 | for (QListWidgetItem *wi: listItems) {
86 | if (wi->checkState()) {
87 | std::string eqType = wi->text().toStdString();
88 |
89 | tabw->addEqType(eqType);
90 |
91 | DisplayAnalysis *dw = new DisplayAnalysis();
92 |
93 | displays[currentDisplayId] = dw;
94 |
95 | //Add this tab to tab widget
96 | tabw->addTab(dw, eqType.c_str());
97 |
98 | dw->setDisplayId(currentDisplayId);
99 | currentDisplayId++;
100 | }
101 | }
102 |
103 | //Show the main window
104 | mw->show();
105 | }
106 |
107 | void AnalysisDisplays::analyzeCSVOutput(std::string csvFile, QWidget *parent) {
108 |
109 | std::ParseCSVData parseCSV = std::ParseCSVData(csvFile);
110 |
111 | if (parseCSV.getAllEquityTypes().size() == 0) {
112 | QMessageBox::question(parent, "No Equity Trades", "The strategy suggested no equity trades.", QMessageBox::Ok);
113 | return;
114 | }
115 |
116 | QMainWindow *mw = new QMainWindow(parent);
117 |
118 | mw->setWindowTitle("Equity Strategy Analysis");
119 | mw->setMinimumSize(750, 700);
120 |
121 | QTabWidget *tabw = new QTabWidget(mw);
122 | mw->setCentralWidget(tabw);
123 |
124 | std::ParseCSVData tmpParseCSV = std::ParseCSVData(csvFile);
125 |
126 | for (std::string eqType : tmpParseCSV.getAllEquityTypes()) {
127 |
128 | DisplayAnalysis *dw = new DisplayAnalysis();
129 |
130 | displays[currentDisplayId] = dw;
131 |
132 | //Add this tab to tab widget
133 | tabw->addTab(dw, eqType.c_str());
134 |
135 | dw->setDisplayId(currentDisplayId);
136 | currentDisplayId++;
137 | dw->show();
138 |
139 | dw->displayAnalysis(tmpParseCSV.getDataForEquityType(eqType));
140 | }
141 |
142 | //Show the main window
143 | mw->show();
144 | }
145 |
146 | void AnalysisDisplays::displayClosing(long displayId) {
147 | if (displays.find(displayId) != displays.end()) {
148 | DisplayAnalysis *display = displays[displayId];
149 | delete display;
150 | displays.erase(displayId);
151 | }
152 | }
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
--------------------------------------------------------------------------------
/Trading_Platform_GUI/AnalysisDisplays.h:
--------------------------------------------------------------------------------
1 | #ifndef ANALYSISDISPLAYS_H
2 | #define ANALYSISDISPLAYS_H
3 |
4 | #include "DisplayAnalysis.h"
5 | #include "ParseCSVData.h"
6 | #include "GlobalIncludes.h"
7 |
8 | #include
9 | #include
10 |
11 | #include