Updated examples, dependencies and some cleanup.

This commit is contained in:
Erik C. Thauvin 2021-05-28 11:04:15 -07:00
parent 59751a574c
commit b547a4d07d
5 changed files with 23 additions and 23 deletions

View file

@ -22,6 +22,18 @@ println(eth.amount)
``` ```
- View [Kotlin](https://github.com/ethauvin/cryptoprice/blob/master/examples/src/main/kotlin/com/example/CryptoPriceExample.kt) or [Java](https://github.com/ethauvin/cryptoprice/blob/master/examples/src/main/java/com/example/CryptoPriceSample.java) Examples. - View [Kotlin](https://github.com/ethauvin/cryptoprice/blob/master/examples/src/main/kotlin/com/example/CryptoPriceExample.kt) or [Java](https://github.com/ethauvin/cryptoprice/blob/master/examples/src/main/java/com/example/CryptoPriceSample.java) Examples.
### Gradle, Maven, etc.
To use with [Gradle](https://gradle.org/), include the following dependency in your [build](https://github.com/ethauvin/cryptoprice/blob/master/examples/build.gradle.kts) file:
```gradle
dependencies {
implementation("net.thauvin.erik:cryptoprice:0.9.0")
}
```
Instructions for using with Maven, Ivy, etc. can be found on [Maven Central](https://search.maven.org/artifact/net.thauvin.erik/cryptoprice/0.9.0/jar).
### Spot Price ### Spot Price
The `spotPrice` function defines the following parameters: The `spotPrice` function defines the following parameters:
@ -109,15 +121,3 @@ will return something like:
``` ```
See the [examples](https://github.com/ethauvin/cryptoprice/blob/master/examples/) for more details. See the [examples](https://github.com/ethauvin/cryptoprice/blob/master/examples/) for more details.
### Gradle, Maven, etc.
To use with [Gradle](https://gradle.org/), include the following dependency in your [build](https://github.com/ethauvin/cryptoprice/blob/master/examples/build.gradle.kts) file:
```gradle
dependencies {
implementation("net.thauvin.erik:cryptoprice:0.9.0")
}
```
Instructions for using with Maven, Ivy, etc. can be found on [Maven Central](https://search.maven.org/artifact/net.thauvin.erik/cryptoprice/0.9.0/jar).

View file

@ -4,7 +4,7 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins { plugins {
id("com.github.ben-manes.versions") version "0.38.0" id("com.github.ben-manes.versions") version "0.39.0"
id("io.gitlab.arturbosch.detekt") version "1.17.1" id("io.gitlab.arturbosch.detekt") version "1.17.1"
id("org.jetbrains.dokka") version "1.4.32" id("org.jetbrains.dokka") version "1.4.32"
id("org.sonarqube") version "3.2.0" id("org.sonarqube") version "3.2.0"

View file

@ -1,6 +1,6 @@
plugins { plugins {
id("org.jetbrains.kotlin.jvm") version "1.5.10" id("org.jetbrains.kotlin.jvm") version "1.5.10"
id("com.github.ben-manes.versions") version "0.38.0" id("com.github.ben-manes.versions") version "0.39.0"
application application
} }

View file

@ -14,16 +14,16 @@ public class CryptoPriceSample {
final CryptoPrice price = CryptoPrice.spotPrice("BTC"); final CryptoPrice price = CryptoPrice.spotPrice("BTC");
System.out.println("The current Bitcoin price is " + price.toCurrency()); System.out.println("The current Bitcoin price is " + price.toCurrency());
// 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(); System.out.println();
// Get current Ethereum spot price in Pound sterling. // Get current Ethereum spot price in Pound sterling.
final CryptoPrice gbpPrice = CryptoPrice.spotPrice("ETH", "GBP"); final CryptoPrice gbpPrice = CryptoPrice.spotPrice("ETH", "GBP");
System.out.println("The current Ethereum price is " + gbpPrice.toCurrency()); System.out.println("The current Ethereum price is " + gbpPrice.toCurrency());
// Get current Litecoin spot price in Euros.
final CryptoPrice euroPrice = CryptoPrice.spotPrice("LTC", "EUR");
System.out.println("The current Litecoin price is " + euroPrice.toCurrency());
System.out.println(); System.out.println();
// Get current Bitcoin buy price using API. // Get current Bitcoin buy price using API.

View file

@ -9,16 +9,16 @@ fun main(@Suppress("UNUSED_PARAMETER") args: Array<String>) {
val price = spotPrice("BTC") val price = spotPrice("BTC")
println("The current Bitcoin price is ${price.toCurrency()}") println("The current Bitcoin price is ${price.toCurrency()}")
// Get current Bitcoin spot price in Euro.
val euroPrice = spotPrice("BTC", "EUR")
println("The current Bitcoin price is ${euroPrice.toCurrency()}")
println() println()
// Get current Ethereum spot price in Pound sterling. // Get current Ethereum spot price in Pound sterling.
val gbpPrice = spotPrice("ETH", "GBP") val gbpPrice = spotPrice("ETH", "GBP")
println("The current Ehtereum price is ${gbpPrice.toCurrency()}") println("The current Ehtereum price is ${gbpPrice.toCurrency()}")
// Get current Litecoin spot price in Euro.
val euroPrice = spotPrice("LTC", "EUR")
println("The current Litecoin price is ${euroPrice.toCurrency()}")
println() println()
// Get current Bitcoin buy price using API. // Get current Bitcoin buy price using API.