OpenPit C++ SDK
C++17 SDK for the OpenPit pre-trade risk engine
openpit::param::Volume Class Referencefinal

Non-negative settlement volume. More...

Inheritance diagram for openpit::param::Volume:
Collaboration diagram for openpit::param::Volume:

Public Member Functions

Quantity CalculateQuantity (const Price &price) const
 Calculates quantity at a price. More...
 
CashFlow ToCashFlowInflow () const
 Converts the volume to a positive cash inflow. More...
 
CashFlow ToCashFlowOutflow () const
 Converts the volume to a negative cash outflow. More...
 
Notional ToNotional () const
 Converts the volume to equivalent notional exposure. More...
 
PositionSize ToPositionSize () const
 Converts the volume to a positive position size. More...
 
- Public Member Functions inherited from openpit::param::detail::ExactValue< Volume, detail::VolumeTraits >
Volume CheckedAdd (const Volume &other) const
 Adds another value and throws openpit::Error on overflow. More...
 
Volume CheckedDivFloat (double divisor) const
 Divides by an imprecise boundary double. More...
 
Volume CheckedDivInt (std::int64_t divisor) const
 Divides by a signed integer and throws openpit::Error on failure. More...
 
Volume CheckedDivUint (std::uint64_t divisor) const
 Divides by an unsigned integer and throws openpit::Error on failure. More...
 
Volume CheckedMulFloat (double scalar) const
 Multiplies by an imprecise boundary double. More...
 
Volume CheckedMulInt (std::int64_t scalar) const
 Multiplies by a signed integer and throws openpit::Error on failure. More...
 
Volume CheckedMulUint (std::uint64_t scalar) const
 Multiplies by an unsigned integer and throws openpit::Error on failure. More...
 
Volume CheckedRemFloat (double divisor) const
 Computes the remainder for an imprecise boundary double divisor. More...
 
Volume CheckedRemInt (std::int64_t divisor) const
 Computes the remainder for a signed integer divisor. More...
 
Volume CheckedRemUint (std::uint64_t divisor) const
 Computes the remainder for an unsigned integer divisor. More...
 
Volume CheckedSubtract (const Volume &other) const
 Subtracts another value and throws openpit::Error on failure. More...
 
int Compare (const Volume &other) const
 Compares this value with another value of the same domain type. More...
 
::openpit::param::Decimal Decimal () const noexcept
 Returns the lossless decimal representation. More...
 
bool IsZero () const
 Returns whether the value is exactly zero. More...
 
bool operator!= (const Volume &other) const
 
bool operator< (const Volume &other) const
 
bool operator<= (const Volume &other) const
 
bool operator== (const Volume &other) const
 
bool operator> (const Volume &other) const
 
bool operator>= (const Volume &other) const
 
double ToDouble () const
 Converts to an imprecise boundary double. More...
 
std::string ToString () const
 Formats the exact value as a decimal string. More...
 

Static Public Member Functions

static Volume FromNotional (const Notional &notional)
 Creates volume from equivalent notional exposure. More...
 
- Static Public Member Functions inherited from openpit::param::detail::ExactValue< Volume, detail::VolumeTraits >
static Volume FromDecimal (Decimal value)
 Validates an exact decimal representation. More...
 
static Volume FromDecimalRounded (Decimal value, std::uint32_t scale, RoundingStrategy rounding)
 Rounds an exact decimal representation to scale digits. More...
 
static Volume FromDouble (double value)
 Creates a value from an imprecise boundary double. More...
 
static Volume FromDoubleRounded (double value, std::uint32_t scale, RoundingStrategy rounding)
 Converts and rounds an imprecise boundary double. More...
 
static Volume FromInt64 (std::int64_t value)
 Creates a value from a signed integer. More...
 
static Volume FromString (std::string_view value)
 Parses an exact decimal string. More...
 
static Volume FromStringRounded (std::string_view value, std::uint32_t scale, RoundingStrategy rounding)
 Parses and rounds an exact decimal string to scale digits. More...
 
static Volume FromUint64 (std::uint64_t value)
 Creates a value from an unsigned integer. More...
 

Detailed Description

Non-negative settlement volume.

Member Function Documentation

◆ CalculateQuantity()

Quantity openpit::param::Volume::CalculateQuantity ( const Price price) const
inline

Calculates quantity at a price.

◆ FromNotional()

Volume openpit::param::Volume::FromNotional ( const Notional notional)
inlinestatic

Creates volume from equivalent notional exposure.

◆ ToCashFlowInflow()

CashFlow openpit::param::Volume::ToCashFlowInflow ( ) const
inline

Converts the volume to a positive cash inflow.

◆ ToCashFlowOutflow()

CashFlow openpit::param::Volume::ToCashFlowOutflow ( ) const
inline

Converts the volume to a negative cash outflow.

◆ ToNotional()

Notional openpit::param::Volume::ToNotional ( ) const
inline

Converts the volume to equivalent notional exposure.

◆ ToPositionSize()

PositionSize openpit::param::Volume::ToPositionSize ( ) const
inline

Converts the volume to a positive position size.