11 lines
363 B
Python
11 lines
363 B
Python
import ccxt
|
|
import pandas as pd
|
|
exchange = ccxt.coinbase()
|
|
symbol = 'BTC/USDT'
|
|
timeframe = '1m'
|
|
ohlcv = exchange.fetch_ohlcv(symbol, timeframe)
|
|
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)
|
|
# print(df.head())
|
|
print(df) |