OnixS C++ ICE Binary Order Entry Handler 1.1.1
API Documentation
Loading...
Searching...
No Matches
Main.cpp File Reference

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )

Definition at line 29 of file Main.cpp.

30{
31 try
32 {
33 // `--help` to show options.
34 const AppConfiguration<SettingsConfiguration> cfg{"TradingClient", argc, argv};
35
36 const Settings settings{cfg.settingsFile()};
37 TradingClient client{settings};
38
39 const auto connectBus = [&client]{ client.connectBus(); };
40 const auto requestBgwCredentials = [&client]{ client.requestBgwCredentials(); };
41 const auto connectBgw = [&client]{ client.connectBgw(); };
42 const auto traderLogon = [&client]{ client.traderLogon(); };
43
44 CUI::Menu menu{
45 {"Print this message", "Printing available options", [&menu]{ menu.outputItems(); }},
46
47 {"Connect BUS session", "Connecting a BUS session", connectBus},
48 {"Request BGW credentials", "Requesting BGW credentials", requestBgwCredentials},
49 {"Request instruments", "Requesting SecurityDefinition data", [&client]{ client.requestInstruments(); }},
50 {"List known instruments", "Listing instruments", [&client]{ client.listInstruments(); }},
51 {"Show instrument by provided symbol", "Looking up the instrument",[&client]{ client.lookupInstruments(); }},
52
53 {"Connect BGW session", "Connecting a BGW session", connectBgw},
54 {"Trader log on", "Logging trader on", traderLogon},
55 {"Trader log out", "Logging trader out", [&client]{ client.traderLogout(); }},
56
57 {"Send order", "Sending order", [&client]{ client.sendOrder(); }},
58 {"Send cross order", "Sending cross order", [&client]{ client.sendOrderCross(); }},
59 {"Cancel order", "Cancelling order", [&client]{ client.cancelOrder(); }},
60 {"Replace order", "Replacing order", [&client]{ client.replaceOrder(); }},
61 {"Mass cancel", "Cancelling matching working orders", [&client]{ client.sendMassCancel(); }},
62
63 {"Show orders", "Viewing orders and status", [&client]{ client.showOrders(); }},
64 {"Show active orders", "Viewing active orders", [&client]{ client.showActiveOrders(); }},
65
66
67 {"Send RFQ", "Sending quote", [&client]{ client.sendQuote(); }},
68 {"Send mass quote", "Sending mass quote", [&client]{ client.sendMassQuote(); }},
69 {"Cancel quote", "Sending quote cancel", [&client]{ client.sendQuoteCancelRequest(); }},
70
71 {"Create strategy", "Creating strategy", [&client]{ client.createStrategy(); }},
72 {"Create flex", "Creating flexible instrument", [&client]{ client.createFlex(); }},
73
74
75 {"*Get ready BGW session (shortcut)", "Preparing BGW session", {connectBus, requestBgwCredentials, connectBgw, traderLogon}},
76 {"Exit", "Closing connections and exiting", [&menu]{ menu.stopRequest(); }}
77 };
78
79 menu.processRequests();
80 }
81 catch (const std::exception& ex)
82 {
83 std::cerr << std::endl << "Error: " << ex.what() << "." << std::endl;
84 return 1;
85 }
86
87 return 0;
88}
Abstraction of the main menu for the application.
Definition CUI.h:375
void stopRequest() noexcept
Requests stop.
Definition CUI.h:400
void outputItems() const
Outputs items' names onto the screen.
Definition CUI.h:393
void processRequests() const
Processes user requests until any command terminates the execution.
Definition CUI.h:385
void createStrategy()
Creates a strategy.
void traderLogout()
Logs the trader out from the BGW session.
void listInstruments()
Prints the list of instruments currently known to the client.
void requestBgwCredentials()
Requests BGW credentials (IpRequest) over the active BUS session.
void connectBus()
Commands.
void connectBgw()
Establishes a BGW session using previously obtained credentials.
void createFlex()
Creates a flexible instrument (flex).
void sendOrderCross()
Sends a cross order.
void sendMassCancel()
Submits a mass cancel request.
void replaceOrder()
Issues a replace for an existing live order.
void lookupInstruments()
Prints the list of instruments currently known to the client by the provided Symbol value.
void sendQuoteCancelRequest()
Cancels a previously submitted quote.
void cancelOrder()
Sends a cancel request for a specific order.
void sendOrder()
Sends a new order via BGW.
void sendMassQuote()
Sends a multiple quote request.
void showActiveOrders()
Displays active orders sent by this client session and their last-known statuses.
void showOrders()
Displays orders sent by this client session and their last-known statuses.
void sendQuote()
Sends a quote message.
void traderLogon()
Logs a trader into the connected BGW session.
void requestInstruments()
Submits a SecurityDefinitionRequest to fetch/refresh known instruments.