OpenPit C++ SDK
C++17 SDK for the OpenPit pre-trade risk engine
Loading...
Searching...
No Matches
openpit::param::MonetaryAmount Class Reference

Signed fee-style amount paired with the currency it is denominated in. More...

#include <param.hpp>

Public Member Functions

Fee Amount () const noexcept
 Returns the signed amount.
const std::string & Currency () const noexcept
 Returns the owned currency code.
 MonetaryAmount (Fee amount, std::string currency)
 Builds a monetary amount from a signed amount and currency.
bool operator!= (const MonetaryAmount &other) const
 Reports whether either amount or currency differs.
bool operator== (const MonetaryAmount &other) const
 Reports whether both amount and currency are equal.
OpenPitParamMonetaryAmount Raw () const noexcept
 Rebuilds the native borrowed C view.

Static Public Member Functions

static MonetaryAmount FromRaw (const OpenPitParamMonetaryAmount &raw)
 Adopts a native monetary amount view into owned C++ storage.
static std::optional< MonetaryAmountFromRawOption (const MonetaryAmountOptional &raw)
 Maps a native optional monetary amount to std::optional.
static MonetaryAmountOptional RawOption (const std::optional< MonetaryAmount > &value) noexcept
 Lowers an optional monetary amount to the native optional C payload.

Detailed Description

Signed fee-style amount paired with the currency it is denominated in.

The native runtime carries this as OpenPitParamMonetaryAmount: an exact Fee value plus a borrowed currency string. The C++ wrapper owns the currency string and rebuilds the borrowed C view only inside Raw().

Constructor & Destructor Documentation

◆ MonetaryAmount()

openpit::param::MonetaryAmount::MonetaryAmount ( Fee amount,
std::string currency )
inline

Builds a monetary amount from a signed amount and currency.

Member Function Documentation

◆ Amount()

Fee openpit::param::MonetaryAmount::Amount ( ) const
inlinenodiscardnoexcept

Returns the signed amount.

◆ Currency()

const std::string & openpit::param::MonetaryAmount::Currency ( ) const
inlinenodiscardnoexcept

Returns the owned currency code.

◆ FromRaw()

MonetaryAmount openpit::param::MonetaryAmount::FromRaw ( const OpenPitParamMonetaryAmount & raw)
inlinestaticnodiscard

Adopts a native monetary amount view into owned C++ storage.

◆ FromRawOption()

std::optional< MonetaryAmount > openpit::param::MonetaryAmount::FromRawOption ( const MonetaryAmountOptional & raw)
inlinestaticnodiscard

Maps a native optional monetary amount to std::optional.

◆ operator!=()

bool openpit::param::MonetaryAmount::operator!= ( const MonetaryAmount & other) const
inlinenodiscard

Reports whether either amount or currency differs.

◆ operator==()

bool openpit::param::MonetaryAmount::operator== ( const MonetaryAmount & other) const
inlinenodiscard

Reports whether both amount and currency are equal.

◆ Raw()

OpenPitParamMonetaryAmount openpit::param::MonetaryAmount::Raw ( ) const
inlinenodiscardnoexcept

Rebuilds the native borrowed C view.

◆ RawOption()

MonetaryAmountOptional openpit::param::MonetaryAmount::RawOption ( const std::optional< MonetaryAmount > & value)
inlinestaticnodiscardnoexcept

Lowers an optional monetary amount to the native optional C payload.