mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-10-01 01:35:48 -04:00
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);
|
||||
Map<String, Long> tsMap = new HashMap<>();
|
||||
tsMap.put("btcAverageTs", ((Double) map.get("btcAverageTs")).longValue());
|
||||
tsMap.put("poloniexTs", ((Double) map.get("poloniexTs")).longValue());
|
||||
tsMap.put("coinmarketcapTs", ((Double) map.get("coinmarketcapTs")).longValue());
|
||||
transfer("btcAverageTs", map, tsMap);
|
||||
transfer("poloniexTs", map, tsMap);
|
||||
transfer("coinmarketcapTs", map, tsMap);
|
||||
|
||||
// get btc per xmr price to convert all prices to xmr
|
||||
// TODO (woodser): currently using bisq price feed, switch?
|
||||
@ -99,6 +99,12 @@ public class PriceProvider extends HttpClientProvider {
|
||||
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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user