A Python-based cryptocurrency data collector that supports both REST API and WebSocket connections for real-time market data collection.
- REST API Collector: Synchronous and asynchronous implementations for fetching cryptocurrency data
- WebSocket Collector: Real-time data streaming from cryptocurrency exchanges
- Exchange Support: Currently supports Coinbase Pro WebSocket feeds
- Flexible Configuration: Easy-to-configure system for different exchanges and data types
- Database Integration: Supabase integration for data persistence
- Clone the repository:
git clone https://github.com/sjhavar/crypto-websockets.git
cd crypto-websockets- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Set up environment variables:
Create a
.envfile in the root directory with your configuration:
# Add your environment variables here
Synchronous version:
from collectors.rest_api.collector import collect_dataAsynchronous version:
from collectors.rest_api.collector_async import async_collect_dataRun the Coinbase WebSocket collector:
python collectors/websocket/coinbase_websocket.pyTest WebSocket connection:
python collectors/websocket/test_connection.pyFor bulk data import:
python one_time_import.pycrypto-websockets/
├── collectors/
│ ├── rest_api/
│ │ ├── collector.py # Synchronous REST API collector
│ │ └── collector_async.py # Asynchronous REST API collector
│ └── websocket/
│ ├── coinbase_websocket.py # Coinbase WebSocket implementation
│ └── test_connection.py # Connection testing utility
├── config.py # Configuration management
├── one_time_import.py # Bulk import utility
├── requirements.txt # Python dependencies
└── README.md # This file
- Python 3.7+
- See
requirements.txtfor Python package dependencies
Feel free to submit issues and enhancement requests!
[Specify your license here]