chatgpt/btc_tracker/fetch_data.py

17 lines
473 B
Python
Executable File

#!/usr/bin/python3
import json, time
# Load the JSON file
with open('sources.json', 'r') as f:
data = json.load(f)
# Iterate over the exchanges
for exchange in data['exchanges']:
# Print the name and URL of the exchange
if exchange['name'] == "Kraken":
current_time = int(time.time()) - 300
exchange['url'] += f"&since={current_time}"
print(exchange['name'], exchange['url'])
else:
print(exchange['name'], exchange['url'])