Supported Exchanges
The data collector (data/collectors.py:12-32) supports:
- Kraken (default) - Public data access without API keys
- Binance - Requires API keys for enhanced rate limits
Public endpoints work without authentication, but API keys provide higher rate limits and access to additional features.
Quick Setup
Option 1: Kraken (No API Keys Required)
Kraken is the default exchange and works immediately without configuration:.env configuration needed for basic usage.
Option 2: Binance with API Keys
For Binance or enhanced features, configure API credentials:.env
Getting Binance API Keys
Follow these steps to create API keys on Binance:Step 1: Create Binance Account
- Visit binance.com
- Complete registration and KYC verification
- Enable two-factor authentication (2FA)
Step 2: Generate API Keys
- Log in to your Binance account
- Navigate to Profile → API Management
- Click Create API
- Choose System Generated API
- Label it (e.g., “CryptoView Pro”)
- Complete 2FA verification
- Save your API Key and Secret Key securely
Step 3: Configure API Restrictions
For security, restrict your API key permissions:- ✅ Enable Reading - Required for market data
- ❌ Disable Spot & Margin Trading - Not needed
- ❌ Disable Withdrawals - Not needed
- Optional: Restrict to specific IP addresses
Getting Kraken API Keys (Optional)
Kraken works without API keys, but you can add them for increased rate limits:- Log in to kraken.com
- Navigate to Settings → API
- Click Generate New Key
- Set permissions to Query Funds and Query Open Orders
- Save API Key and Private Key
.env:
Currently the application is configured for Binance credentials in
config/settings.py:8-9. To use Kraken keys, modify the settings file accordingly.Data Collector Usage
TheCryptoDataCollector class handles all exchange interactions (data/collectors.py:12-101).
Initialize Collector
Fetch Historical Data
Retrieve OHLCV (Open, High, Low, Close, Volume) data:data/collectors.py:35-60 for implementation details.
Get Current Price
Get 24-Hour Statistics
data/collectors.py:74-91.
Connection Testing
Test your exchange configuration:data/collectors.py:93-100 for the test function.
Configuration Details
The collector is initialized with these settings (data/collectors.py:19-32):
Features
- Automatic rate limiting - Respects exchange API limits
- Data caching - Results cached for 60 seconds (configurable)
- Error handling - Graceful failures with error messages
- Multiple timeframes - Supports 1m, 5m, 15m, 1h, 4h, 1d
- Calculated fields - Auto-computes returns and log returns
Rate Limits
Binance
- Without API keys: 1200 requests/minute
- With API keys: 2400 requests/minute
- Weight-based system: Different endpoints cost different weights
Kraken
- Public endpoints: 1 request/second
- With API keys: Higher tier limits available
Troubleshooting
Connection Errors
If you see “Error conectando a exchange”:- Verify API keys are correct in
.env - Check API key permissions on exchange
- Ensure API key is not IP-restricted
- Verify your internet connection
Invalid API Keys
- Double-check
BINANCE_API_KEYandBINANCE_API_SECRETin.env - Verify API key is active on Binance
- Check API key permissions include “Enable Reading”
Rate Limit Exceeded
- The collector automatically handles rate limiting
- If you’re making manual requests, add delays between calls
- Consider using API keys for higher limits
Symbol Not Found
- Verify the trading pair exists on the exchange (e.g., ‘BTC/USDT’)
- Use correct format:
BASE/QUOTE(e.g., ‘ETH/USDT’, not ‘ETHUSDT’) - Check supported pairs in settings:
config/settings.py:12-16
Security Best Practices
Secure API Key Storage
Secure API Key Storage
- Store keys in
.envfile, never in code - Add
.envto.gitignore - Use environment variables in production
- Rotate keys periodically
Minimal Permissions
Minimal Permissions
- Only enable “Enable Reading” permission
- Disable all trading and withdrawal permissions
- Use IP restrictions when possible
- Create separate keys for different applications
Monitor API Usage
Monitor API Usage
- Regularly check API key activity on exchange
- Set up email alerts for unusual activity
- Revoke keys immediately if compromised
- Keep backup access methods configured
Next Steps
Configuration Settings
Learn about all configuration options
Telegram Setup
Configure price alerts and notifications