Edit: (Çözüldü) teşekkürler
Merhaba,
Bu api adresinden :
https://www.bitexen.com/api/v1/ticker/
"USDTTRY" Değişkeninden bid ve ask fiyatlarını çekeceğim.
Mesela btctürkte ve diğer borsalarda sorunsuz şekilde yapabildim fakat bitexende takıldım.
Sorunsuz çalışan örnek kod:
btcturk_url = "https://api.btcturk.com/api/v2/ticker"
def get_btcturk_price():
try:
response = requests.get(btcturk_url)
data = response.json()
for pair_data in data["data"]:
if pair_data["pair"] == "USDTTRY":
buy_price = pair_data["ask"]
sell_price = pair_data["bid"]
buy_label_btcturk.config(text=f"Alış Fiyatı (BTC Turk): {buy_price}")
sell_label_btcturk.config(text=f"Satış Fiyatı (BTC Turk): {sell_price}")
break
root.after(5000, get_btcturk_price)
except Exception as e:
print("BTC Turk API hatası:", e)Hatalı kafayı yedirten Kodum :
bitexen_url = "https://www.bitexen.com/api/v1/ticker"
def get_bitexen_price():
try:
response = requests.get(bitexen_url)
data = response.json()
for pair_data in data["data"]:
if pair_data["pair"] == "USDTTRY":
buy_price = pair_data["ask"]
sell_price = pair_data["bid"]
buy_label_bitexen.config(text=f"Alış Fiyatı (Bitexen): {buy_price}")
sell_label_bitexen.config(text=f"Satış Fiyatı (Bitexen): {sell_price}")
root.after(5000, get_bitexen_price)
except Exception as e:
print(" API hatası:", e)Tam olarak nerede hata yapıyorum acaba? Teşekkürler.