live_trading_system/
βββ core/ # Core trading components
β βββ complete_trading_system.py
β βββ hybrid_trading_system.py
β βββ bias_analyzer.py
β βββ fvg_detector.py
β βββ cisd_3m_analyzer.py
β βββ fvg_visualizer.py
β βββ config.py
βββ data/ # Data storage
β βββ feedback_history.json
β βββ trade_history.json
βββ logs/ # Trading logs
βββ backup/ # Backup files
βββ live_trader.py # Main live trading script
βββ feedback_manager.py # Feedback management tool
βββ backtest_model.py # Backtesting runner (from this folder)
βββ README.md
- Automatic Learning: System learns from trade outcomes
- LLM Integration: Uses feedback to improve LLM decisions
- Performance Tracking: Tracks accuracy and performance metrics
- Historical Analysis: Analyzes past decisions and outcomes
- Daily Bias Analysis (once per day)
- LLM Validation (uses feedback learning)
- 4H FVG Monitoring (every 4 hours)
- 3M Continuation Analysis (every 3 minutes)
- Trade Execution (when all conditions met)
- Continuous market monitoring
- Automatic trade execution
- Comprehensive logging
- Performance tracking
cd live_trading_system
python live_trader.pypython backtest_model.py 12 # Backtest for 12 monthspython feedback_manager.py summarypython feedback_manager.py add --date 2024-12-31 --bias Buy --llm YES --outcome profitable --reason "Strong trend continuation"- Trade Execution: System executes trades based on algorithm + LLM
- Outcome Tracking: You manually add trade outcomes
- Learning: LLM uses feedback to improve future decisions
- Performance: System tracks accuracy and learning progress
python feedback_manager.py summarypython feedback_manager.py add \
--date 2024-12-31 \
--bias Buy \
--llm YES \
--outcome profitable \
--reason "Strong trend continuation, good entry timing"python feedback_manager.py export --file my_feedback.jsonpython feedback_manager.py import --file my_feedback.jsonpython feedback_manager.py clear- Never commit your API keys to the repository!
- Use environment variables or a
.envfile to store sensitive keys. - Example keys required:
OPENAI_API_KEY(for LLM/feedback learning)POLYGON_API_KEY(for market data)
- You can create a
.envfile in the project root orlive_trading_system/folder:OPENAI_API_KEY=sk-... POLYGON_API_KEY=... SYMBOL=C:XAUUSD
- Copy or rename
core/config.example.pytocore/config.pyand set values to useos.environ.get()for keys. .envis already in.gitignorefor your safety.
- On Mac/Linux:
export OPENAI_API_KEY=sk-... export POLYGON_API_KEY=...
- Or use a
.envfile as above (recommended for local dev).
- Symbol: Gold (XAUUSD)
- Timeframes: Daily, 4H, 3M
- Risk-Reward: 2:1
- Timezone: New York (EST)
- OpenAI/LLM Usage:
- This system uses OpenAI (or other LLM) APIs for feedback learning and trade validation.
- You are responsible for your own API usage and costs.
- Make sure to fund your OpenAI account or any other LLM provider you use.
- The system will not work without a valid API key and sufficient balance.
- Location:
logs/live_trading_YYYYMMDD_HHMMSS.log - Real-time trading activity
- Error tracking and debugging
- Location:
data/trade_history.json - All executed trades
- Entry, exit, and performance data
- Location:
data/feedback_history.json - Learning data for LLM
- Performance metrics
- β No Real Money: This is a paper trading system
- β Backup System: Automatic backups before changes
- β Error Handling: Comprehensive error handling
- β Logging: Detailed logging for debugging
- Start Small: Test with small amounts first
- Monitor Logs: Check logs regularly for issues
- Add Feedback: Regularly add trade outcomes
- Backup Data: Export feedback regularly
- Update APIs: Keep API keys current
- Never share your API keys publicly!
- Runs once per day at market open
- Analyzes 30 days of daily data
- Generates Buy/Sell/Neutral bias
- Uses feedback learning from past trades
- Considers market context and bias strength
- Provides YES/NO decision with reasoning
- Checks every 4 hours for FVG retracements
- Monitors price proximity to active FVGs
- Triggers when price enters FVG zone
- Analyzes 3-minute data for continuation models
- Looks for CISD patterns after FVG retracement
- Identifies optimal entry points
- Calculates 2:1 risk-reward levels
- Places stop loss and take profit
- Records trade details for feedback
- API Errors: Check API keys and limits
- No Trades: Market conditions may not meet criteria
- Feedback Errors: Ensure correct date format (YYYY-MM-DD)
- Check logs in
logs/directory - Verify API keys in
core/config.pyor your.envfile - Test individual components separately
- Win Rate: Tracked in feedback summary
- LLM Accuracy: Learning from feedback
- Trade Frequency: Based on market conditions
- Risk Management: 2:1 risk-reward maintained
- Feedback Entries: More data = better learning
- Accuracy Improvement: Should improve over time
- Decision Quality: LLM decisions become more refined
π Ready to start live trading with feedback learning!