fix: use correct XAUTUSDT symbol for gold price on Binance
This commit is contained in:
+5
-5
@@ -45,8 +45,8 @@ class XAUBriefAgent:
|
||||
def _get_gold_fallback(self):
|
||||
"""Fallback: dados da Binance via par alternativo (GOLD/USDT)."""
|
||||
result = {}
|
||||
# Tenta XAU/BRL ou XAU/USDT na Binance
|
||||
symbols = ["XAUUSDT", "GLDUSDT", "PAXGUSDT"]
|
||||
# Tenta XAUTUSDT (Tether Gold - lastreado em ouro físico) na Binance
|
||||
symbols = ["XAUTUSDT", "XAUTBTC", "GLDUSDT", "PAXGUSDT"]
|
||||
for sym in symbols:
|
||||
try:
|
||||
r = requests.get(
|
||||
@@ -60,13 +60,13 @@ class XAUBriefAgent:
|
||||
result["high"] = float(data.get("highPrice", 0))
|
||||
result["low"] = float(data.get("lowPrice", 0))
|
||||
result["volume"] = float(data.get("quoteVolume", 0))
|
||||
if result["xau_usd"] > 100: # preço válido de ouro
|
||||
if result["xau_usd"] > 1000: # ouro está ~US$ 2000+
|
||||
break
|
||||
except:
|
||||
continue
|
||||
|
||||
# Segundo fallback: exchangerate
|
||||
if not result.get("xau_usd") or result["xau_usd"] < 100:
|
||||
# Segundo fallback: exchangerate (XAU não está lá mas tenta)
|
||||
if not result.get("xau_usd") or result["xau_usd"] < 1000:
|
||||
try:
|
||||
r = requests.get(
|
||||
"https://api.exchangerate-api.com/v4/latest/XAU",
|
||||
|
||||
Reference in New Issue
Block a user