Binance price tracker class
This commit is contained in:
parent
e05a47cce0
commit
948430aaad
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package com.example.dcav2gui;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
|
|
@ -13,7 +11,7 @@ import okhttp3.OkHttpClient;
|
|||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class BinancePriceTracker {
|
||||
public class TickerTracker {
|
||||
private static final String BINANCE_API_BASE_URL = "https://api.binance.com/api/v3/ticker/24hr";
|
||||
private static final OkHttpClient httpClient = new OkHttpClient();
|
||||
private static final Gson gson = new Gson();
|
||||
|
|
@ -115,17 +113,17 @@ public class BinancePriceTracker {
|
|||
this.priceChangePercent30d = priceChangePercent30d;
|
||||
}
|
||||
|
||||
// Getters
|
||||
// Getters (Just in case)
|
||||
public String getSymbol() { return symbol; }
|
||||
public double getCurrentPrice() { return currentPrice; }
|
||||
public double getPriceChangePercent24h() { return priceChangePercent24h; }
|
||||
public double getPriceChangePercent7d() { return priceChangePercent7d; }
|
||||
public double getPriceChangePercent30d() { return priceChangePercent30d; }
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("Symbol: %s\nPrice: %.2f%%\n24h Change: %.2f%%\n7d Change: %.2f%%\n30d Change: %.2f%%",
|
||||
symbol, currentPrice, priceChangePercent24h, priceChangePercent7d, priceChangePercent30d);
|
||||
}
|
||||
// @Override
|
||||
// public String toString() {
|
||||
// return String.format("Symbol: %s\nPrice: %.2f%%\n24h Change: %.2f%%\n7d Change: %.2f%%\n30d Change: %.2f%%",
|
||||
// symbol, currentPrice, priceChangePercent24h, priceChangePercent7d, priceChangePercent30d);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
@ -7,6 +7,11 @@
|
|||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="green">#FF008000</color>
|
||||
<color name="red">#FFFF0000</color>
|
||||
<color name="blue">#FF0000FF</color>
|
||||
<color name="yellow">#FFFFFF00</color>
|
||||
<color name="grey">#FF424242</color>
|
||||
|
||||
<color name="secondary_text_color">#FF424242</color>
|
||||
<color name="card_background_color">#FFF6F6F6</color>
|
||||
|
|
|
|||
Loading…
Reference in New Issue