|
OpenPit C++ SDK
C++17 SDK for the OpenPit pre-trade risk engine
|
Signed position quantity: positive is long and negative is short. More...


Public Member Functions | |
| PositionSize | CheckedAddQuantity (const Quantity &quantity, Side side) const |
Applies a directed quantity and throws openpit::Error on failure. More... | |
| PositionSize | CheckedNeg () const |
Negates the position size and throws openpit::Error on overflow. More... | |
| std::pair< Quantity, std::optional< Side > > | CloseQuantity () const |
| Returns the absolute closing quantity and optional direction. More... | |
| std::pair< Quantity, Side > | OpenQuantity () const |
| Returns the absolute opening quantity and its direction. More... | |
Public Member Functions inherited from openpit::param::detail::ExactValue< PositionSize, detail::PositionSizeTraits > | |
| PositionSize | CheckedAdd (const PositionSize &other) const |
Adds another value and throws openpit::Error on overflow. More... | |
| PositionSize | CheckedDivFloat (double divisor) const |
Divides by an imprecise boundary double. More... | |
| PositionSize | CheckedDivInt (std::int64_t divisor) const |
Divides by a signed integer and throws openpit::Error on failure. More... | |
| PositionSize | CheckedDivUint (std::uint64_t divisor) const |
Divides by an unsigned integer and throws openpit::Error on failure. More... | |
| PositionSize | CheckedMulFloat (double scalar) const |
Multiplies by an imprecise boundary double. More... | |
| PositionSize | CheckedMulInt (std::int64_t scalar) const |
Multiplies by a signed integer and throws openpit::Error on failure. More... | |
| PositionSize | CheckedMulUint (std::uint64_t scalar) const |
Multiplies by an unsigned integer and throws openpit::Error on failure. More... | |
| PositionSize | CheckedRemFloat (double divisor) const |
Computes the remainder for an imprecise boundary double divisor. More... | |
| PositionSize | CheckedRemInt (std::int64_t divisor) const |
| Computes the remainder for a signed integer divisor. More... | |
| PositionSize | CheckedRemUint (std::uint64_t divisor) const |
| Computes the remainder for an unsigned integer divisor. More... | |
| PositionSize | CheckedSubtract (const PositionSize &other) const |
Subtracts another value and throws openpit::Error on failure. More... | |
| int | Compare (const PositionSize &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 PositionSize &other) const |
| bool | operator< (const PositionSize &other) const |
| bool | operator<= (const PositionSize &other) const |
| bool | operator== (const PositionSize &other) const |
| bool | operator> (const PositionSize &other) const |
| bool | operator>= (const PositionSize &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 PositionSize | FromFee (const Fee &fee) |
| Converts a fee contribution to its position-size effect. More... | |
| static PositionSize | FromPnl (const Pnl &pnl) |
| Converts a PnL contribution to an equivalent position size. More... | |
| static PositionSize | FromQuantityAndSide (const Quantity &quantity, Side side) |
| Creates a signed position size from quantity and direction. More... | |
Static Public Member Functions inherited from openpit::param::detail::ExactValue< PositionSize, detail::PositionSizeTraits > | |
| static PositionSize | FromDecimal (Decimal value) |
| Validates an exact decimal representation. More... | |
| static PositionSize | FromDecimalRounded (Decimal value, std::uint32_t scale, RoundingStrategy rounding) |
Rounds an exact decimal representation to scale digits. More... | |
| static PositionSize | FromDouble (double value) |
Creates a value from an imprecise boundary double. More... | |
| static PositionSize | FromDoubleRounded (double value, std::uint32_t scale, RoundingStrategy rounding) |
Converts and rounds an imprecise boundary double. More... | |
| static PositionSize | FromInt64 (std::int64_t value) |
| Creates a value from a signed integer. More... | |
| static PositionSize | FromString (std::string_view value) |
| Parses an exact decimal string. More... | |
| static PositionSize | FromStringRounded (std::string_view value, std::uint32_t scale, RoundingStrategy rounding) |
Parses and rounds an exact decimal string to scale digits. More... | |
| static PositionSize | FromUint64 (std::uint64_t value) |
| Creates a value from an unsigned integer. More... | |
Signed position quantity: positive is long and negative is short.
|
inline |
Applies a directed quantity and throws openpit::Error on failure.
|
inline |
Negates the position size and throws openpit::Error on overflow.
|
inline |
Returns the absolute closing quantity and optional direction.
|
inlinestatic |
Converts a fee contribution to its position-size effect.
|
inlinestatic |
Converts a PnL contribution to an equivalent position size.
|
inlinestatic |
Creates a signed position size from quantity and direction.