{"repo":"naughtygopher/currency","free":true,"listed":false,"github":"https://github.com/naughtygopher/currency","clone":"git clone https://github.com/naughtygopher/currency.git","description":"A currency computations package.","language":"Go","stars":62,"topics":["go-library","currency","go-package","currency-computations","finance","currency-api","currency-format","golang-package","golang-module","awesome-go"],"license":"MIT","category":"trading","readme_excerpt":"Currency v2.0.1 Currency package helps you do currency computations accurately. Currency struct holds all the data required to define a currency. New(main int, fractional int, code, symbol string, funame string, fushare uint) New returns a pointer of currency instance created based on the configuration. IMPORTANT! Fractional unit can be negative only when the main value is 0. If the main value is not 0, fractional unit's negative sign is ignored. Parsers & convenience methods 1. NewFractional(fractional int, symbol string, fulabel string, fushare uint) returns a currency struct instance, given a currency's total value represented by the fractional unit 2. ParseString(value string, code, symbol string, fulabel string, fushare uint) returns a currency struct instance, given a currency value represented as string 3. ParseFloat64(value float64, code, symbol string, funame string, fushare uint) returns a currency struct instance, given a currency value represented in float64 Computational methods IMPORTANT: Computation is supported only between same type of currencies (i.e. currency codes must match) 1. c1.Add(c2 currency) add c2 to c1, and update c1 2. c1.AddInt(main int, fractional int) add the currency equivalent of the main & fractional int to c1 3. c1.Subtract(c2 currency) subtract c2 from c1, and update c1 4. c1.SubtractIn(main int, fractional int) subtract the currency equivalent of the main & fractional int from c1 5. c1.Multiply(n int) multiply c1 by n, where n is an inte","default_branch":null,"files":null,"tree":[],"storefront":"/r/naughtygopher","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/naughtygopher/currency/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}