|
ITCH 5.0 Market Data Handler 1.0.0
NASDAQ ITCH 5.0 Market Data Feed Handler
|
Internal utility functions for financial data conversion. More...
Internal utility functions for financial data conversion.
These functions handle conversion between human-readable values and fixed-point internal representations. Not intended for direct use; use wrapper functions in the public API instead.
Functions | |
| std::int64_t | to_sbe_price_mantissa (std::int64_t val, std::int64_t mult=constants::SBE_PRICE_MULTIPLIER) noexcept |
| Convert value to SBE price mantissa (fixed-point representation). | |
| std::int64_t | to_sbe_qty_mantissa (std::int64_t val, std::int64_t mult=constants::SBE_QTY_MULTIPLIER) noexcept |
| Convert value to SBE quantity mantissa (fixed-point representation). | |
| constexpr std::uint16_t | num_price_decimals (std::uint64_t multiplier) |
| Calculate number of decimal places in a multiplier. | |
| constexpr bool | validate_num_price_decimals (std::uint16_t num_decimals) |
| Validate that number of decimals is within supported range. | |
| constexpr std::uint64_t | calculate_multiplier (std::uint16_t num_of_decimals) |
| Calculate multiplier for a given number of decimal places. | |
|
inlineconstexpr |
Calculate multiplier for a given number of decimal places.
Recursively computes 10^num_of_decimals to get the appropriate multiplier. For example, 3 decimals requires a multiplier of 1000.
| num_of_decimals | Number of decimal places needed |
References calculate_multiplier().
Referenced by calculate_multiplier().
|
inlineconstexpr |
Calculate number of decimal places in a multiplier.
Recursively determines how many decimal places a multiplier represents. For example, 1000 represents 3 decimal places, 1000000 represents 6.
| multiplier | Multiplier value (must be power of 10) |
References num_price_decimals().
Referenced by b2bits::nasdaq::calculate_ratio(), num_price_decimals(), and validate_num_price_decimals().
|
inlinenoexcept |
Convert value to SBE price mantissa (fixed-point representation).
Multiplies the value by the price multiplier to create a fixed-point representation suitable for SBE encoding. This avoids floating-point precision issues in financial calculations.
| val | Value to convert (e.g., price as integer or scaled value) |
| mult | Multiplier to apply (default: SBE_PRICE_MULTIPLIER = 1e9) |
References b2bits::constants::SBE_PRICE_MULTIPLIER.
|
inlinenoexcept |
Convert value to SBE quantity mantissa (fixed-point representation).
Multiplies the value by the quantity multiplier to create a fixed-point representation suitable for SBE encoding. Used for contract quantities.
| val | Value to convert (e.g., quantity as integer) |
| mult | Multiplier to apply (default: SBE_QTY_MULTIPLIER = 100) |
References b2bits::constants::SBE_QTY_MULTIPLIER.
|
inlineconstexpr |
Validate that number of decimals is within supported range.
Checks if the requested number of decimal places is less than or equal to the maximum supported by SBE_PRICE_MULTIPLIER (9 decimals).
| num_decimals | Number of decimal places to validate |
References num_price_decimals(), and b2bits::constants::SBE_PRICE_MULTIPLIER.
Referenced by b2bits::nasdaq::calculate_ratio().