QuantLib: Currency Class Reference

A free/open-source library for quantitative finance Reference manual - version 1.12

Public Member Functions | Protected Attributes | Related Functions | List of all members
Currency Class Reference

Currency specification More...

`#include <ql/currency.hpp>`

Inherited by ARSCurrency, ATSCurrency, AUDCurrency, BCHCurrency, BDTCurrency, BEFCurrency, BGLCurrency, BRLCurrency, BTCCurrency, BYRCurrency, CADCurrency, CHFCurrency, CLPCurrency, CNYCurrency, COPCurrency, CYPCurrency, CZKCurrency, DASHCurrency, DEMCurrency, DKKCurrency, EEKCurrency, ESPCurrency, ETCCurrency, ETHCurrency, EURCurrency, FIMCurrency, FRFCurrency, GBPCurrency, GRDCurrency, HKDCurrency, HUFCurrency, IDRCurrency, IEPCurrency, ILSCurrency, INRCurrency, IQDCurrency, IRRCurrency, ISKCurrency, ITLCurrency, JPYCurrency, KRWCurrency, KWDCurrency, LTCCurrency, LTLCurrency, LUFCurrency, LVLCurrency, MTLCurrency, MXNCurrency, MYRCurrency, NLGCurrency, NOKCurrency, NPRCurrency, NZDCurrency, PEHCurrency, PEICurrency, PENCurrency, PKRCurrency, PLNCurrency, PTECurrency, ROLCurrency, RONCurrency, RUBCurrency, SARCurrency, SEKCurrency, SGDCurrency, SITCurrency, SKKCurrency, THBCurrency, TRLCurrency, TRYCurrency, TTDCurrency, TWDCurrency, UAHCurrency, USDCurrency, VEBCurrency, VNDCurrency, XRPCurrency, ZARCurrency, and ZECCurrency.

## Public Member Functions
| Currency ()
| default constructor More...
Inspectors
const std::string & | name () const
| currency name, e.g, "U.S. Dollar"
const std::string & | code () const
| ISO 4217 three-letter code, e.g, "USD".
Integer | numericCode () const
| ISO 4217 numeric code, e.g, "840".
const std::string & | symbol () const
| symbol, e.g, "$"
const std::string & | fractionSymbol () const
| fraction symbol, e.g, "¢"
Integer | fractionsPerUnit () const
| number of fractionary parts in a unit, e.g, 100
const Rounding & | rounding () const
| rounding convention
std::string | format () const
| output format More...
Other information
bool | empty () const
| is this a usable instance?
const Currency & | triangulationCurrency () const
| currency used for triangulated exchange when required

## Protected Attributes
boost::shared_ptr< Data > | data_

## Related Functions
(Note that these are not member functions.)
bool | operator== (const Currency &, const Currency &)
bool | operator!= (const Currency &, const Currency &)
std::ostream & | operator<< (std::ostream &, const Currency &)

## Detailed Description

Currency specification

## Constructor & Destructor Documentation

## ◆ Currency()

Currency | ( |  | ) |

default constructor

Instances built via this constructor have undefined behavior. Such instances can only act as placeholders and must be reassigned to a valid currency before being used.

## Member Function Documentation

## ◆ format()

std::string format | ( |  | ) | const

output format

The format will be fed three positional parameters, namely, value, code, and symbol, in this order.

## Friends And Related Function Documentation

## ◆ operator==()

bool operator== | ( | const Currency & | ,
|  | const Currency & |
| ) |  |
| related

## ◆ operator!=()

bool operator!= | ( | const Currency & | ,
|  | const Currency & |
| ) |  |
| related

## ◆ operator<<()

std::ostream & operator<< | ( | std::ostream & | ,
|  | const Currency & |
| ) |  |
| related