Changed marketPrice to spotPrice.

Using BigDecimal instead of Double.
This commit is contained in:
Erik C. Thauvin 2021-05-26 03:11:55 -07:00
parent 07a7198455
commit f252c1602b
7 changed files with 51 additions and 48 deletions

View file

@ -1,22 +1,22 @@
package com.example
import net.thauvin.erik.crypto.CryptoPrice.Companion.apiCall
import net.thauvin.erik.crypto.CryptoPrice.Companion.marketPrice
import net.thauvin.erik.crypto.CryptoPrice.Companion.spotPrice
import net.thauvin.erik.crypto.CryptoPrice.Companion.toPrice
fun main(@Suppress("UNUSED_PARAMETER") args: Array<String>) {
// Get current Bitcoin market price.
val price = marketPrice("BTC")
// Get current Bitcoin spot price.
val price = spotPrice("BTC")
println("The current Bitcoin price is ${price.toCurrency()}")
// Get current Bitcoin market price in Euro.
val euroPrice = marketPrice("BTC", "EUR")
// Get current Bitcoin spot price in Euro.
val euroPrice = spotPrice("BTC", "EUR")
println("The current Bitcoin price is ${euroPrice.toCurrency()}")
println()
// Get current Ethereum market price in Pound sterling.
val gbpPrice = marketPrice("ETH", "GBP")
// Get current Ethereum spot price in Pound sterling.
val gbpPrice = spotPrice("ETH", "GBP")
println("The current Ehtereum price is ${gbpPrice.toCurrency()}")
println()