Spaces:
Running
Running
Download data.py from 0vergeared/crypto_signal_bot: direct link, hf CLI and curl.
- Browser
- Download file 371 Bytes
-
https://huggingface.co/spaces/0vergeared/crypto_signal_bot/resolve/main/data.py
- Command line
-
hf download hf://spaces/0vergeared/crypto_signal_bot/data.py
-
curl -L -o data.py https://huggingface.co/spaces/0vergeared/crypto_signal_bot/resolve/main/data.py
371 Bytes
| import ccxt | |
| import pandas as pd | |
| def fetch_ohlcv(symbol='BTC/USDT', timeframe='1h', limit=100): | |
| exchange = ccxt.mexc() | |
| ohlcv = exchange.fetch_ohlcv(symbol, timeframe=timeframe, limit=limit) | |
| df = pd.DataFrame(ohlcv, columns=['timestamp', 'open', 'high', 'low', 'close', 'volume']) | |
| df['timestamp'] = pd.to_datetime(df['timestamp'], unit='ms') | |
| return df | |