Exchange Issues
This guide helps resolve problems related to exchange connectivity, API authentication, and trading operations.
API Authentication Issues
Invalid API Credentials
Problem: "Invalid API key" or "Authentication failed" errors.
Solution:
- Verify API key and secret in
user/secrets.toml - Check API key permissions on exchange
- Ensure API key is not expired
- Test with sandbox/testnet first
API Rate Limiting
Problem: "Rate limit exceeded" errors.
Solution:
IP Restrictions
Problem: API calls blocked due to IP restrictions.
Solution:
- Add your IP to exchange whitelist
- Use VPN if accessing from restricted region
- Contact exchange support for IP issues
Connectivity Issues
Network Timeouts
Problem: Connection timeouts to exchange APIs.
Solution:
SSL/TLS Issues
Problem: SSL certificate verification failures.
Solution:
Exchange-Specific Issues
Binance
Common Issues:
- API key restrictions (spot vs futures)
- Testnet vs mainnet confusion
- Symbol format differences
Solutions:
Coinbase Pro
Common Issues:
- Passphrase requirement
- Sandbox environment setup
Solutions:
[exchanges.coinbase]
api_key = "your_key"
secret = "your_secret"
passphrase = "your_passphrase"
sandbox = trueKraken
Common Issues:
- API tier limitations
- Symbol naming conventions
Solutions:
- Verify API tier supports required features
- Use correct symbol format (e.g., "XBTUSD" not "BTCUSD")
Data Issues
Missing Market Data
Problem: No price data available for symbol.
Solution:
- Verify symbol exists on exchange
- Check if market is active/trading
- Ensure timeframe is supported
- Test with different symbol
Incomplete Historical Data
Problem: Insufficient historical data for backtesting.
Solution:
Data Quality Issues
Problem: Gaps or inconsistencies in price data.
Solution:
Trading Issues
Order Placement Failures
Problem: Orders rejected by exchange.
Solution:
- Check minimum order size requirements
- Verify sufficient balance
- Ensure price is within allowed range
- Check market hours and status
Position Management Issues
Problem: Position size or margin calculations incorrect.
Solution:
Slippage Issues
Problem: Significant price slippage on orders.
Solution:
Monitoring and Debugging
Enable Debug Logging
Test Exchange Connectivity
Monitor API Usage
Emergency Procedures
Stop All Trading
# Activate Planar project
import Pkg
Pkg.activate("Planar")
try
using Planar
@environment!
# Emergency stop procedures (example)
function emergency_stop_example(exchange_name)
@warn "EMERGENCY STOP initiated for $exchange_name"
# Real implementation would be:
# emergency_stop(exchange)
# close_all_positions(exchange)
println("All orders would be cancelled")
println("All positions would be closed")
println("Trading would be halted")
end
# Example usage
emergency_stop_example("binance")
println("Emergency procedures defined")
catch e
@warn "Planar not available: $e"
endAPI Key Compromise
If you suspect API key compromise:
- Immediately disable API key on exchange
- Generate new API credentials
- Update
user/secrets.toml - Review recent trading activity
- Enable IP restrictions
Getting Help
For exchange-specific issues:
- Check exchange status pages
- Review exchange API documentation
- Contact exchange support
- Check Planar GitHub Issues
- Join community discussions