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

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

Public Member Functions

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

Static Public Member Functions

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

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,
Asset  currency 
)
inline

Builds a monetary amount from a signed amount and currency.

Member Function Documentation

◆ Amount()

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

Returns the signed amount.

◆ Currency()

const Asset& openpit::param::MonetaryAmount::Currency ( ) const
inlinenoexcept

Returns the owned currency code.

◆ FromRaw()

static MonetaryAmount openpit::param::MonetaryAmount::FromRaw ( const OpenPitParamMonetaryAmount &  raw)
inlinestatic

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

◆ FromRawOption()

static std::optional<MonetaryAmount> openpit::param::MonetaryAmount::FromRawOption ( const MonetaryAmountOptional raw)
inlinestatic

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

◆ operator!=()

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

Reports whether either amount or currency differs.

◆ operator==()

bool openpit::param::MonetaryAmount::operator== ( const MonetaryAmount other) const
inline

Reports whether both amount and currency are equal.

◆ Raw()

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

Rebuilds the native borrowed C view.

◆ RawOption()

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

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