import requests
import time
# CoinGecko API URL
API_URL = "https://api.coingecko.com/api/v3/simple/price"
# Kripto para birimi ve hedef fiyatı ayarlayın
crypto_currency = "bitcoin"
fiat_currency = "usd"
target_price = 50000
def get_crypto_price(crypto_currency, fiat_currency):
payload = {"ids": crypto_currency, "vs_currencies": fiat_currency}
response = requests.get(API_URL, params=payload)
response_data = response.json()
return response_data[crypto_currency][fiat_currency]
def check_price():
current_price = get_crypto_price(crypto_currency, fiat_currency)
print(f"{crypto_currency.upper()} şu anki fiyatı: ${current_price}")
if current_price >= target_price:
print(f"{crypto_currency.upper()} hedef fiyata ulaştı! Şu anki fiyat: ${current_price}")
while True:
check_price()
time.sleep(60) # 60 saniyede bir fiyat kontrolü yapar