#include "book.hpp" #include "json.hpp" #include "protocol.hpp" #include #include #include #include enum clickType { Buy, Sell, Flash }; static std::unordered_map mapClick; void initialise() { mapClick = {{"BUY", Buy}, {"SELL", Sell}, {"FLASH", Flash}, {"b", Buy}, {"s", Sell}, {"f", Flash}, {"B", Buy}, {"S", Sell}, {"F", Flash}}; } void usage() { std::cout << "DESCRIPTION" << std::endl << "Click trader using same algs" << std::endl << std::endl << "USAGE" << std::endl << "\t-a product" << std::endl << "\t-t click type (buy, sell, flash)" << std::endl << "\t-p price" << std::endl << "\t-v volume" << std::endl << "\t-i id" << std::endl << "Always need product, need side, price and volume for " "adding/flash, need id for deleting" << std::endl; } int main(int argc, char** argv) { int c; std::string product, id; double price; clickType click; uint64_t volume; initialise(); if (argc == 1) { usage(), exit(0); } while ((c = getopt(argc, argv, "a::t::p::v::i::")) != -1) { switch (c) { case 'a': product = std::string(optarg); break; case 's': click = mapClick[optarg]; break; case 'p': price = std::stod(optarg); break; case 'v': volume = std::stoll(optarg); break; case 'i': id = std::string(optarg); break; case '?': default: usage(); exit(0); } } switch (click) { case Buy: case Sell: case Flash:; } }