Added toCurrency
This commit is contained in:
parent
94193e34ed
commit
2590fe67b8
4 changed files with 33 additions and 1 deletions
|
@ -47,6 +47,12 @@ CryptoPrice(val base: String, val currency: String, val amount: Double)
|
|||
```
|
||||
The parameter names match the [Coinbase API](https://developers.coinbase.com/api/v2#get-spot-price).
|
||||
|
||||
To display the amount as a fomatted currency use the `toCurrency` function:
|
||||
|
||||
```kotlin
|
||||
val price = CryptoPrice("BTC", "EUR", 12345.67)
|
||||
println(price.toCurrency()) // will print €12,345.67
|
||||
```
|
||||
### Extending
|
||||
|
||||
A generic `apiCall()` function is available to access other [API data endpoints](https://developers.coinbase.com/api/v2#data-endpoints). For example to retried the current [buy price](https://developers.coinbase.com/api/v2#get-buy-price) of a cryptocurrency:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue