Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the BTC/USDT ticker to Binance #506

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,12 @@ String getBTCprice(void){

DynamicJsonDocument doc(1024);
deserializeJson(doc, payload);
if (doc.containsKey("last_trade_price")) bitcoin_price = doc["last_trade_price"];

if (doc.containsKey("price")) {
String priceStr = doc["price"];
float priceFloat = priceStr.toFloat();
bitcoin_price = (int)priceFloat; // Truncate the decimal part by casting to int
}

doc.clear();

Expand Down
4 changes: 2 additions & 2 deletions src/monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
//Time update period
#define UPDATE_PERIOD_h 5

//API BTC price (Update to USDT cus it's more liquidity and flow price updade)
#define getBTCAPI "https://api.blockchain.com/v3/exchange/tickers/BTC-USDT"
//API BTC price (BTC/USDT hanged on the same amount for days, reverting to BTC-USD)
#define getBTCAPI "https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT"
#define UPDATE_BTC_min 1

//API Block height
Expand Down