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

Signed cash-flow contribution: positive is inflow and negative is outflow. More...

Inheritance diagram for openpit::param::CashFlow:
Collaboration diagram for openpit::param::CashFlow:

Public Member Functions

CashFlow CheckedNeg () const
 Negates the cash flow and throws openpit::Error on overflow. More...
 
- Public Member Functions inherited from openpit::param::detail::ExactValue< CashFlow, detail::CashFlowTraits >
CashFlow CheckedAdd (const CashFlow &other) const
 Adds another value and throws openpit::Error on overflow. More...
 
CashFlow CheckedDivFloat (double divisor) const
 Divides by an imprecise boundary double. More...
 
CashFlow CheckedDivInt (std::int64_t divisor) const
 Divides by a signed integer and throws openpit::Error on failure. More...
 
CashFlow CheckedDivUint (std::uint64_t divisor) const
 Divides by an unsigned integer and throws openpit::Error on failure. More...
 
CashFlow CheckedMulFloat (double scalar) const
 Multiplies by an imprecise boundary double. More...
 
CashFlow CheckedMulInt (std::int64_t scalar) const
 Multiplies by a signed integer and throws openpit::Error on failure. More...
 
CashFlow CheckedMulUint (std::uint64_t scalar) const
 Multiplies by an unsigned integer and throws openpit::Error on failure. More...
 
CashFlow CheckedRemFloat (double divisor) const
 Computes the remainder for an imprecise boundary double divisor. More...
 
CashFlow CheckedRemInt (std::int64_t divisor) const
 Computes the remainder for a signed integer divisor. More...
 
CashFlow CheckedRemUint (std::uint64_t divisor) const
 Computes the remainder for an unsigned integer divisor. More...
 
CashFlow CheckedSubtract (const CashFlow &other) const
 Subtracts another value and throws openpit::Error on failure. More...
 
int Compare (const CashFlow &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 CashFlow &other) const
 
bool operator< (const CashFlow &other) const
 
bool operator<= (const CashFlow &other) const
 
bool operator== (const CashFlow &other) const
 
bool operator> (const CashFlow &other) const
 
bool operator>= (const CashFlow &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 CashFlow FromFee (const Fee &fee)
 Converts a fee contribution to its cash-flow effect. More...
 
static CashFlow FromPnl (const Pnl &pnl)
 Converts a PnL contribution to an equivalent cash flow. More...
 
static CashFlow FromVolumeInflow (const Volume &volume)
 Creates a positive cash inflow from a volume. More...
 
static CashFlow FromVolumeOutflow (const Volume &volume)
 Creates a negative cash outflow from a volume. More...
 
- Static Public Member Functions inherited from openpit::param::detail::ExactValue< CashFlow, detail::CashFlowTraits >
static CashFlow FromDecimal (Decimal value)
 Validates an exact decimal representation. More...
 
static CashFlow FromDecimalRounded (Decimal value, std::uint32_t scale, RoundingStrategy rounding)
 Rounds an exact decimal representation to scale digits. More...
 
static CashFlow FromDouble (double value)
 Creates a value from an imprecise boundary double. More...
 
static CashFlow FromDoubleRounded (double value, std::uint32_t scale, RoundingStrategy rounding)
 Converts and rounds an imprecise boundary double. More...
 
static CashFlow FromInt64 (std::int64_t value)
 Creates a value from a signed integer. More...
 
static CashFlow FromString (std::string_view value)
 Parses an exact decimal string. More...
 
static CashFlow FromStringRounded (std::string_view value, std::uint32_t scale, RoundingStrategy rounding)
 Parses and rounds an exact decimal string to scale digits. More...
 
static CashFlow FromUint64 (std::uint64_t value)
 Creates a value from an unsigned integer. More...
 

Detailed Description

Signed cash-flow contribution: positive is inflow and negative is outflow.

Member Function Documentation

◆ CheckedNeg()

CashFlow openpit::param::CashFlow::CheckedNeg ( ) const
inline

Negates the cash flow and throws openpit::Error on overflow.

◆ FromFee()

CashFlow openpit::param::CashFlow::FromFee ( const Fee fee)
inlinestatic

Converts a fee contribution to its cash-flow effect.

◆ FromPnl()

CashFlow openpit::param::CashFlow::FromPnl ( const Pnl pnl)
inlinestatic

Converts a PnL contribution to an equivalent cash flow.

◆ FromVolumeInflow()

CashFlow openpit::param::CashFlow::FromVolumeInflow ( const Volume volume)
inlinestatic

Creates a positive cash inflow from a volume.

◆ FromVolumeOutflow()

CashFlow openpit::param::CashFlow::FromVolumeOutflow ( const Volume volume)
inlinestatic

Creates a negative cash outflow from a volume.