JayBeams  0.1
Another project to have fun coding.
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | List of all members
jb::itch5::price_field< wire_type_t, denom_v > Class Template Reference

Define a class used to represent prices in the ITCH-5.0 feed. More...

#include <price_field.hpp>

Inheritance diagram for jb::itch5::price_field< wire_type_t, denom_v >:

Public Types

typedef wire_type_t wire_type
 The wire type. More...
 
typedef std::ratio< 1, denomtick
 The minimum quotation tick for this price. More...
 

Public Member Functions

 price_field ()
 Default constructor. More...
 
 price_field (wire_type rhs)
 Constructor from a price. More...
 
price_fieldoperator= (wire_type rhs)
 Assignment from. More...
 
price_fieldoperator+= (price_field const &rhs)
 Addition assignment operator. More...
 
Accessors
double as_double () const
 
wire_type as_integer () const
 
bool operator== (price_field const &rhs) const
 Base comparison operators. More...
 
bool operator< (price_field const &rhs) const
 

Static Public Member Functions

static price_field dollar_price ()
 

Static Public Attributes

static constexpr std::intmax_t denom = denom_v
 The denominator. More...
 
static constexpr int denom_digits = static_digits(denom)
 The number of digits in the denominator. More...
 

Private Attributes

wire_type value_
 The value as an integer. More...
 

Detailed Description

template<typename wire_type_t, std::intmax_t denom_v>
class jb::itch5::price_field< wire_type_t, denom_v >

Define a class used to represent prices in the ITCH-5.0 feed.

The ITCH-5.0 protocol represent prices as fixed-point values. The number of decimal digits is specified in the field definition. For example, a Price(4) field represents prices with 4 decimal digits, i.e., of the 99999.9999 form. On the wire the number is actually stored as an integer. For example, the price 150.0100 would be stored on the wire as 1500100.

Template Parameters
wire_typean integer type, typically std::uint32_t for 4-byte wide fields, or std::uint64_t for 8-byte wide fields.
denomthe denominator for this field, for example Price(4) would use denom==10000, while Price(8) would use 100000000.

Definition at line 34 of file price_field.hpp.

Member Typedef Documentation

◆ tick

template<typename wire_type_t, std::intmax_t denom_v>
typedef std::ratio<1, denom> jb::itch5::price_field< wire_type_t, denom_v >::tick

The minimum quotation tick for this price.

Definition at line 48 of file price_field.hpp.

◆ wire_type

template<typename wire_type_t, std::intmax_t denom_v>
typedef wire_type_t jb::itch5::price_field< wire_type_t, denom_v >::wire_type

The wire type.

Definition at line 39 of file price_field.hpp.

Constructor & Destructor Documentation

◆ price_field() [1/2]

template<typename wire_type_t, std::intmax_t denom_v>
jb::itch5::price_field< wire_type_t, denom_v >::price_field ( )
inline

◆ price_field() [2/2]

template<typename wire_type_t, std::intmax_t denom_v>
jb::itch5::price_field< wire_type_t, denom_v >::price_field ( wire_type  rhs)
inlineexplicit

Constructor from a price.

Definition at line 56 of file price_field.hpp.

Member Function Documentation

◆ as_double()

template<typename wire_type_t, std::intmax_t denom_v>
double jb::itch5::price_field< wire_type_t, denom_v >::as_double ( ) const
inline

Definition at line 76 of file price_field.hpp.

◆ as_integer()

template<typename wire_type_t, std::intmax_t denom_v>
wire_type jb::itch5::price_field< wire_type_t, denom_v >::as_integer ( ) const
inline

Definition at line 80 of file price_field.hpp.

◆ dollar_price()

template<typename wire_type_t, std::intmax_t denom_v>
static price_field jb::itch5::price_field< wire_type_t, denom_v >::dollar_price ( )
inlinestatic

Definition at line 99 of file price_field.hpp.

◆ operator+=()

template<typename wire_type_t, std::intmax_t denom_v>
price_field& jb::itch5::price_field< wire_type_t, denom_v >::operator+= ( price_field< wire_type_t, denom_v > const &  rhs)
inline

Addition assignment operator.

Definition at line 67 of file price_field.hpp.

◆ operator<()

template<typename wire_type_t, std::intmax_t denom_v>
bool jb::itch5::price_field< wire_type_t, denom_v >::operator< ( price_field< wire_type_t, denom_v > const &  rhs) const
inline

Definition at line 93 of file price_field.hpp.

◆ operator=()

template<typename wire_type_t, std::intmax_t denom_v>
price_field& jb::itch5::price_field< wire_type_t, denom_v >::operator= ( wire_type  rhs)
inline

Assignment from.

Definition at line 61 of file price_field.hpp.

◆ operator==()

template<typename wire_type_t, std::intmax_t denom_v>
bool jb::itch5::price_field< wire_type_t, denom_v >::operator== ( price_field< wire_type_t, denom_v > const &  rhs) const
inline

Base comparison operators.

Definition at line 89 of file price_field.hpp.

Member Data Documentation

◆ denom

template<typename wire_type_t, std::intmax_t denom_v>
constexpr std::intmax_t jb::itch5::price_field< wire_type_t, denom_v >::denom = denom_v
static

◆ denom_digits

template<typename wire_type_t, std::intmax_t denom_v>
constexpr int jb::itch5::price_field< wire_type_t, denom_v >::denom_digits = static_digits(denom)
static

The number of digits in the denominator.

Definition at line 45 of file price_field.hpp.

◆ value_

template<typename wire_type_t, std::intmax_t denom_v>
wire_type jb::itch5::price_field< wire_type_t, denom_v >::value_
private

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