Currency
Currency is a system and unit of money used to express monetary value, facilitate exchange, and denominate financial amounts.
Learn Go with Pocket-Sized Projects
A currency is a monetary system whose units and denomination rules determine how amounts are represented and valued.
- How it is used
- Identifies source and target monetary units and sets valid amount and conversion-output precision.
- How deep it goes
- Defines a private-field Go value object, implements code parsing and precision cases, and checks amounts; stops short of complete currency-code validation.
- Examples
- Uses EUR and USD CLI flags, a rejected 19.8875 CAD amount, and parser tests for currencies with different precisions.
- What you can do after
- Build it from scratch: parse currency codes, reject amounts with excessive precision, and use target precision when converting.
Read how Learn Go with Pocket-Sized Projects explains currency →
Investing for Programmers
A currency is a medium of exchange issued or recognized by a government or monetary authority and used to denominate value.
- How it is used
- Standardizes mixed-currency holdings so portfolio values, yields, and gains can be summed in one target currency.
- How deep it goes
- Defines currency briefly and works through exchange mapping, conversion, and aggregation, stopping short of detailed foreign-exchange mechanics.
- Examples
- Uses Microsoft and BMW shares, exchange mappings, converted price columns, and a USD portfolio worksheet.
- What you can do after
- Operate/configure a portfolio monitor that converts asset values and aggregates positions in a chosen currency.
Related concepts
- currency conversionused by · Currency conversion is the calculation of an equivalent monetary amount in one currency from an amount in another using an applicable exchange rate.
- account balanceconfigures · An account balance is the recorded amount of money or funds associated with a financial account.
- Stringerimplements · fmt.Stringer is a Go standard-library interface implemented by a type with a parameterless String method returning a textual representation.
- default valueconfigured by · A default value is a predefined or automatically supplied value used when an expected input, argument, field, or configuration setting is omitted or unspecified.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

