-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
27 lines (26 loc) · 927 Bytes
/
main.cpp
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
#include <chrono>
#include <sstream>
#include <cstdio>
#include "MatchingEngine.h"
int main() {
auto* m = new MatchingEngine();
m->addSymbol(1);
auto start = std::chrono::high_resolution_clock::now();
int N = 2000000;
for (int i = 0; i < N; i+=10) {
m->placeOrder(i+0,2, 1, 8, 5,false);
m->placeOrder(i+1,2, 1, 5, 5,false);
m->placeOrder(i+2,1, 1, 8, 4,true);
m->placeOrder(i+3,1, 1, 12, 1,true);
m->placeOrder(i+4,3, 1, 9, 5,true);
m->placeOrder(i+5,4, 1, 8, 4,false);
m->placeOrder(i+6,3, 1, 7, 7,true);
m->placeOrder(i+7,4, 1, 6, 2,false);
m->placeOrder(i+8,5, 1, 8, 8,false);
m->placeOrder(i+9,5, 1, 13, 2,false);
}
auto stop = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> diff = stop-start;
printf("Simulated %d Trades in %dms\n", N, (int)(diff.count()*1000));
return 0;
}