Changed marketPrice to spotPrice.
Using BigDecimal instead of Double.
This commit is contained in:
parent
07a7198455
commit
f252c1602b
7 changed files with 51 additions and 48 deletions
|
@ -10,18 +10,18 @@ import java.util.List;
|
|||
public class CryptoPriceSample {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
// Get current Bitcoin market price.
|
||||
final CryptoPrice price = CryptoPrice.marketPrice("BTC");
|
||||
// Get current Bitcoin spot price.
|
||||
final CryptoPrice price = CryptoPrice.spotPrice("BTC");
|
||||
System.out.println("The current Bitcoin price is " + price.toCurrency());
|
||||
|
||||
// Get current Bitcoin market price in Euros.
|
||||
final CryptoPrice euroPrice = CryptoPrice.marketPrice("BTC", "EUR");
|
||||
// Get current Bitcoin spot price in Euros.
|
||||
final CryptoPrice euroPrice = CryptoPrice.spotPrice("BTC", "EUR");
|
||||
System.out.println("The current Bitcoin price is " + euroPrice.toCurrency());
|
||||
|
||||
System.out.println();
|
||||
|
||||
// Get current Ethereum market price in Pound sterling.
|
||||
final CryptoPrice gbpPrice = CryptoPrice.marketPrice("ETH", "GBP");
|
||||
// Get current Ethereum spot price in Pound sterling.
|
||||
final CryptoPrice gbpPrice = CryptoPrice.spotPrice("ETH", "GBP");
|
||||
System.out.println("The current Ethereum price is " + gbpPrice.toCurrency());
|
||||
|
||||
System.out.println();
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue