diff --git a/src/monitor.cpp b/src/monitor.cpp index fd6fa0a..f9db1bb 100644 --- a/src/monitor.cpp +++ b/src/monitor.cpp @@ -178,7 +178,9 @@ String getBTCprice(void){ StaticJsonDocument<1024> doc; deserializeJson(doc, payload); - if (doc.containsKey("last_trade_price")) bitcoin_price = doc["last_trade_price"]; + if (doc.containsKey("bitcoin") && doc["bitcoin"].containsKey("usd")) { + bitcoin_price = doc["bitcoin"]["usd"]; + } doc.clear(); diff --git a/src/monitor.h b/src/monitor.h index e4a0d3d..94ef376 100644 --- a/src/monitor.h +++ b/src/monitor.h @@ -15,7 +15,8 @@ //API BTC price (Update to USDT cus it's more liquidity and flow price updade) //#define getBTCAPI "https://api.coindesk.com/v1/bpi/currentprice.json" -- doesn't work anymore -#define getBTCAPI "https://api.blockchain.com/v3/exchange/tickers/BTC-USDT" +//#define getBTCAPI "https://api.blockchain.com/v3/exchange/tickers/BTC-USDT" -- updates infrequently +#define getBTCAPI "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd" #define UPDATE_BTC_min 1