Create Pasis.py
Browse files
Pasis.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import ccxt
|
2 |
+
import pandas as pd
|
3 |
+
|
4 |
+
exchange = ccxt.coinex({
|
5 |
+
'apiKey': 'YOUR_API_KEY',
|
6 |
+
'secret': 'YOUR_SECRET_KEY',
|
7 |
+
})
|
8 |
+
|
9 |
+
# Fetch OHLCV data for BTCUSDT
|
10 |
+
ohlcv = exchange.fetch_ohlcv('BTC/USDT', '1h', since=None, limit=100000)
|
11 |
+
|
12 |
+
# Convert OHLCV data to a pandas DataFrame
|
13 |
+
df = pd.DataFrame(ohlcv, columns=['timestamp', 'open', 'high', 'low', 'close', 'volume'])
|
14 |
+
df['timestamp'] = pd.to_datetime(df['timestamp'], unit='ms')
|
15 |
+
df.set_index('timestamp', inplace=True)
|
16 |
+
|
17 |
+
# Save the DataFrame to a pickle file
|
18 |
+
df.to_pickle('btcusdt_data.pkl')
|