18 #ifndef ORDER_ENTRY_SYSTEM_ACCOUNT_HPP
19 #define ORDER_ENTRY_SYSTEM_ACCOUNT_HPP
21 #include "limit_order_book/limit_order_book.hpp"
22 #include "messages.hpp"
34 template<
typename Handler>
53 SystemAccount(
const std::string& username_,
const std::string& password_) :
72 | UN | Password | Auth | Shares | Capital | Orders \n\
73 |:-----|:-------------|:-----|:----------|:----------|:----------|\
89 <<
"| " << std::setw(5) << std::left << account.
username
90 <<
"| " << std::setw(13) << std::left << account.
password
91 <<
"| " << std::setw(5) << std::left << account.
is_connected
92 <<
"| " << std::setw(10) << std::left << account.
shares
93 <<
"| " << std::setw(10) << std::left << account.
capital
94 <<
"| " << std::setw(10) << std::left << account.
orders.size()
106 if (
handler ==
nullptr)
return;
123 if (
handler ==
nullptr)
return;
140 if (
handler ==
nullptr)
return;
157 if (
handler ==
nullptr)
return;
170 #endif // ORDER_ENTRY_SYSTEM_ACCOUNT_HPP
constexpr Side bool_to_side(bool side)
Convert a boolean to an order side.
Definition: messages.hpp:124
Logic for sending/receiving application messages in a financial market.
Definition: authorizer.hpp:26
bool is_connected
whether the account is currently logged in
Definition: system_account.hpp:43
A trading account for a LimitOrderBook client.
Definition: structures.hpp:155
A single order in the LimitOrderBook.
Definition: structures.hpp:65
const Side side
a boolean determining whether the order id a buy (true) or sell (false)
Definition: structures.hpp:69
void market_partial(LOB::Order *limit, LOB::Order *market) override
Partially fill a market order.
Definition: system_account.hpp:155
virtual void market_fill(Order *limit, Order *market)
Fill a market order.
Definition: structures.hpp:229
void limit_partial(LOB::Order *limit, LOB::Order *market) override
Partially fill a limit order.
Definition: system_account.hpp:121
std::string username
the user name for the account
Definition: system_account.hpp:37
Account(Shares shares_=0, Capital capital_=0)
Create an account with given values.
Definition: structures.hpp:168
SystemAccount(Handler *handler_)
Initialize a new system account with given handler.
Definition: system_account.hpp:62
void limit(Order *order)
Place a limit order.
Definition: structures.hpp:176
friend std::ostream & operator<<(std::ostream &stream, const SystemAccount &account)
Write the data from the account to a stream.
Definition: system_account.hpp:83
SystemAccount()
Initialize a new system account.
Definition: system_account.hpp:46
Handler * handler
the connection for this account
Definition: system_account.hpp:41
SystemAccount(const std::string &username_, const std::string &password_)
Initialize a new system account with given handler.
Definition: system_account.hpp:53
void market_fill(LOB::Order *limit, LOB::Order *market) override
Fill a market order.
Definition: system_account.hpp:138
std::set< Order * > orders
the set of active orders for the account
Definition: structures.hpp:161
virtual void limit_fill(Order *limit, Order *market)
Fill a limit order.
Definition: structures.hpp:210
void limit_fill(LOB::Order *limit, LOB::Order *market) override
Fill a limit order.
Definition: system_account.hpp:104
std::string password
the password for the account
Definition: system_account.hpp:39
virtual void limit_partial(Order *limit, Order *market)
Partially fill a limit order.
Definition: structures.hpp:220
Shares shares
the number of shares owned by the account
Definition: structures.hpp:157
A subclass of the LOB::Account that manages client state on the market server.
Definition: system_account.hpp:35
Quantity quantity
the quantity of the order, i.e., the number of shares
Definition: structures.hpp:71
static const std::string table_header()
Return the header for the account table.
Definition: system_account.hpp:70
Capital capital
the total capital the account has (funds)
Definition: structures.hpp:159
virtual void market_partial(Order *limit, Order *market)
Partially fill a market order.
Definition: structures.hpp:238