Download Pasis.py from Pezh/Sos: direct link, hf CLI and curl.
- Browser
- Download file 536 Bytes
-
https://huggingface.co/spaces/Pezh/Sos/resolve/main/Pasis.py
- Command line
-
hf download hf://spaces/Pezh/Sos/Pasis.py
-
curl -L -o Pasis.py https://huggingface.co/spaces/Pezh/Sos/resolve/main/Pasis.py
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') | |