pricenode: woodser's patch
This commit is contained in:
parent
f8f10a4d6b
commit
fed7b22c90
@ -64,9 +64,9 @@ public class PriceProvider extends HttpClientProvider {
|
|||||||
|
|
||||||
LinkedTreeMap<?, ?> map = new Gson().fromJson(json, LinkedTreeMap.class);
|
LinkedTreeMap<?, ?> map = new Gson().fromJson(json, LinkedTreeMap.class);
|
||||||
Map<String, Long> tsMap = new HashMap<>();
|
Map<String, Long> tsMap = new HashMap<>();
|
||||||
tsMap.put("btcAverageTs", ((Double) map.get("btcAverageTs")).longValue());
|
transfer("btcAverageTs", map, tsMap);
|
||||||
tsMap.put("poloniexTs", ((Double) map.get("poloniexTs")).longValue());
|
transfer("poloniexTs", map, tsMap);
|
||||||
tsMap.put("coinmarketcapTs", ((Double) map.get("coinmarketcapTs")).longValue());
|
transfer("coinmarketcapTs", map, tsMap);
|
||||||
|
|
||||||
// get btc per xmr price to convert all prices to xmr
|
// get btc per xmr price to convert all prices to xmr
|
||||||
// TODO (woodser): currently using bisq price feed, switch?
|
// TODO (woodser): currently using bisq price feed, switch?
|
||||||
@ -99,6 +99,12 @@ public class PriceProvider extends HttpClientProvider {
|
|||||||
return new Tuple2<>(tsMap, marketPriceMap);
|
return new Tuple2<>(tsMap, marketPriceMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void transfer(String key, LinkedTreeMap<?, ?> map, Map<String, Long> tsMap) {
|
||||||
|
if (map.containsKey(key)) tsMap.put(key, ((Double) map.get(key)).longValue());
|
||||||
|
else log.warn("No prices returned from provider " + key);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return price of 1 XMR in BTC
|
* @return price of 1 XMR in BTC
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user