added shiba inu
This commit is contained in:
parent
7eac2c530e
commit
91e5afd4f8
@ -43,7 +43,8 @@ public class MiningBean {
|
||||
List<KeyValue> pool = new ArrayList<>();
|
||||
List<KeyValue> network = new ArrayList<>();
|
||||
|
||||
String[] cryptoCur = new String[] { "BTC", "LTC", "XRP", "ETH", "DOGE", "ADA" };
|
||||
String[] cryptoCur = new String[] { "BTC", "LTC", "XRP", "ETH", "DOGE", "ADA", "SHIB" };
|
||||
int[] roundPrices = new int[] { 4, 4, 4, 4, 4, 4, 6 };
|
||||
double[] lastPrices = new double[cryptoCur.length];
|
||||
|
||||
ltcapikey = request.getParameter("ltcapikey");
|
||||
@ -70,26 +71,27 @@ public class MiningBean {
|
||||
if (restRequest != null && restRequest.length() > 0) {
|
||||
JSONObject tmp = new JSONObject(restRequest);
|
||||
JSONArray data = (JSONArray) tmp.get("data");
|
||||
|
||||
for (int i=0;i<data.length();i++) {
|
||||
|
||||
for (int i = 0; i < data.length(); i++) {
|
||||
JSONObject o = data.getJSONObject(i);
|
||||
String symbol = o.getString("symbol");
|
||||
int pos = searchArray(cryptoCur, symbol);
|
||||
if (pos>=0) {
|
||||
if (pos >= 0) {
|
||||
JSONObject quote = (JSONObject) o.get("quote");
|
||||
JSONObject usd = (JSONObject) quote.get(currency.toUpperCase());
|
||||
double price = usd.getDouble("price");
|
||||
double change = usd.getDouble("percent_change_24h");
|
||||
|
||||
|
||||
lastPrices[pos] = price;
|
||||
if (price > 0d)
|
||||
resultStr = curSym + String.format("%.4f",(price)) + " ("+String.format("%.2f",(change))+"%)";
|
||||
resultStr = curSym + String.format("%."+roundPrices[pos]+"f", (price)) + " (" + String.format("%.2f", (change))
|
||||
+ "%)";
|
||||
else
|
||||
resultStr = "Unknown";
|
||||
KeyValue wi = new KeyValue();
|
||||
wi.setKey(symbol.concat("/").concat(currency.toUpperCase()));
|
||||
wi.setValue(resultStr);
|
||||
if (change>0)
|
||||
if (change > 0)
|
||||
wi.setColor("#00FF99");
|
||||
else
|
||||
wi.setColor("#FF5050");
|
||||
@ -97,7 +99,7 @@ public class MiningBean {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@ -518,10 +520,10 @@ public class MiningBean {
|
||||
|
||||
String tmp = "";
|
||||
for (KeyValue kv : prices) {
|
||||
if (kv.getColor()==null)
|
||||
if (kv.getColor() == null)
|
||||
kv.setColor("#00CCFF");
|
||||
tmp = tmp.concat("<pair><key>").concat(
|
||||
kv.getKey().concat("</key>").concat("<value>").concat(kv.getValue()).concat("</value>").concat("<color>").concat(kv.getColor()).concat("</color></pair>"));
|
||||
tmp = tmp.concat("<pair><key>").concat(kv.getKey().concat("</key>").concat("<value>").concat(kv.getValue())
|
||||
.concat("</value>").concat("<color>").concat(kv.getColor()).concat("</color></pair>"));
|
||||
}
|
||||
res = res.replace("#PRICES#", tmp);
|
||||
|
||||
@ -550,8 +552,8 @@ public class MiningBean {
|
||||
}
|
||||
|
||||
private int searchArray(String[] array, String key) {
|
||||
int i=0;
|
||||
for (String str:array) {
|
||||
int i = 0;
|
||||
for (String str : array) {
|
||||
if (str.equals(key))
|
||||
return i;
|
||||
i++;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user