Improved Javadocs.
This commit is contained in:
parent
45c36389d5
commit
11c449278f
3 changed files with 14 additions and 5 deletions
|
@ -35,9 +35,9 @@ marketPrice(
|
||||||
```
|
```
|
||||||
|
|
||||||
Parameters | Description
|
Parameters | Description
|
||||||
:---------- |:-------------------------------------------------------
|
:---------- |:-------------------------------------------------------------
|
||||||
`base` | The cryptocurrency ticker symbol (BTC, ETH, ETH2, etc.)
|
`base` | The cryptocurrency ticker symbol (`BTC`, `ETH`, `ETH2`, etc.)
|
||||||
`currency` | The fiat currency ISO 4217 code.
|
`currency` | The fiat currency ISO 4217 code. (`USD`, `GBP`, `EUR`, etc.)
|
||||||
`date` | The `LocalDate` for historical price data.
|
`date` | The `LocalDate` for historical price data.
|
||||||
|
|
||||||
A `CryptoPrice` is returned defined as follows:
|
A `CryptoPrice` is returned defined as follows:
|
||||||
|
|
|
@ -41,13 +41,18 @@ import java.io.IOException
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `CryptoPrice` class
|
* A small Kotlin/Java library for retrieving cryptocurrencies current market prices.
|
||||||
|
*
|
||||||
|
* @author [Erik C. Thauvin](https://erik.thauvin.net/)
|
||||||
*/
|
*/
|
||||||
open class CryptoPrice(val base: String, val currency: String, val amount: Double) {
|
open class CryptoPrice(val base: String, val currency: String, val amount: Double) {
|
||||||
companion object {
|
companion object {
|
||||||
// Coinbase API URL
|
// Coinbase API URL
|
||||||
private const val COINBASE_API_URL = "https://api.coinbase.com/v2/"
|
private const val COINBASE_API_URL = "https://api.coinbase.com/v2/"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert JSON data object to [CryptoPrice].
|
||||||
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@Throws(CryptoException::class)
|
@Throws(CryptoException::class)
|
||||||
fun String.toPrice(): CryptoPrice {
|
fun String.toPrice(): CryptoPrice {
|
||||||
|
@ -115,6 +120,10 @@ open class CryptoPrice(val base: String, val currency: String, val amount: Doubl
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the current market price.
|
* Retrieve the current market price.
|
||||||
|
*
|
||||||
|
* @param base The cryptocurrency ticker symbol. (`BTC`, `ETH`, `ETH2`, etc.)
|
||||||
|
* @param currency The fiat currency ISO 4217 code. (`USD`, `GPB`, `EUR`, etc.)
|
||||||
|
* @param date The [LocalDate] for historical price data.
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue