dxFeed Graal CXX API v7.0.0
Loading...
Searching...
No Matches

Classes

struct  AdditionalUnderlyings
 Represents a set of additional underlyings for a given option. More...
 
struct  CFI
 A wrapper class for Classification of Financial Instruments code as defined in ISO 10962 standard. More...
 
struct  PriceIncrements
 Represents rules for valid price quantization for a given instrument on a certain exchange. More...
 

Enumerations

enum class  RoundingMode : std::int32_t {
  RoundingMode::ROUNDING_MODE_UP = 0 , RoundingMode::ROUNDING_MODE_DOWN , RoundingMode::ROUNDING_MODE_CEILING , RoundingMode::ROUNDING_MODE_FLOOR ,
  RoundingMode::ROUNDING_MODE_HALF_UP , RoundingMode::ROUNDING_MODE_HALF_DOWN , RoundingMode::ROUNDING_MODE_HALF_EVEN , RoundingMode::ROUNDING_MODE_UNNECESSARY
}
 Specifies a rounding behavior for numerical operations capable of discarding precision. More...
 

Functions

template<typename MapLikeType>
requires (!std::convertible_to<MapLikeType, StringLike>)
static Ptr AdditionalUnderlyings::valueOf (const MapLikeType &map)
 Returns an instance of additional underlyings for specified internal representation.
 

Detailed Description

Enumeration Type Documentation

◆ RoundingMode

enum class RoundingMode : std::int32_t
strong

Specifies a rounding behavior for numerical operations capable of discarding precision.

Each rounding mode indicates how the least significant returned digit of a rounded result is to be calculated. If fewer digits are returned than the digits needed to represent the exact numerical result, the discarded digits will be referred to as the discarded fraction regardless of the digits' contribution to the value of the number. In other words, considered as a numerical value, the discarded fraction could have an absolute value greater than one.

https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/math/RoundingMode.html

Enumerator
ROUNDING_MODE_UP 

Rounding mode to round away from zero.

Always increments the digit prior to a non-zero discarded fraction. Note that this rounding mode never decreases the magnitude of the calculated value.

Example:

Rounding mode UP Examples
Input NumberInput rounded to one digit
with ROUNDING_MODE_UP rounding
5.5 6
2.5 3
1.6 2
1.1 2
1.0 1
-1.0 -1
-1.1 -2
-1.6 -2
-2.5 -3
-5.5 -6
ROUNDING_MODE_DOWN  

Rounding mode to round towards zero.

Never increments the digit prior to a discarded fraction (i.e., truncates). Note that this rounding mode never increases the magnitude of the calculated value.

Example:

Rounding mode DOWN Examples
Input Number Input rounded to one digit
with ROUNDING_MODE_DOWN rounding
5.5 5
2.5 2
1.6 1
1.1 1
1.0 1
-1.0 -1
-1.1 -1
-1.6 -1
-2.5 -2
-5.5 -5
ROUNDING_MODE_CEILING  

Rounding mode to round towards positive infinity.

If the result is positive, behaves as for ROUNDING_MODE_UP; if negative, behaves as for ROUNDING_MODE_DOWN. Note that this rounding mode never decreases the calculated value.

Example:

Rounding mode CEILING Examples
Input Number Input rounded to one digit
with ROUNDING_MODE_CEILING rounding
5.5 6
2.5 3
1.6 2
1.1 2
1.0 1
-1.0 -1
-1.1 -1
-1.6 -1
-2.5 -2
-5.5 -5
ROUNDING_MODE_FLOOR  

Rounding mode to round towards negative infinity.

If the result is positive, behave as for ROUNDING_MODE_DOWN; if negative, behave as for ROUNDING_MODE_UP. Note that this rounding mode never increases the calculated value.

Example:

Rounding mode FLOOR Examples
Input Number Input rounded to one digit
with ROUNDING_MODE_FLOOR rounding
5.5 5
2.5 2
1.6 1
1.1 1
1.0 1
-1.0 -1
-1.1 -2
-1.6 -2
-2.5 -3
-5.5 -6
ROUNDING_MODE_HALF_UP  

Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round up.

Behaves as for ROUNDING_MODE_UP if the discarded fraction is <= 0.5; otherwise, behaves as for ROUNDING_MODE_DOWN. Note that this is the rounding mode commonly taught at school.

Example:

Rounding mode HALF_UP Examples
Input Number Input rounded to one digit
with ROUNDING_MODE_HALF_UP rounding
5.5 6
2.5 3
1.6 2
1.1 1
1.0 1
-1.0 -1
-1.1 -1
-1.6 -2
-2.5 -3
-5.5 -6
ROUNDING_MODE_HALF_DOWN  

Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round down.

Behaves as for ROUNDING_MODE_UP if the discarded fraction is > 0.5; otherwise, behaves as for ROUNDING_MODE_DOWN.

Example:

Rounding mode HALF_DOWN Examples
Input Number Input rounded to one digit
with ROUNDING_MODE_HALF_DOWN rounding
5.5 5
2.5 2
1.6 2
1.1 1
1.0 1
-1.0 -1
-1.1 -1
-1.6 -2
-2.5 -2
-5.5 -5
ROUNDING_MODE_HALF_EVEN  

Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant, in which case, round towards the even neighbor.

Behaves as for ROUNDING_MODE_HALF_UP if the digit to the left of the discarded fraction is odd; behaves as for ROUNDING_MODE_HALF_DOWN if it's even. Note that this is the rounding mode that statistically minimizes cumulative error when applied repeatedly over a sequence of calculations. It is sometimes known as "Banker's rounding" and is chiefly used in the USA. This rounding mode is analogous to the rounding policy used for float and double arithmetic in Java.

Example:

Rounding mode HALF_EVEN Examples
Input Number Input rounded to one digit
with ROUNDING_MODE_HALF_EVEN rounding
5.5 6
2.5 2
1.6 2
1.1 1
1.0 1
-1.0 -1
-1.1 -1
-1.6 -2
-2.5 -2
-5.5 -6
ROUNDING_MODE_UNNECESSARY  

Rounding mode to assert that the requested operation has an exact result, hence no rounding is necessary.

If this rounding mode is specified on an operation that yields an inexact result, an Java ArithmeticException is thrown.

Example:

Rounding mode UNNECESSARY Examples
Input Number Input rounded to one digit
with ROUNDING_MODE_UNNECESSARY rounding
5.5 throw ArithmeticException
2.5 throw ArithmeticException
1.6 throw ArithmeticException
1.1 throw ArithmeticException
1.0 1
-1.0 -1
-1.1 throw ArithmeticException
-1.6 throw ArithmeticException
-2.5 throw ArithmeticException
-5.5 throw ArithmeticException

Function Documentation

◆ valueOf()

template<typename MapLikeType>
requires (!std::convertible_to<MapLikeType, StringLike>)
AdditionalUnderlyings::Ptr AdditionalUnderlyings::valueOf ( const MapLikeType & map)
static

Returns an instance of additional underlyings for specified internal representation.

See AdditionalUnderlyings::getMap() for details about internal representation.

Template Parameters
MapLikeTypeThe type of map. std::map<K, V>, std::unordered_map<K, V>, QMap<K, V>, std::vector<std::pair<K, V>> etc. excluding the type std::initializer_list<std::pair<K, V>>. Where K is a string-like type and V is a type convertible to double.
Parameters
mapThe map-like container.
Returns
An instance of additional underlyings.
Exceptions
JavaException("IllegalArgumentException")if data contains invalid values.