Money Class Reference

### A free/open-source library for quantitative finance

Related Functions
Money Class Reference

amount of cash More...

`#include <ql/money.hpp>`

List of all members.

## Public Member Functions
Constructors
| Money ()
| Money (const Currency &currency, Decimal value)
| Money (Decimal value, const Currency &currency)
Inspectors
const Currency & | currency () const
Decimal | value () const
Money | rounded () const
Money arithmetics
See below for non-member functions and for settings which determine the behavior of the operators.
Money | operator+ () const
Money | operator- () const
Money & | operator+= (const Money &)
Money & | operator-= (const Money &)
Money & | operator*= (Decimal)
Money & | operator/= (Decimal)
## Related Functions
(Note that these are not member functions.)
Money | operator+ (const Money &, const Money &)
Money | operator- (const Money &, const Money &)
Money | operator* (const Money &, Decimal)
Money | operator* (Decimal, const Money &)
Money | operator/ (const Money &, Decimal)
Decimal | operator/ (const Money &, const Money &)
bool | operator== (const Money &, const Money &)
bool | operator!= (const Money &, const Money &)
bool | operator< (const Money &, const Money &)
bool | operator<= (const Money &, const Money &)
bool | operator> (const Money &, const Money &)
bool | operator>= (const Money &, const Money &)
bool | close (const Money &, const Money &, Size n=42)
bool | close_enough (const Money &, const Money &, Size n=42)
Money | operator* (Decimal, const Currency &)
Money | operator* (const Currency &, Decimal)
std::ostream & | operator<< (std::ostream &, const Money &)
## Conversion settings
These parameters are used for combining money amounts in different currencies
enum | ConversionType { NoConversion, BaseCurrencyConversion, AutomatedConversion }
static ConversionType | conversionType
static Currency | baseCurrency

## Detailed Description

amount of cash

Tests:
  money arithmetic is tested with and without currency conversions.

## Member Enumeration Documentation

enum ConversionType

Enumerator:

  NoConversion | do not perform conversions
  BaseCurrencyConversion | convert both operands to the base currency before converting
  AutomatedConversion | return the result in the currency of the first operand

## Friends And Related Function Documentation

Money operator+ | ( | const Money & | ,
|  | const Money & |
| ) |  | `[related]`

Money operator- | ( | const Money & | ,
|  | const Money & |
| ) |  | `[related]`

Money operator* | ( | const Money & | ,
|  | Decimal |
| ) |  | `[related]`

Money operator* | ( | Decimal | ,
|  | const Money & |
| ) |  | `[related]`

Money operator/ | ( | const Money & | ,
|  | Decimal |
| ) |  | `[related]`

Decimal operator/ | ( | const Money & | ,
|  | const Money & |
| ) |  | `[related]`

bool operator== | ( | const Money & | ,
|  | const Money & |
| ) |  | `[related]`

bool operator!= | ( | const Money & | ,
|  | const Money & |
| ) |  | `[related]`

bool operator< | ( | const Money & | ,
|  | const Money & |
| ) |  | `[related]`

bool operator<= | ( | const Money & | ,
|  | const Money & |
| ) |  | `[related]`

bool operator> | ( | const Money & | ,
|  | const Money & |
| ) |  | `[related]`

bool operator>= | ( | const Money & | ,
|  | const Money & |
| ) |  | `[related]`

bool close | ( | const Money & | ,
|  | const Money & | ,
|  | Size | n = `42`
| ) |  | `[related]`

bool close_enough | ( | const Money & | ,
|  | const Money & | ,
|  | Size | n = `42`
| ) |  | `[related]`

Money operator* | ( | Decimal | ,
|  | const Currency & |
| ) |  | `[related]`

Money operator* | ( | const Currency & | ,
|  | Decimal |
| ) |  | `[related]`

std::ostream & operator<< | ( | std::ostream & | ,
|  | const Money & |
| ) |  | `[related]`