Sos / Pasis.py
Pezh's picture
Create Pasis.py
e35fd75 verified
raw
history blame
536 Bytes
import ccxt
import pandas as pd
exchange = ccxt.coinex({
'apiKey': 'YOUR_API_KEY',
'secret': 'YOUR_SECRET_KEY',
})
# Fetch OHLCV data for BTCUSDT
ohlcv = exchange.fetch_ohlcv('BTC/USDT', '1h', since=None, limit=100000)
# Convert OHLCV data to a pandas DataFrame
df = pd.DataFrame(ohlcv, columns=['timestamp', 'open', 'high', 'low', 'close', 'volume'])
df['timestamp'] = pd.to_datetime(df['timestamp'], unit='ms')
df.set_index('timestamp', inplace=True)
# Save the DataFrame to a pickle file
df.to_pickle('btcusdt_data.pkl')