OnixS EBS BrokerTec Market Data and Trading Handler for C++  2.14.1.0
Public Types | Public Member Functions | Public Attributes | List of all members
Price Struct Reference

BrokerTec price system representation. More...

Public Types

enum  { NO_PRICE = (int)0x80000000 }
 This value indicates that price in not set.
 

Public Member Functions

 Price ()
 Default constructor.
 
 Price (int priceTicks, unsigned int priceDenominator, PremiumUnit::Enum premiumUnit=PremiumUnit::Price)
 Constructor.
 
 Price (const Price &other, unsigned int newDenominator)
 Converts some Price value to another denominator.
 
bool noPrice () const
 Indicates if price has no value (ticks is equal to 999999999, i.e. 9 nines).
 
template<typename T >
convertTo () const
 Converts Price representation to needed number type. More...
 
void convertToDecimal (int8 &sign, uint64 &mantissaHigh, uint64 &mantissaLow, int32 &exponent) const
 Converts price to decimal. More...
 
 operator float () const
 Implicit conversion to float number type.
 
 operator double () const
 Implicit conversion to double number type.
 
std::string toString () const
 string representation of price
 
bool operator== (const Price &) const
 Price comparison.
 
bool operator!= (const Price &) const
 
bool operator< (const Price &) const
 
bool operator> (const Price &) const
 
bool operator<= (const Price &) const
 
bool operator>= (const Price &) const
 

Public Attributes

int ticks
 Price value in system ticks.
 
unsigned int denominator
 Number of ticks in 1 unit of currency.
 
PremiumUnit::Enum unit
 Price unit.
 

Detailed Description

BrokerTec price system representation.

Member Function Documentation

T convertTo ( ) const
inline

Converts Price representation to needed number type.

Target number type should have accessible constructor from int type, and should have visible operator/.

decimal price = exchangePrice.convertTo<decimal>()
void convertToDecimal ( int8 &  sign,
uint64 &  mantissaHigh,
uint64 &  mantissaLow,
int32 &  exponent 
) const

Converts price to decimal.

Parameters
signis a sign of the price (usually 0)
mantissaHighis a high part of 128 bit mantissa
mantissaLowis a low part of 128 bit mantissa
exponentis an exponent with basis 10