libjmmcg  build_2783
A C++ library containing an eclectic mix of useful, advanced components.
isimud::exchanges::common::simulator_responses< MsgDetails, Derived, SktT > Class Template Referenceabstract

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

#include <processing_rules.hpp>

Inheritance diagram for isimud::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >:
[legend]
Collaboration diagram for isimud::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 src_msg_details_t = msg_details_t
 
using socket_t = typename base_t::socket_t
 
using derived_t = typename base_t::derived_t
 
using Price_t = typename std::conditional< std::is_integral< typename msg_details_t::Price_t >::value, typename msg_details_t::Price_t, std::uint64_t >::type
 
- Public Types inherited from isimud::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

virtual bool process_msg (typename src_msg_details_t::msg_buffer_t const &buff, socket_t &exchg_skt, socket_t &client_skt) override=0
 
std::string to_string () const 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 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 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 Member Functions

 simulator_responses ()=default
 
 simulator_responses (simulator_responses const &)=default
 
- Protected Member Functions inherited from isimud::exchanges::common::message_responses< MsgDetails, MsgDetails, Derived, MsgDetails::client_to_exchange_messages_t, SktT >
virtual bool process_msg (typename src_msg_details_t::msg_buffer_t const &buff, socket_t &exchg_skt, socket_t &client_skt)=0
 

Protected Attributes

order_book_t order_book
 
std::int32_t sequenceNumber {}
 

Detailed Description

template<class MsgDetails, class Derived, class SktT>
class isimud::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 240 of file processing_rules.hpp.

Member Typedef Documentation

◆ base_t

template<class MsgDetails, class Derived, class SktT>
using isimud::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 242 of file processing_rules.hpp.

◆ derived_t

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

Definition at line 246 of file processing_rules.hpp.

◆ msg_details_t

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

Definition at line 243 of file processing_rules.hpp.

◆ order_book_t

template<class MsgDetails, class Derived, class SktT>
using isimud::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 276 of file processing_rules.hpp.

◆ Price_t

template<class MsgDetails, class Derived, class SktT>
using isimud::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::Price_t = typename std::conditional<std::is_integral<typename msg_details_t::Price_t>::value, typename msg_details_t::Price_t, std::uint64_t>::type

Definition at line 250 of file processing_rules.hpp.

◆ socket_t

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

Definition at line 245 of file processing_rules.hpp.

◆ src_msg_details_t

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

Definition at line 244 of file processing_rules.hpp.

Constructor & Destructor Documentation

◆ simulator_responses() [1/2]

template<class MsgDetails, class Derived, class SktT>
isimud::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::simulator_responses ( )
protecteddefault

◆ simulator_responses() [2/2]

template<class MsgDetails, class Derived, class SktT>
isimud::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::simulator_responses ( simulator_responses< MsgDetails, Derived, SktT > const &  )
protecteddefault

Member Function Documentation

◆ process_msg()

template<class MsgDetails, class Derived, class SktT>
virtual bool isimud::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::process_msg ( typename src_msg_details_t::msg_buffer_t const &  buff,
socket_t exchg_skt,
socket_t client_skt 
)
overridepure virtual
Returns
False to continue processing messages, true otherwise.

◆ to_string()

template<class MsgDetails , class Derived , class SktT >
std::string isimud::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::to_string ( ) const
inlinenoexcept

Definition at line 74 of file processing_rules_impl.hpp.

Member Data Documentation

◆ new_password

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

The only valid new password.

Definition at line 257 of file processing_rules.hpp.

◆ order_book

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

Definition at line 277 of file processing_rules.hpp.

◆ password

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

The only valid password.

Definition at line 255 of file processing_rules.hpp.

◆ price

template<class MsgDetails, class Derived, class SktT>
constexpr Price_t isimud::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::price =42
inlinestaticconstexpr

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 264 of file processing_rules.hpp.

◆ quantity_limit

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

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 262 of file processing_rules.hpp.

◆ scaled_price

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

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 266 of file processing_rules.hpp.

◆ sequenceNumber

template<class MsgDetails, class Derived, class SktT>
std::int32_t isimud::exchanges::common::simulator_responses< MsgDetails, Derived, SktT >::sequenceNumber {}
protected

Definition at line 278 of file processing_rules.hpp.

◆ username

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

The only valid username.

Definition at line 253 of file processing_rules.hpp.


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