NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

en ucuz satıcı, en pahalı satıcı, borsalar arası fark, usd usdt fark ve 13. boş grupbox ı normal frame kutularına çevir çok kasıyor. import requests
import tkinter as tk
from tkinter import font
from PIL import Image, ImageTk
import os
import threading
import time
from tkinter import messagebox
root = tk.Tk()
root.geometry("1330x770")
root.title("Arbitrager V0.3")
root.resizable(False, False) # X ve Y ekseninde boyut değişimini engeller
binance_url = "https://api.binance.com/api/v3/ticker/bookTicker?symbol=USDTTRY"
paribu_url = "https://www.paribu.com/ticker"
btcturk_url = "https://api.btcturk.com/api/v2/ticker"
bitexen_url = "https://www.bitexen.com/api/v1/ticker/USDTTRY/"
icrypex_url = "https://api.icrypex.com/v1/tickers"
bitci_url = "https://api.bitci.com/api/coin/usdt_TRY"
genelpiyasa_url = "https://api.genelpara.com/embed/para-birimleri.json"
def format_price(price):
return f"{float(price):.3f}"
def get_binance_price():
try:
response = requests.get(binance_url)
data = response.json()
buy_price = format_price(data["bidPrice"])
sell_price = format_price(data["askPrice"])
buy_label_binance.config(text=f"Alış Fiyatı : ${buy_price}", font=("Arial", 10, "bold"))
sell_label_binance.config(text=f"Satış Fiyatı : ${sell_price}", font=("Arial", 10, "bold"))

root.after(35000, get_binance_price)
except Exception as e:
print("Binance API hatası:", e)
def get_paribu_price():
try:
response = requests.get(paribu_url)
data = response.json()
buy_price = format_price(data["USDT_TL"]["lowestAsk"])
sell_price = format_price(data["USDT_TL"]["highestBid"])
buy_label_paribu.config(text=f"Alış Fiyatı : ${buy_price}", font=("Arial", 10, "bold"))
sell_label_paribu.config(text=f"Satış Fiyatı : ${sell_price}", font=("Arial", 10, "bold"))
root.after(35000, get_paribu_price)
except Exception as e:
print("Paribu API hatası:", e)
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ı : ${buy_price}", font=("Arial", 10, "bold"))

sell_label_btcturk.config (text=f"Satış Fiyatı : ${sell_price}", font=("Arial", 10, "bold"))
break
root.after(35000, get_btcturk_price)
except Exception as e:
print("BTC Turk API hatası:", e)
def get_bitexen_prices():
try:
response = requests.get(bitexen_url)
data = response.json()

ask_price = data["data"]["ticker"]["ask"]
bid_price = data["data"]["ticker"]["bid"]

buy_label_bitexen.config(text=f"Alış Fiyatı : ${ask_price}", font=("Arial", 10, "bold"))
sell_label_bitexen.config(text=f"Satış Fiyatı : ${bid_price}", font=("Arial", 10, "bold"))

root.after(35000, get_bitexen_prices)
except Exception as e:
print("Bitexen API hatası:", e)
def get_icrypex_price():
try:
response = requests.get(icrypex_url)
data = response.json()
for currency_data in data:
if currency_data["symbol"] == "USDTTRY":
buy_price = format_price(currency_data["bid"])
sell_price = format_price(currency_data["ask"])
buy_label_icrypex.config(text=f"Alış Fiyatı : ${buy_price}", font=("Arial", 10, "bold"))
sell_label_icrypex.config(text=f"Satış Fiyatı : ${sell_price}", font=("Arial", 10, "bold"))
break
root.after(35000, get_icrypex_price)
except Exception as e:
print("iCrypex API hatası:", e)
def get_bitci_price():
try:
response = requests.get(bitci_url)
data = response.json()
buy_price = format_price(data["price"])
sell_price = format_price(data["price"])
buy_label_bitci.config(text=f"Alış Fiyatı : ${buy_price}", font=("Arial", 10, "bold"))
sell_label_bitci.config(text=f"Satış Fiyatı : ${sell_price}", font=("Arial", 10, "bold"))
root.after(35000, get_bitci_price)
except Exception as e:
print("Bitci API hatası:", e)
def get_usd_try_price():
try:
response = requests.get(genelpiyasa_url)
data = response.json()
usd_try_buy_price = float(data['USD']['alis'].replace(',', '.'))
usd_try_sell_price = float(data['USD']['satis'].replace(',', '.'))
return usd_try_buy_price, usd_try_sell_price
except Exception as e:
print("API hatası:", e)
return None, None

current_directory = os.path.dirname(__file__)
background_image_path = os.path.join(current_directory, "background.jpg")
background_image = Image.open(background_image_path)
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
background_image = background_image.resize((screen_width, screen_height), Image.LANCZOS)
background_photo = ImageTk.PhotoImage(background_image)
background_label = tk.Label(root, image=background_photo)
background_label.photo = background_photo
background_label.place(x=0, y=0, relwidth=1, relheight=1)
saydam_mor = "#272163"
title_label = tk.Label(root, text="Arbitrager", font=("Arial", 16, "bold"), fg="lightblue", bg=saydam_mor)
title_label.pack(padx=10, pady=(40, 20))
version_label = tk.Label(root, text="Versinon 0.3.5", font=("Arial", 8))
version_label.pack (padx=25, pady=(1, 50))
saydam_yesil = "#57b44f"
saydam_kirmizi = "#f21b2f"
groupbox_binance = tk.LabelFrame(root, text="Binance Borsası", font=("Arial", 12, "bold"), bg="lightblue")
groupbox_binance.pack(padx=10, pady=10, anchor="w")
buy_label_binance = tk.Label(groupbox_binance, text="Alış Fiyatı (Binance)", bg=saydam_yesil)
buy_label_binance.pack(anchor="w")
sell_label_binance = tk.Label(groupbox_binance, text="Satış Fiyatı (Binance)", bg=saydam_kirmizi)
sell_label_binance.pack(anchor="w")
saydam_yesil = "#57b44f"
saydam_kirmizi = "#f21b2f"
groupbox_paribu = tk.LabelFrame(root, text="Paribu Borsası", font=("Arial", 12, "bold"), bg="lightblue")
groupbox_paribu.pack(padx=10, pady=10, anchor="w")
buy_label_paribu = tk.Label(groupbox_paribu, text="Alış Fiyatı (Paribu)", bg=saydam_yesil)
buy_label_paribu.pack(anchor="w")
sell_label_paribu = tk.Label(groupbox_paribu, text="Satış Fiyatı (Paribu)", bg=saydam_kirmizi)
sell_label_paribu.pack(anchor="w")
saydam_yesil = "#57b44f"
saydam_kirmizi = "#f21b2f"
groupbox_btcturk = tk.LabelFrame(root, text="BtcTurk Borsası", font=("Arial", 12, "bold"), bg="lightblue")
groupbox_btcturk.pack(padx=10, pady=10, anchor="w")
buy_label_btcturk = tk.Label(groupbox_btcturk, text="Alış Fiyatı (BtcTurk)", bg=saydam_yesil)
buy_label_btcturk.pack(anchor="w")
sell_label_btcturk = tk.Label(groupbox_btcturk, text="Satış Fiyatı (BtcTurk)", bg=saydam_kirmizi)
sell_label_btcturk.pack(anchor="w")
saydam_yesil = "#57b44f"
saydam_kirmizi = "#f21b2f"
groupbox_bitexen = tk.LabelFrame(root, text="Bitexen Borsası", font=("Arial", 12, "bold"), bg="lightblue")
groupbox_bitexen.pack(padx=10, pady=10, anchor="w")
buy_label_bitexen = tk.Label(groupbox_bitexen, text="Alış Fiyatı (Bitexen)", bg=saydam_yesil)
buy_label_bitexen.pack(anchor="w")
sell_label_bitexen = tk.Label(groupbox_bitexen, text="Satış Fiyatı (Bitexen)", bg=saydam_kirmizi)
sell_label_bitexen.pack(anchor="w")
saydam_yesil = "#57b44f"
saydam_kirmizi = "#f21b2f"
groupbox_icrypex = tk.LabelFrame(root, text="iCrypex Borsası", font=("Arial", 12, "bold"), bg="lightblue")
groupbox_icrypex.pack(padx=10, pady=10, anchor="w")
buy_label_icrypex = tk.Label(groupbox_icrypex, text="Alış Fiyatı (iCrypex)", bg=saydam_yesil)
buy_label_icrypex.pack(anchor="w")
sell_label_icrypex = tk.Label(groupbox_icrypex, text="Satış Fiyatı (iCrypex)", bg=saydam_kirmizi)
sell_label_icrypex.pack(anchor="w")
saydam_yesil = "#57b44f"
saydam_kirmizi = "#f21b2f"
groupbox_bitci = tk.LabelFrame(root, text="Bitci Borsası", font=("Arial", 12, "bold"), bg="lightblue")
groupbox_bitci.pack(padx=10, pady=10, anchor="w")
buy_label_bitci = tk.Label(groupbox_bitci, text="Alış Fiyatı (Bitci)", bg=saydam_yesil)
buy_label_bitci.pack(anchor="w")
sell_label_bitci = tk.Label(groupbox_bitci, text="Satış Fiyatı (Bitci)", bg=saydam_kirmizi)
sell_label_bitci.pack(anchor="w")
saydam_yesil = "#57b44f"
saydam_kirmizi = "#f21b2f"
groupbox_piyasa_kuru = tk.LabelFrame(root, text="Reel Piyasa Kuru", font=("Arial", 12, "bold"), bg="red")
groupbox_piyasa_kuru.pack(padx=10, pady=10, side="left")
buy_label_piyasa_kuru = tk.Label(groupbox_piyasa_kuru, text="Piyasa Alış :")
buy_label_piyasa_kuru.pack()
sell_label_piyasa_kuru = tk.Label(groupbox_piyasa_kuru, text="Piyasa Satış :")
sell_label_piyasa_kuru.pack()
get_binance_price()
get_paribu_price()
get_btcturk_price()
get_bitexen_prices()
get_icrypex_price()
get_bitci_price()
usd_try_buy_price, usd_try_sell_price = get_usd_try_price()
if usd_try_buy_price is not None and usd_try_sell_price is not None:
buy_label_piyasa_kuru.config(text=f"Piyasa Alış : {usd_try_buy_price}", font=("Arial", 10, "bold"))
sell_label_piyasa_kuru.config(text=f"Piyasa Satış : {usd_try_sell_price}", font=("Arial", 10, "bold"))
def find_highest_seller():
try:
highest_seller = None
highest_price = 0.0
highest_seller_borsa = None
response = requests.get(binance_url)
binance_data = response.json()
binance_sell_price = float(binance_data["askPrice"])
if binance_sell_price > highest_price:
highest_price = binance_sell_price
highest_seller = "Binance"
highest_seller_borsa = "Binance"
response = requests.get(paribu_url)
paribu_data = response.json()
paribu_sell_price = float(paribu_data["USDT_TL"]["lowestAsk"])
if paribu_sell_price > highest_price:
highest_price = paribu_sell_price
highest_seller = "Paribu"
highest_seller_borsa = "Paribu"
response = requests.get(btcturk_url)
btcturk_data = response.json()
for pair_data in btcturk_data["data"]:
if pair_data["pair"] == "USDTTRY":
btcturk_sell_price = float(pair_data["ask"])
if btcturk_sell_price > highest_price:
highest_price = btcturk_sell_price
highest_seller = "BtcTurk"
highest_seller_borsa = "BtcTurk"
break
response = requests.get(bitexen_url)
bitexen_data = response.json()
bitexen_sell_price = float(bitexen_data["data"]["ticker"]["ask"])
if bitexen_sell_price > highest_price:
highest_price = bitexen_sell_price
highest_seller = "Bitexen"
highest_seller_borsa = "Bitexen"
response = requests.get(icrypex_url)
icrypex_data = response.json()
for currency_data in icrypex_data:
if currency_data["symbol"] == "USDTTRY":
icrypex_sell_price = float(currency_data["ask"])
if icrypex_sell_price > highest_price:
highest_price = icrypex_sell_price
highest_seller = "iCrypex"
highest_seller_borsa = "iCrypex"
break
response = requests.get(bitci_url)
bitci_data = response.json()
bitci_sell_price = float(bitci_data["price"])
if bitci_sell_price > highest_price:
highest_price = bitci_sell_price
highest_seller = "Bitci"
highest_seller_borsa = "Bitci"
if highest_seller is not None:
sell_label_en_pahali_satici_price.config(text=f"({highest_seller_borsa}) Fiyat: ${highest_price}", font=("Arial", 10, "bold"))
else:
sell_label_en_pahali_satici_price.config(text="En Pahalı Satıcı Bulunamadı", font=("Arial", 10, "bold"))
root.after(35000, find_highest_seller)
except Exception as e:
print("En Pahalı Satıcı Hatası:", e)
groupbox_en_pahali_satici = tk.LabelFrame(root, text=" En Pahalı Satıcı", font=("Arial", 12, "bold"))
groupbox_en_pahali_satici.pack(padx=10, pady=10, side="left")
sell_label_en_pahali_satici_price = tk.Label(groupbox_en_pahali_satici, text="", font=("Arial", 10, "bold"))
sell_label_en_pahali_satici_price.pack()
find_highest_seller()
def find_lowest_seller():
try:
lowest_seller = None
lowest_price = float("inf")
lowest_seller_borsa = None
response = requests.get(binance_url)
binance_data = response.json()
binance_sell_price = float(binance_data["askPrice"])
if binance_sell_price < lowest_price:
lowest_price = binance_sell_price
lowest_seller = "Binance"
lowest_seller_borsa = "Binance"
response = requests.get(paribu_url)
paribu_data = response.json()
paribu_sell_price = float(paribu_data["USDT_TL"]["lowestAsk"])
if paribu_sell_price < lowest_price:
lowest_price = paribu_sell_price
lowest_seller = "Paribu"
lowest_seller_borsa = "Paribu"
response = requests.get(btcturk_url)
btcturk_data = response.json()
for pair_data in btcturk_data["data"]:
if pair_data["pair"] == "USDTTRY":
btcturk_sell_price = float(pair_data["ask"])
if btcturk_sell_price < lowest_price:
lowest_price = btcturk_sell_price
lowest_seller = "BtcTurk"
lowest_seller_borsa = "BtcTurk"
break
response = requests.get(bitexen_url)
bitexen_data = response.json()
bitexen_sell_price = float(bitexen_data["data"]["ticker"]["ask"])
if bitexen_sell_price < lowest_price:
lowest_price = bitexen_sell_price
lowest_seller = "Bitexen"
lowest_seller_borsa = "Bitexen"
response = requests.get(icrypex_url)
icrypex_data = response.json()
for currency_data in icrypex_data:
if currency_data["symbol"] == "USDTTRY":
icrypex_sell_price = float(currency_data["ask"])
if icrypex_sell_price < lowest_price:
lowest_price = icrypex_sell_price
lowest_seller = "iCrypex"
lowest_seller_borsa = "iCrypex"
break
response = requests.get(bitci_url)
bitci_data = response.json()
bitci_sell_price = float(bitci_data["price"])
if bitci_sell_price < lowest_price:
lowest_price = bitci_sell_price
lowest_seller = "Bitci"
lowest_seller_borsa = "Bitci"
if lowest_seller is not None:
sell_label_en_ucuz_satici.config(text=f"({lowest_seller_borsa}) Fiyat: ${lowest_price}", font=("Arial", 10, "bold"))
else:
sell_label_en_ucuz_satici.config(text="En Ucuz Satıcı Bulunamadı", font=("Arial", 10, "bold"))
root.after(35000, find_lowest_seller)
except Exception as e:
print("En Ucuz Satıcı Hatası:", e)
groupbox_en_ucuz_satici = tk.LabelFrame(root, text=" En Ucuz Satıcı", font=("Arial", 12, "bold"))
groupbox_en_ucuz_satici.pack(padx=10, pady=10, side="left")
sell_label_en_ucuz_satici = tk.Label(groupbox_en_ucuz_satici, text="Fiyat")
sell_label_en_ucuz_satici.pack()
find_lowest_seller()
def calculate_price_difference():
try:
lowest_seller_price = float(sell_label_en_ucuz_satici.cget("text").split(":")[1].strip().replace("$", ""))
highest_buyer_price = float(sell_label_en_pahali_satici_price.cget("text").split(":")[1].strip().replace("$", ""))
price_difference = highest_buyer_price - lowest_seller_price
percentage_difference = (price_difference / lowest_seller_price) * 100
buy_label_piyasa_pahali_farki.config(text=f"Fark: {percentage_difference:.2f}%", font=("Arial", 10, "bold"))
root.after(35000, calculate_price_difference)
except Exception as e:
print("Hesaplama Hatası:", e)
# İpucu metni
tooltip_text = "Borsalar Arası, USDT Fiyatının en uygun olduğu borsa ile en pahalı olduğu borsanın arasındaki fiyat farkıdır. Ucuz olan borsadan USDT alınıp Pahalı olan borsada satılarak arbitraj yapılabilir."

def show_tooltip(event):
messagebox.showinfo("Borsalar Arası Nedir?", tooltip_text)
groupbox_piyasa_pahali_farki = tk.LabelFrame(root, text="Borsalar Arası 🛈", font=("Arial", 11, "bold"))
groupbox_piyasa_pahali_farki.pack(padx=10, pady=10, side="left")
buy_label_piyasa_pahali_farki = tk.Label(groupbox_piyasa_pahali_farki, text="Fark:")
buy_label_piyasa_pahali_farki.bind("<Enter>", show_tooltip)
buy_label_piyasa_pahali_farki.pack()
#USD / USDT Farkı, Reel Piyasa dolar kuru ile Borsalardaki en yüksek USDT fiyatının arasındaki farktır. Eğer USDT daha yüksek ise borsada satılarak arbitraj yapılabilir
calculate_price_difference()
groupbox_piyasa_vepahali_farkii = tk.LabelFrame(root, text="USD / USDT Farkı", font=("Arial", 11, "bold"))
groupbox_piyasa_vepahali_farkii.pack(padx=10, pady=10, side="left")
buy_label_piyasa_vepahali_farkii = tk.Label(groupbox_piyasa_vepahali_farkii, text="Borsa:")
buy_label_piyasa_vepahali_farkii.pack()

def calculate_market_highest_difference():
try:
market_sell_price = float(sell_label_piyasa_kuru.cget("text").split(":")[1].strip())
highest_buyer_price = float(sell_label_en_pahali_satici_price.cget("text").split(":")[1].strip().replace("$", ""))
price_difference = highest_buyer_price - market_sell_price
percentage_difference = (price_difference / market_sell_price) * 100
buy_label_piyasa_vepahali_farkii.config(text=f"Fark: {percentage_difference:.2f}%", font=("Arial", 10, "bold"))
root.after(35000, calculate_market_highest_difference)
except Exception as e:
print("Hesaplama Hatası:", e)
calculate_market_highest_difference()
groupbox_12 = tk.LabelFrame(root, text="USD / USDT Farkı", font=("Arial", 11, "bold"))
groupbox_12.pack(padx=10, pady=10, side="left")
def compare_usdt_usd():
try:
usdt_price = float(sell_label_en_pahali_satici_price.cget("text").split(":")[1].strip().replace("$", ""))
usd_price = float(buy_label_piyasa_kuru.cget("text").split(":")[1].strip())
if usdt_price > usd_price:
label_text = "USDT Daha Pahalı"
elif usdt_price < usd_price:
label_text = "USD Daha Pahalı"
else:
label_text = "USDT ve USD Aynı Fiyatta"
buy_label_12.config(text=label_text, font=("Arial", 10, "bold"))
root.after(35000, compare_usdt_usd)
except Exception as e:
print("Karşılaştırma Hatası:", e)
buy_label_12 = tk.Label(groupbox_12, text="", font=("Arial", 10, "bold"))
buy_label_12.pack()
compare_usdt_usd()
##

# 13. Boş
groupbox_sayaç = tk.LabelFrame(root, text="Kaynaklar", font=("Arial", 12, "bold"))
groupbox_sayaç.pack(padx=10, pady=10, side="left")
sayaç_label = tk.Label(groupbox_sayaç, text="", font=("Arial", 10, "bold"))
sayaç_label.pack()

def update_timer():
while True:
timer = 30 # 30 saniye sayaç
while timer >= 0:
sayaç_label.config(text=f"Yenilenmesine Kalan: {timer} sn", font=("Arial", 9, "bold"))
root.update() # Tkinter penceresini güncellemek için kullanılır
time.sleep(1) # 1 saniye beklet
timer -= 1
sayaç_label.config(text="Lütfen bekleyin... Yenileniyor", font=("Arial", 9, "bold"))
time.sleep(30) # 30 saniye bekle ve sayaçı yeniden başlat

# Sayaç işlevini bir arka plan iş parçasında başlat
sayaç_thread = threading.Thread(target=update_timer)
sayaç_thread.daemon = True # Arka plan iş parçasının ana programın sona ermesini beklememesini sağlar
sayaç_thread.start()



# 14. Boş
groupbox_bos_3 = tk.LabelFrame(root, text="14. Boş", font=("Arial", 12, "bold"))
groupbox_bos_3.pack(padx=10, pady=10, side="left")
buy_label_bos_3 = tk.Label(groupbox_bos_3, text="Boş")
buy_label_bos_3.pack()
sell_label_bos_3 = tk.Label(groupbox_bos_3, text="Boş")
sell_label_bos_3.pack()


try:
root.mainloop()
except Exception as e:
print("Bir hata oluştu:", e)
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.