OnixS SGX Derivatives Handler for C++  2.17.0.0
Public Types | Public Member Functions | Public Attributes | List of all members
Price Struct Reference

SGX price system representation. More...

Public Types

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

Public Member Functions

 Price ()
 Constructs an uninitialized value of Price.
 
 Price (int priceTicks, unsigned priceDenominator)
 Creates exemplar of Price initializing ticks and denominator.
 
 Price (const Price &other, unsigned newDenominator)
 Converts some Price value to another denominator.
 
bool hasValue () const
 Indicates if price has value (ticks is not equal to 999999999, i.e. 9 nines).
 
template<typename T >
convertTo () const
 Converts Price representation to needed number type. 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 &right) const
 Price comparison.
 
bool operator!= (const Price &right) const
 
bool operator< (const Price &right) const
 
bool operator> (const Price &right) const
 
bool operator<= (const Price &right) const
 
bool operator>= (const Price &right) const
 

Public Attributes

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

Detailed Description

SGX 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>()