libjmmcg  build_2176
A C++ library containing an eclectic mix of useful, advanced components.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
jmmcg::exchanges::common::simulator_responses< MsgDetails, Derived, SktT > Class Template Reference

A simple, MIT-protocol exchange simulator. More...

#include <processing_rules.hpp>

Inheritance diagram for jmmcg::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >:
[legend]
Collaboration diagram for jmmcg::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >:
[legend]

Public Types

using base_t = message_responses< MsgDetails, MsgDetails, Derived, typename MsgDetails::client_to_exchange_messages_t, SktT >
 
using msg_details_t = typename base_t::src_msg_details_t
 
using socket_t = typename base_t::socket_t
 
using derived_t = typename base_t::derived_t
 
- Public Types inherited from jmmcg::exchanges::common::message_responses< MsgDetails, MsgDetails, Derived, MsgDetails::client_to_exchange_messages_t, SktT >
using src_msg_details_t = MsgDetails
 A type containing the details of the messages that will be received from the client. More...
 
using dest_msg_details_t = MsgDetails
 A type containing the details of the messages that will be sent to the exchange. More...
 
using derived_t = Derived
 
using flow_msg_types = MsgDetails::client_to_exchange_messages_t
 
using socket_t = SktT
 

Public Member Functions

template<class Buff >
bool process_msg (Buff const &buff, socket_t &exchg_skt, socket_t &client_skt) FORCE_INLINE
 

Static Public Member Functions

static std::string to_string () noexcept(false)
 

Static Public Attributes

static constexpr
msg_details_t::UserName_t 
username {"usr"}
 The only valid username. More...
 
static constexpr
msg_details_t::Password_t 
password {"fubar"}
 The only valid password. More...
 
static constexpr
msg_details_t::Password_t 
new_password {"snafu"}
 The only valid new password. More...
 
static constexpr std::int32_t quantity_limit =100
 The magic quantity value. More...
 
static constexpr
msg_details_t::Price_t 
price =42
 For limit orders, this is the price at which the order will be traded, otherwise it will be left "on the market". More...
 
static constexpr
msg_details_t::Price_t 
scaled_price =42*msg_details_t::implied_decimal_places
 For limit orders, this is the native, scaled price at which the order will be traded, otherwise it will be left "on the market", which is used within the simulator. More...
 

Protected Types

using order_book_t = std::map< typename msg_details_t::ClientOrderID_t, typename msg_details_t::NewOrder >
 

Protected Attributes

order_book_t order_book
 
int32_t sequenceNumber =0
 

Additional Inherited Members

- Protected Member Functions inherited from jmmcg::exchanges::common::message_responses< MsgDetails, MsgDetails, Derived, MsgDetails::client_to_exchange_messages_t, SktT >
bool create_response (Buff const &buff, socket_t &exchg_skt, socket_t &client_skt) FORCE_INLINE
 

Detailed Description

template<class MsgDetails, class Derived, class SktT>
class jmmcg::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >

A simple, MIT-protocol exchange simulator.

This server is single-threaded, and permits only one client connection at a time. The behaviour of this simulator is a simplification derived from the specification in [1]. [1] "MIT203 - MILLENNIUM EXCHANGE Native Trading Gateway"

Definition at line 62 of file processing_rules.hpp.

Member Typedef Documentation

template<class MsgDetails, class Derived, class SktT>
using jmmcg::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::base_t = message_responses<MsgDetails, MsgDetails, Derived, typename MsgDetails::client_to_exchange_messages_t, SktT>

Definition at line 64 of file processing_rules.hpp.

template<class MsgDetails, class Derived, class SktT>
using jmmcg::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::derived_t = typename base_t::derived_t

Definition at line 67 of file processing_rules.hpp.

template<class MsgDetails, class Derived, class SktT>
using jmmcg::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::msg_details_t = typename base_t::src_msg_details_t

Definition at line 65 of file processing_rules.hpp.

template<class MsgDetails, class Derived, class SktT>
using jmmcg::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::order_book_t = std::map<typename msg_details_t::ClientOrderID_t, typename msg_details_t::NewOrder>
protected

Definition at line 94 of file processing_rules.hpp.

template<class MsgDetails, class Derived, class SktT>
using jmmcg::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::socket_t = typename base_t::socket_t

Definition at line 66 of file processing_rules.hpp.

Member Function Documentation

template<class MsgDetails , class Derived , class SktT >
template<class Buff >
bool jmmcg::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::process_msg ( Buff const &  buff,
socket_t exchg_skt,
socket_t client_skt 
)
inline
Returns
False to continue processing messages, true otherwise.

Definition at line 73 of file processing_rules_impl.hpp.

template<class MsgDetails , class Derived , class SktT >
std::string jmmcg::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::to_string ( )
inlinestaticnoexcept

Definition at line 79 of file processing_rules_impl.hpp.

Member Data Documentation

template<class MsgDetails, class Derived, class SktT>
constexpr simulator_responses< MsgDetails, Derived, SktT >::msg_details_t::Password_t jmmcg::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::new_password {"snafu"}
static

The only valid new password.

Definition at line 74 of file processing_rules.hpp.

template<class MsgDetails, class Derived, class SktT>
order_book_t jmmcg::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::order_book
protected

Definition at line 95 of file processing_rules.hpp.

template<class MsgDetails, class Derived, class SktT>
constexpr simulator_responses< MsgDetails, Derived, SktT >::msg_details_t::Password_t jmmcg::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::password {"fubar"}
static

The only valid password.

Definition at line 72 of file processing_rules.hpp.

template<class MsgDetails, class Derived, class SktT>
constexpr simulator_responses< MsgDetails, Derived, SktT >::msg_details_t::Price_t jmmcg::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::price =42
static

For limit orders, this is the price at which the order will be traded, otherwise it will be left "on the market".

Definition at line 81 of file processing_rules.hpp.

template<class MsgDetails, class Derived, class SktT>
constexpr std::int32_t jmmcg::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::quantity_limit =100
static

The magic quantity value.

A value less than this will result in a full-filled ExecutionReport, otherwise a partial fill ExecutionReport will be returned, and the remaining quantity left "on the market".

Definition at line 79 of file processing_rules.hpp.

template<class MsgDetails, class Derived, class SktT>
constexpr simulator_responses< MsgDetails, Derived, SktT >::msg_details_t::Price_t jmmcg::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::scaled_price =42*msg_details_t::implied_decimal_places
static

For limit orders, this is the native, scaled price at which the order will be traded, otherwise it will be left "on the market", which is used within the simulator.

Definition at line 83 of file processing_rules.hpp.

template<class MsgDetails, class Derived, class SktT>
int32_t jmmcg::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::sequenceNumber =0
protected

Definition at line 96 of file processing_rules.hpp.

template<class MsgDetails, class Derived, class SktT>
constexpr simulator_responses< MsgDetails, Derived, SktT >::msg_details_t::UserName_t jmmcg::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::username {"usr"}
static

The only valid username.

Definition at line 70 of file processing_rules.hpp.


The documentation for this class was generated from the following files: