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):
|
def _get_gold_fallback(self):
|
||||||
"""Fallback: dados da Binance via par alternativo (GOLD/USDT)."""
|
"""Fallback: dados da Binance via par alternativo (GOLD/USDT)."""
|
||||||
result = {}
|
result = {}
|
||||||
# Tenta XAU/BRL ou XAU/USDT na Binance
|
# Tenta XAUTUSDT (Tether Gold - lastreado em ouro físico) na Binance
|
||||||
symbols = ["XAUUSDT", "GLDUSDT", "PAXGUSDT"]
|
symbols = ["XAUTUSDT", "XAUTBTC", "GLDUSDT", "PAXGUSDT"]
|
||||||
for sym in symbols:
|
for sym in symbols:
|
||||||
try:
|
try:
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
@@ -60,13 +60,13 @@ class XAUBriefAgent:
|
|||||||
result["high"] = float(data.get("highPrice", 0))
|
result["high"] = float(data.get("highPrice", 0))
|
||||||
result["low"] = float(data.get("lowPrice", 0))
|
result["low"] = float(data.get("lowPrice", 0))
|
||||||
result["volume"] = float(data.get("quoteVolume", 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
|
break
|
||||||
except:
|
except:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Segundo fallback: exchangerate
|
# Segundo fallback: exchangerate (XAU não está lá mas tenta)
|
||||||
if not result.get("xau_usd") or result["xau_usd"] < 100:
|
if not result.get("xau_usd") or result["xau_usd"] < 1000:
|
||||||
try:
|
try:
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
"https://api.exchangerate-api.com/v4/latest/XAU",
|
"https://api.exchangerate-api.com/v4/latest/XAU",
|
||||||
|
|||||||
Reference in New Issue
Block a user