From 9ae8b92ba549ab916c88e9004a95c1ed0cd16059 Mon Sep 17 00:00:00 2001 From: Joel Grunbaum <joelgrun@gmail.com> Date: Wed, 19 Jan 2022 10:48:57 +0000 Subject: [PATCH] Added loop to click trader and hit self for perf testing --- book.hpp | 65 ++++++++++++++++---------------- 1 files changed, 33 insertions(+), 32 deletions(-) diff --git a/book.hpp b/book.hpp index 2240290..61a68d5 100644 --- a/book.hpp +++ b/book.hpp @@ -6,6 +6,7 @@ #include <iostream> #include <queue> #include <string> +#include <unordered_map> #include <vector> namespace book @@ -14,24 +15,24 @@ enum ProductTypeEnum { TEST, FUTURE, SPREAD, CALL, PUT }; struct Order { - double price; - OrderSideEnum side; - int remaining_volume; - int filled_volume; - double timestamp; - std::string id; - Order(double price, OrderSideEnum side, int volume, double timestamp, - std::string id); + double price; + OrderSideEnum side; + int remaining_volume; + int filled_volume; + double timestamp; + std::string id; + Order(double price, OrderSideEnum side, int volume, double timestamp, + std::string id); }; struct Level { - double price; - int volume; - OrderSideEnum side; - double timestamp; - std::string id; + double price; + int volume; + OrderSideEnum side; + double timestamp; + std::string id; - Level(Order& order); + Level(Order& order); }; bool operator>(const Level& a, const Level& b); @@ -42,25 +43,25 @@ std::ostream& operator<<(std::ostream& out, const Level& a); struct Book { - std::vector<Level> bidSide; - std::vector<Level> askSide; - ProductTypeEnum productType; - std::string product; - std::string stationId; - std::string unit; - std::chrono::nanoseconds expiry; - double aggFee; - double pasFee; - double broFee; + std::vector<Level> bidSide; + std::vector<Level> askSide; + ProductTypeEnum productType; + std::string product; + int stationId; + std::string unit; + std::chrono::nanoseconds expiry; + double aggFee; + double pasFee; + double broFee; + double bomPrice; - Book(); - Book(ProductTypeEnum productType, std::string product, - std::string stationId, std::string unit, - std::chrono::nanoseconds expiry, double aggFee, double pasFee, - double broFee); - void ask(Order& order); - void bid(Order& order); - void printBook(std::size_t numOrders = 10); + Book(); + Book(ProductTypeEnum productType, std::string product, int stationId, + std::string unit, std::chrono::nanoseconds expiry, double aggFee, + double pasFee, double broFee); + void ask(Order& order); + void bid(Order& order); + void printBook(std::size_t numOrders = 10); }; Book testBook(int orders = 10, bool printBook = true); -- Gitblit v1.9.3