Skip to content

Instantly share code, notes, and snippets.

@ievgiienko
Created November 21, 2023 18:54
Show Gist options
  • Save ievgiienko/c7b3c4393dba90e01f1af7046001b0f9 to your computer and use it in GitHub Desktop.
Save ievgiienko/c7b3c4393dba90e01f1af7046001b0f9 to your computer and use it in GitHub Desktop.
package academy.prog;
import java.util.Scanner;
import net.thauvin.erik.crypto.*;
public class Main {
public static void main(String[] args) throws Exception {
var scanner = new Scanner(System.in);
var price = CryptoPrice.spotPrice("BTC").getAmount().doubleValue();
System.out.println("BTC price: " + price);
System.out.println("How many $ do you have?");
var dollars = scanner.nextDouble();
System.out.println("You can buy BTC: " + dollars / price);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>academy.prog</groupId>
<artifactId>untitled</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>net.thauvin.erik</groupId>
<artifactId>cryptoprice</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment