-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfxcore_main.cpp
More file actions
53 lines (43 loc) · 1.64 KB
/
fxcore_main.cpp
File metadata and controls
53 lines (43 loc) · 1.64 KB
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
#include <iostream>
#include "PriceFeed.h"
#include "OrderBook.h"
#include "PricingEngine.h"
#include "Logger.h"
#include "Trade.h"
#include "Load_Data.cpp"
#include "PerformanceBenchmark.cpp"
#include "Load_Data.h"
int main() {
std::cout << "Starting program...\n";
// sreate instances of the components
PriceFeed priceFeed;
OrderBook orderBook;
PricingEngine pricingEngine(priceFeed, orderBook);
// start the price feed (simulate receiving data)
std::cout << "Starting price feed...\n";
priceFeed.start();
// FX data
std::cout << "Loading FX options...\n";
std::vector<FXOption> options = loadFXOptions("synthetic_data/data_samples/synthetic_fx_data.csv");
// add some test orders
std::cout << "Adding orders...\n";
Order buyOrder("O001", "EUR/USD", 1.1200, 1000, OrderType::BUY);
Order sellOrder("O002", "EUR/USD", 1.1210, 500, OrderType::SELL);
orderBook.addOrder(buyOrder);
orderBook.addOrder(sellOrder);
// print the trade history (if any) after orders are matched
std::cout << "Printing trade history...\n";
std::vector<Trade> trades = orderBook.getTradeHistory();
for (const auto& trade : trades) {
std::cout << "Trade ID: " << trade.getTradeId() << ", Symbol: " << trade.getSymbol()
<< ", Price: " << trade.getPrice() << ", Quantity: " << trade.getQuantity() << std::endl;
}
// perform pricing (based on matched orders)
std::cout << "Performing pricing...\n";
pricingEngine.calculatePricing();
// stop the price feed
std::cout << "Stopping price feed...\n";
priceFeed.stop();
runBenchmark(orderBook, 1000);
return 0;
}