initial save of my chatGPT coding

This commit is contained in:
kalzu
2022-12-17 22:39:21 +02:00
commit 56cd2a3f3f
37 changed files with 1376 additions and 0 deletions

16
btc_tracker/fetch_data.py Executable file
View File

@ -0,0 +1,16 @@
#!/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'])

24
btc_tracker/sources.json Normal file
View File

@ -0,0 +1,24 @@
{
"exchanges": [
{
"name": "Bitstamp",
"url": "https://www.bitstamp.net/api/v2/ohlc/btcusd/?step=300&limit=1",
"freq": "5"
},
{
"name": "Kraken",
"url": "https://api.kraken.com/0/public/OHLC?pair=XBTUSD&interval=240",
"freq": "5"
},
{
"name": "Bitfinex",
"url": "https://api-pub.bitfinex.com/v2/candles/trade:5m:tBTCUSD/last",
"freq": "5"
},
{
"name": "Gemini",
"url": "https://api.gemini.com/v2/candles/btcusd/5m",
"freg": "5"
}
]
}