{"id":48781647,"url":"https://github.com/zd87pl/ai-crypto-trader","last_synced_at":"2026-04-13T14:35:35.685Z","repository":{"id":264467511,"uuid":"892888619","full_name":"zd87pl/ai-crypto-trader","owner":"zd87pl","description":"An experimental cryptocurrency trading system that combines AI-powered analysis with real-time market data and social sentiment monitoring. Features multiple microservices including market monitoring, social sentiment analysis, AI-driven trading signals, and automated trade execution. Built for fun.","archived":false,"fork":false,"pushed_at":"2026-03-08T02:08:35.000Z","size":730,"stargazers_count":67,"open_issues_count":3,"forks_count":13,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-08T06:55:37.209Z","etag":null,"topics":["ai","ai-trading","automated-trading-in-financial-markets","binance-api","crypto-trading","cryptocurrency","docker","machine-learning","openai","python","realtime","redis","sentiment-analysis","technical-analysis","trading-bot","trading-strategy","tradingbot"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zd87pl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-23T01:28:01.000Z","updated_at":"2026-03-08T01:15:43.000Z","dependencies_parsed_at":"2024-11-25T07:20:06.846Z","dependency_job_id":"0e99fa7d-f73c-44d5-9c8a-98701866c5c3","html_url":"https://github.com/zd87pl/ai-crypto-trader","commit_stats":null,"previous_names":["zd87pl/crypto-trader","zd87pl/ai-crypto-trader"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zd87pl/ai-crypto-trader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zd87pl%2Fai-crypto-trader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zd87pl%2Fai-crypto-trader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zd87pl%2Fai-crypto-trader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zd87pl%2Fai-crypto-trader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zd87pl","download_url":"https://codeload.github.com/zd87pl/ai-crypto-trader/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zd87pl%2Fai-crypto-trader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31757482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T13:27:56.013Z","status":"ssl_error","status_checked_at":"2026-04-13T13:21:23.512Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","ai-trading","automated-trading-in-financial-markets","binance-api","crypto-trading","cryptocurrency","docker","machine-learning","openai","python","realtime","redis","sentiment-analysis","technical-analysis","trading-bot","trading-strategy","tradingbot"],"created_at":"2026-04-13T14:35:34.903Z","updated_at":"2026-04-13T14:35:35.664Z","avatar_url":"https://github.com/zd87pl.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI Crypto Trader\n\n## ⚠️ Important Disclaimer\n\nThis project is an **experimental cryptocurrency trading system** designed for educational and research purposes only. \n\n**PLEASE NOTE:**\n- This is NOT financial advice\n- This is NOT investment advice\n- The trading signals and analyses generated are NOT recommendations to buy, sell, or trade any assets\n- The system's AI-generated insights should NOT be considered as professional trading guidance\n- Past performance does not guarantee future results\n- Cryptocurrency trading involves substantial risk of loss\n- You should never invest money you cannot afford to lose\n\nBy using this system, you acknowledge that you are doing so at your own risk and that the creators and contributors of this project cannot be held responsible for any financial losses incurred.\n\nThis project serves as a technical demonstration of integrating AI with cryptocurrency markets and should be treated as an educational resource for understanding automated trading systems.\n\n---\n\n## Dashboard\n\nThe project includes a modern, interactive dashboard that provides real-time insights into your trading system:\n\n![Dashboard Screenshot](https://placeholder-for-dashboard-screenshot.png)\n\n### Dashboard Features\n\n#### General Features\n- **Mobile Responsive Design**: Optimized for all devices from smartphones to desktop monitors\n- **Interactive Navigation**: Quick access to trading, portfolio, AI models, and risk sections\n- **Real-time Updates**: All data refreshes automatically at configurable intervals\n\n#### Trading Analytics\n- **Real-time Price Charts**: Interactive candlestick charts with technical indicators (RSI, MACD, Bollinger Bands)\n- **Trading Signals**: View recent trading signals with confidence levels and reasoning\n- **Trade History**: Monitor executed trades and performance\n- **Social Sentiment Analysis**: Track social media sentiment, volume, engagement, and contributors\n- **News Feed**: Latest crypto news affecting your trading pairs\n\n#### Portfolio Management\n- **Portfolio Overview**: Track total value, daily change, and asset allocation\n- **Performance Metrics**: Visual representation of portfolio growth over time\n- **Asset Allocation**: Monitor distribution of investments across different cryptocurrencies\n\n#### AI Model Insights\n- **Model Performance**: Track accuracy, profit factor, and trade counts over time\n- **Version Comparison**: Compare metrics across different AI model versions\n- **Feature Importance**: Visualize which features have the most influence on trading decisions\n- **Explainable AI**: Detailed breakdowns of how the AI reaches trading decisions\n\n#### Risk Management\n- **Portfolio Risk Metrics**: Monitor VaR (Value at Risk) and maximum drawdown\n- **Correlation Analysis**: Visualize asset correlations with interactive heatmaps\n- **Position Sizing**: Risk-optimized position sizing with volatility and correlation adjustments\n- **Adaptive Stop-Loss**: Visualize how stop-losses adapt to changing market volatility\n\n### Accessing the Dashboard\n\nWhen running the system with Docker Compose, the dashboard is available at:\n```\nhttp://localhost:8050\n```\n\nFor local setup, start the dashboard separately with:\n```bash\npython dashboard.py\n```\n\n## System Components\n\n### 1. Market Monitor Service\n- Monitors real-time market data from Binance\n- Calculates technical indicators and price changes across multiple timeframes (1m, 3m, 5m, 15m)\n- Publishes market updates to Redis\n- Logs to: `logs/market_monitor.log`\n\n### 2. Social Monitor Service\n- Fetches social metrics and news from LunarCrush API\n- Tracks social sentiment, engagement, and volume\n- Monitors news impact and social trends\n- Caches data to respect API rate limits\n- Logs to: `logs/social_monitor.log`\n\n### 3. AI Analyzer Service\n- Processes market updates using OpenAI GPT-4\n- Incorporates social sentiment and news analysis\n- Generates context-aware trading signals\n- Publishes trading signals to Redis\n- Logs to: `logs/ai_analyzer.log`\n\n### 4. Trade Executor Service\n- Executes trades based on AI analysis signals\n- Manages positions and risk\n- Updates portfolio holdings\n- Logs to: `logs/trade_executor.log`\n\n### 5. Strategy Evolution Service\n- Self-improves trading strategies based on performance data\n- Uses AI to generate and refine trading approaches\n- Integrates social sentiment data into strategy optimization\n- Applies genetic algorithms and GPT-based optimization\n- Maintains a history of strategy performance\n- Logs to: `logs/strategy_evolution.log`\n\n### 6. Market Regime Service\n- Detects market regimes (bull, bear, ranging, volatile)\n- Adapts trading strategies to current market conditions\n- Tracks strategy performance across different regimes\n- Logs to: `logs/market_regime.log`\n\n### 7. Strategy Selection Service\n- Automatically selects optimal trading strategies\n- Considers multiple factors: market regime, historical performance, risk profile, social sentiment\n- Implements time-based adjustments for different market hours\n- Uses advanced scoring algorithms with configurable weights\n- Adapts to changing market conditions in real-time\n- Makes data-driven strategy switching decisions\n- Logs to: `logs/strategy_selection.log`\n\n### 8. Social Strategy Integrator\n- Analyzes correlation between social sentiment and price movements\n- Identifies lead/lag relationships in social metrics\n- Generates specialized strategies based on social patterns\n- Optimizes trading parameters based on social sentiment\n- Creates social-specific strategy variants (trend-following, contrarian, etc.)\n- Provides social impact scores for strategy selection\n- Logs to: `logs/social_strategy.log`\n\n### 9. Backtesting Framework\n- Fetches and manages historical market and social data\n- Simulates trading strategy performance on historical data\n- Integrates with the AI trading logic for realistic backtests\n- Generates performance analytics and visualizations\n- Detailed documentation in `backtesting/README.md`\n\n### 10. Model Registry Service\n- Tracks AI model versions and performance metrics\n- Provides version control for trading models\n- Maintains a registry of all model versions\n- Enables model comparison and selection\n- Logs to: `logs/model_registry.log`\n\n### 11. AI Explainability Service\n- Enhances trading decisions with detailed explanations\n- Visualizes factor weights influencing decisions\n- Provides technical and social factors analysis\n- Explains the reasoning behind each trade\n- Logs to: `logs/ai_explainability.log`\n\n### 12. Feature Importance Analyzer\n- Analyzes the importance of different features in machine learning models\n- Uses permutation importance and RandomForest feature analysis\n- Identifies which indicators have the most influence on trading decisions\n- Categorizes features by group (price action, momentum, volatility, trend, volume, social)\n- Generates visualizations and comprehensive reports\n- Creates optimized models by pruning low-importance features\n- Publishes results to other services via Redis\n- Provides real-time feature importance tracking in the dashboard\n- Helps focus data collection on high-value indicators\n- Logs to: `logs/feature_importance.log`\n\n### 13. Market Regime Detection Service\n- Identifies current market conditions using machine learning and rule-based systems\n- Classifies markets into four regimes: bull, bear, ranging, and volatile\n- Uses multiple detection methods: KMeans, Gaussian Mixture Models, Hidden Markov Models\n- Provides regime probabilities and confidence scores\n- Adapts trading strategies to current market conditions\n- Analyzes historical performance of strategies in different regimes\n- Generates market regime visualizations\n- Monitors regime changes and triggers strategy switching\n- Supports dynamic machine learning model retraining\n- Logs to: `logs/market_regime.log`\n\n### 14. Portfolio Risk Management Service\n- Implements portfolio-wide risk management\n- Calculates Value at Risk (VaR) across the entire portfolio\n- Provides adaptive stop-losses based on market volatility\n- Optimizes position sizing for better risk-adjusted returns\n- Monitors asset correlations for improved diversification\n- Logs to: `logs/portfolio_risk.log`\n\n### 14. Social Risk Adjuster Service\n- Dynamically adjusts risk parameters based on social sentiment\n- Modifies position sizes, stop-losses, and take-profit levels\n- Applies time decay to social sentiment influence\n- Adjusts correlation thresholds based on social metrics\n- Detects volatility patterns in social engagement\n- Applies different adjustment strategies for bullish/bearish sentiment\n- Includes data quality assessment for reliable adjustments\n- Logs to: `logs/social_risk_adjuster.log`\n\n### 15. Monte Carlo Simulation Service\n- Generates thousands of price path simulations for future risk projection\n- Implements multiple simulation methods (geometric Brownian motion, historical)\n- Calculates Value at Risk (VaR) and Conditional VaR metrics\n- Scenarios analysis for different market conditions (bull, bear, volatile, etc.)\n- Creates probability distributions for future price movements\n- Analyzes maximum drawdown scenarios\n- Generates visual representations of price path simulations\n- Produces comprehensive risk reports for the entire portfolio\n- Logs to: `logs/monte_carlo.log`\n\n### 16. Neural Network Price Prediction Service\n- Implements deep learning models for cryptocurrency price prediction\n- Supports multiple neural network architectures (LSTM, GRU, Bidirectional LSTM, CNN-LSTM, Attention)\n- Enables ensemble models combining multiple architectures for improved predictions\n- Generates predictions for multiple timeframes (1h, 4h, 24h)\n- Provides prediction confidence scores and directional indicators\n- Features automatic training and model tuning capabilities\n- Creates visualizations for both predictions and training performance\n- Supports real-time model evaluation and adaptation\n- Integrates with trading strategies for signal optimization\n- Logs to: `logs/neural_network.log`\n\n## Environment Setup\n\n1. Create a `.env` file with the following credentials:\n```env\n# Binance API credentials\nBINANCE_API_KEY=your_binance_api_key\nBINANCE_API_SECRET=your_binance_api_secret\n\n# OpenAI API credentials\nOPENAI_API_KEY=your_openai_api_key\n\n# LunarCrush API credentials\nLUNARCRUSH_API_KEY=your_lunarcrush_api_key\n\n# Service ports\nMARKET_MONITOR_PORT=8001\nTRADE_EXECUTOR_PORT=8002\nAI_ANALYZER_PORT=8003\nSTRATEGY_EVOLUTION_PORT=8004\nSOCIAL_MONITOR_PORT=8005\nMODEL_REGISTRY_PORT=8006\nAI_EXPLAINABILITY_PORT=8007\nSOCIAL_RISK_PORT=8008\nMONTE_CARLO_PORT=8009\n\n# Redis configuration\nREDIS_HOST=redis\nREDIS_PORT=6379\n```\n\n## Getting Started\n\n### With Docker (Recommended)\n\n1. Make sure you have Docker and Docker Compose installed\n2. Clone the repository and navigate to the project directory\n3. Create your `.env` file with the required credentials\n4. Start all services with:\n\n```bash\ndocker-compose up -d\n```\n\nThis will start all services, including the dashboard which will be available at `http://localhost:8050`.\n\n### Local Development\n\n1. Install the required dependencies:\n\n```bash\npip install -r requirements.txt\n```\n\n2. Create your `.env` file with the required credentials\n3. Start each service separately:\n\n```bash\n# Start the market monitor\npython services/market_monitor_service.py\n\n# Start the social monitor\npython services/social_monitor_service.py\n\n# Start the AI analyzer\npython services/ai_analyzer_service.py\n\n# Start the trade executor\npython services/trade_executor_service.py\n\n# Start the strategy evolution service\npython services/strategy_evolution_service.py\n\n# Start the market regime service\npython services/market_regime_service.py\n\n# Start the strategy selection service\npython services/strategy_selection_service.py\n\n# Start the social strategy integrator\npython services/social_strategy_integrator.py\n\n# Start the model registry service\npython run_ai_model_services.py --model-registry\n\n# Start the AI explainability service\npython run_ai_model_services.py --explainability\n\n# Start the feature importance analyzer\npython services/feature_importance_analyzer.py\n\n# Start the social risk adjuster service\npython services/social_risk_adjuster.py\n\n# Start the Monte Carlo simulation service\npython services/monte_carlo_service.py\n\n# Start the Neural Network price prediction service\npython services/neural_network_service.py\n\n# Start the dashboard\npython dashboard.py\n\n# Or use the integrated run_trader.py script to run everything together (recommended)\npython run_trader.py\n```\n\n### Using the Backtesting Framework\n\nThe backtesting framework allows you to test trading strategies on historical data:\n\n1. Fetch historical data for Bitcoin (1-hour intervals, past 30 days):\n```bash\npython run_backtest.py fetch --symbols BTCUSDC --intervals 1h --days 30\n```\n\n2. Run a backtest on the fetched data:\n```bash\npython run_backtest.py backtest --symbols BTCUSDC --intervals 1h --days 30 --balance 10000\n```\n\n3. View your available historical data:\n```bash\npython run_backtest.py list\n```\n\n4. Analyze backtest results:\n```bash\npython run_backtest.py analyze --metric sharpe_ratio\n```\n\nFor more detailed instructions, see `backtesting/README.md`.\n\n## Data Structures\n\n### Market Data\n```json\n{\n    \"symbol\": \"BTCUSDC\",\n    \"current_price\": 42150.75,\n    \"avg_volume\": 1250000.25,\n    \"timestamp\": \"2024-11-24T21:33:45.029Z\",\n    \"rsi\": 55.32,\n    \"rsi_3m\": 54.18,\n    \"rsi_5m\": 53.95,\n    \"stoch_k\": 65.43,\n    \"macd\": 0.00123,\n    \"macd_3m\": 0.00156,\n    \"macd_5m\": 0.00189,\n    \"williams_r\": -34.57,\n    \"bb_position\": 0.65,\n    \"trend\": \"uptrend\",\n    \"trend_strength\": 0.75,\n    \"price_change_1m\": 0.12,\n    \"price_change_3m\": 0.25,\n    \"price_change_5m\": 0.38,\n    \"price_change_15m\": 0.52\n}\n```\n\n### Social Data\n```json\n{\n    \"symbol\": \"BTCUSDC\",\n    \"data\": {\n        \"metrics\": {\n            \"social_volume\": 15000,\n            \"social_engagement\": 25000,\n            \"social_contributors\": 1200,\n            \"social_sentiment\": 0.75,\n            \"twitter_volume\": 8000,\n            \"reddit_volume\": 3000,\n            \"news_volume\": 150\n        },\n        \"weighted_sentiment\": 0.68,\n        \"recent_news\": [\n            {\n                \"title\": \"Major Partnership Announcement\",\n                \"sentiment\": 0.85,\n                \"engagement\": 12000\n            }\n        ],\n        \"timestamp\": \"2024-11-24T21:33:45.029Z\"\n    }\n}\n```\n\n### Social Risk Adjustment\n```json\n{\n    \"symbol\": \"BTCUSDC\",\n    \"sentiment_score\": 0.75,\n    \"sentiment_type\": \"BULLISH\",\n    \"position_size_adj\": 0.15,\n    \"stop_loss_adj\": -0.1,\n    \"take_profit_adj\": 0.2,\n    \"correlation_threshold_adj\": 0.1,\n    \"volatility_adj\": 0.08,\n    \"timestamp\": \"2024-11-24T21:33:45.029Z\",\n    \"confidence\": 0.85\n}\n```\n\n### Feature Importance Analysis\n```json\n{\n    \"timestamp\": \"2024-11-24T14:30:00.000Z\",\n    \"analysis_type\": \"feature_importance\",\n    \"model_type\": \"RandomForest\",\n    \"feature_count\": 24,\n    \"top_features_permutation\": {\n        \"social_sentiment\": 0.145,\n        \"rsi\": 0.132,\n        \"social_volume\": 0.118,\n        \"price_change_5m\": 0.097,\n        \"bb_position\": 0.089,\n        \"macd\": 0.082,\n        \"social_engagement\": 0.076,\n        \"stoch_k\": 0.067,\n        \"williams_r\": 0.058,\n        \"trend_strength\": 0.054\n    },\n    \"top_categories\": {\n        \"social\": 0.325,\n        \"momentum\": 0.257,\n        \"price_action\": 0.218,\n        \"volatility\": 0.124,\n        \"trend\": 0.076\n    },\n    \"recommendations\": {\n        \"features_to_prioritize\": [\n            \"social_sentiment\",\n            \"rsi\",\n            \"social_volume\",\n            \"price_change_5m\",\n            \"bb_position\"\n        ],\n        \"features_to_reconsider\": [\n            \"ichimoku_a\",\n            \"ichimoku_b\",\n            \"vwap\",\n            \"price_change_30m\",\n            \"sma_200\"\n        ],\n        \"categories_to_prioritize\": [\n            \"social\",\n            \"momentum\"\n        ],\n        \"categories_to_reconsider\": [\n            \"volume\"\n        ]\n    }\n}\n```\n\n### Market Regime Detection\n```json\n{\n    \"regime\": \"bull\",\n    \"confidence\": 0.87,\n    \"probs\": {\n        \"bull\": 0.65,\n        \"volatile\": 0.25,\n        \"ranging\": 0.08,\n        \"bear\": 0.02\n    },\n    \"timestamp\": \"2024-11-24T15:45:22.134Z\",\n    \"data_end\": \"2024-11-24T15:45:00.000Z\"\n}\n```\n\n### Neural Network Price Prediction\n```json\n{\n    \"symbol\": \"BTCUSDC\",\n    \"interval\": \"4h\",\n    \"current_price\": 42150.75,\n    \"predicted_price\": 42950.25,\n    \"change_pct\": 1.89,\n    \"prediction_time\": \"2024-11-24T21:33:45.029Z\",\n    \"reference_time\": \"2024-11-24T17:33:45.029Z\",\n    \"confidence\": 0.75,\n    \"model_type\": \"lstm\",\n    \"status\": \"success\",\n    \"training_metrics\": {\n        \"val_loss\": 0.0023,\n        \"val_mae\": 0.0374,\n        \"epochs_trained\": 87\n    },\n    \"features_used\": [\n        \"close\", \n        \"volume\", \n        \"rsi\", \n        \"macd\", \n        \"bb_position\"\n    ]\n}\n```\n\n### Trading Signals\n```json\n{\n    \"decision\": \"BUY\",\n    \"confidence\": 0.85,\n    \"reasoning\": \"Strong technical indicators with positive social sentiment\",\n    \"risk_level\": \"MEDIUM\",\n    \"key_indicators\": [\n        \"RSI trending up\",\n        \"High social engagement\",\n        \"Positive news sentiment\"\n    ],\n    \"social_impact\": \"High positive sentiment with strong engagement\",\n    \"timestamp\": \"2024-11-24T21:33:45.033Z\",\n    \"symbol\": \"BTCUSDC\",\n    \"model_version\": \"ai_trader_gpt_4o_a1b2c3d4\",\n    \"model_id\": \"a1b2c3d4\",\n    \"selected_strategy\": {\n        \"name\": \"social_trend_following_v3\",\n        \"type\": \"trend_following\",\n        \"social_optimization\": true,\n        \"market_regime\": \"bull\",\n        \"performance_score\": 0.87,\n        \"risk_profile\": \"medium\",\n        \"social_correlation\": 0.72,\n        \"time_period\": \"3h\",\n        \"selection_factors\": {\n            \"social_sentiment_score\": 0.85,\n            \"market_regime_score\": 0.92,\n            \"historical_performance\": 0.78,\n            \"risk_score\": 0.76\n        }\n    },\n    \"explanation\": {\n        \"summary\": \"Strong bullish signals with technical indicators and social sentiment aligned\",\n        \"technical_factors\": \"RSI at 55.32 showing momentum, MACD positive and increasing, price breaking above resistance\",\n        \"social_factors\": \"High social engagement (25,000) with very positive sentiment (0.75), increasing social volume\",\n        \"social_lead_lag\": \"Social sentiment leads price action by approximately 45 minutes\",\n        \"correlation_strength\": \"Strong correlation (0.72) between social metrics and price movements\",\n        \"key_indicators\": [\"RSI\", \"MACD\", \"Social sentiment\", \"Price action\"],\n        \"risk_assessment\": \"Medium risk due to some market volatility, but strong technical and social indicators support the trade\"\n    },\n    \"factor_weights\": {\n        \"technical_indicators\": {\n            \"rsi\": 0.25,\n            \"macd\": 0.30,\n            \"bollinger_bands\": 0.15,\n            \"price_action\": 0.20,\n            \"other\": 0.10\n        },\n        \"social_metrics\": {\n            \"sentiment\": 0.50,\n            \"volume\": 0.30,\n            \"engagement\": 0.20\n        },\n        \"market_regime\": 0.25,\n        \"strategy_performance\": 0.30,\n        \"social_correlation\": 0.30\n    }\n}\n```\n\n## Error Handling\n\n### Market Monitor Errors\n- Connection issues with Binance: Retries with exponential backoff\n- Redis connection failures: Automatic reconnection attempts\n- Invalid market data: Logged and skipped\n\n### Social Monitor Errors\n- LunarCrush API rate limits: Cached data with configurable duration\n- Missing social metrics: Falls back to default neutral values\n- News processing errors: Skips problematic items while preserving valid ones\n\n### Social Strategy Integrator Errors\n- Correlation analysis failures: Falls back to conservative defaults\n- Strategy generation errors: Retries with alternative parameters\n- Social data synchronization issues: Uses time-windowed matching\n- Lead/lag detection failures: Defaults to concurrent correlation\n\n### AI Analyzer Errors\n- OpenAI API failures: Logged with full error context\n- Missing market/social data: Detailed validation errors\n- Redis publishing errors: Automatic retry mechanism\n\n### Trade Executor Errors\n- Insufficient balance: Logged and trade skipped\n- Order placement failures: Full error context with retry attempts\n- Position management errors: Detailed error tracking\n\n### Strategy Selection Errors\n- Missing factor data: Uses weighted average of available factors\n- Strategy switching conflicts: Implements cool-down periods\n- Time-based adjustment failures: Reverts to default strategy weights\n\n## Monitoring and Debugging\n\n### Log Locations\n- All logs are stored in the `logs/` directory\n- Each service has its own log file with rotation enabled\n- Log files are limited to 10MB with 5 backup files\n\n### Common Issues and Solutions\n\n1. LunarCrush API Rate Limits\n```\nERROR - [SocialMonitor] Rate limit exceeded\n```\nSolution: Adjust cache_duration in config.json\n\n2. Missing Social Data\n```\nERROR - [AIAnalyzer] Missing social metrics for symbol\n```\nSolution: Verify LunarCrush API key and symbol support\n\n3. OpenAI API Errors\n```\nERROR - [AIAnalyzer] OpenAI API error: Invalid model specified\n```\nSolution: Check OpenAI configuration and API key validity\n\n4. Social Correlation Errors\n```\nERROR - [SocialStrategyIntegrator] Insufficient data points for correlation analysis\n```\nSolution: Ensure sufficient historical social data is available for the symbol\n\n5. Strategy Selection Conflicts\n```\nERROR - [StrategySelection] Rapid strategy switching detected, enforcing cool-down period\n```\nSolution: Adjust strategy_switch_threshold in config.json\n\n## Performance Monitoring\n\nThe system tracks:\n- Portfolio value updates\n- Trade success rates\n- API response times\n- Social sentiment accuracy\n- Error frequencies\n- System resource usage\n\nExample monitoring log:\n```\n2024-11-24 21:33:45,400 - INFO - [TradeExecutor] Updated holdings - Total Portfolio Value: $257.65\n2024-11-24 21:33:45,401 - INFO - [TradeExecutor] Available USDC: $1.18\n2024-11-24 21:33:45,402 - INFO - [SocialMonitor] Social sentiment accuracy: 82%\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzd87pl%2Fai-crypto-trader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzd87pl%2Fai-crypto-trader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzd87pl%2Fai-crypto-trader/lists"}