This repository was archived by the owner on Feb 12, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoindata.py
More file actions
41 lines (31 loc) · 1.33 KB
/
Copy pathcoindata.py
File metadata and controls
41 lines (31 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# ///////////////////////////////////
import subprocess
import sys
def install_package(package_name):
"""Belirtilen paketi yükler."""
subprocess.check_call([sys.executable, "-m", "pip", "install", package_name])
try:
import requests
except ImportError:
print("Görünüşe göre 'requests' kütüphanesi yüklenmemiş. Yükleniyor...")
install_package('requests')
# ///////////////////////////////////
def get_crypto_details(crypto_name):
url = f"https://api.coingecko.com/api/v3/coins/{crypto_name}"
response = requests.get(url)
if response.status_code == 200:
data = response.json()
return data
else:
return None
if __name__ == "__main__":
crypto_name = input("Kripto para ismini girin (örneğin 'bitcoin', 'ethereum'): ").lower()
crypto_details = get_crypto_details(crypto_name)
if crypto_details:
print(f"İsim: {crypto_details['name']}\n")
print(f"Sembol: {crypto_details['symbol']}\n")
print(f"Piyasa Değeri: ${crypto_details['market_data']['market_cap']['usd']}\n")
print(f"24 Saatlik İşlem Hacmi: ${crypto_details['market_data']['total_volume']['usd']}\n")
print(f"Güncel Fiyat: ${crypto_details['market_data']['current_price']['usd']}\n")
else:
print("Geçersiz bir kripto para ismi girdiniz veya veri alınamadı.")