mql5/crypto
lingjie chen 1c54e87883 Sync crypto strategy with gold strategy updates:
1. Fix limit order execution in crypto/trading_bot.py by adding auto-price fallback.
2. Update crypto/qwen_client.py prompt to mandate explicit limit prices and MFE/MAE based SL/TP.
3. Update crypto/deepseek_client.py prompt to include performance stats and position context.
2025-12-29 16:00:07 +08:00
..
.env Update Telegram Bot Token to correct one 2025-12-28 12:26:20 +08:00
.env.example Update test database and secure example config 2025-12-28 00:08:01 +08:00
__init__.py Fix module execution paths and SL/TP logic for crypto bot 2025-12-27 23:33:19 +08:00
advanced_analysis.py Refactor: Separate Crypto/Gold strategies & Integrate Advanced Algos (SMC, MFH, WOAm) with Self-Learning AI 2025-12-28 22:54:33 +08:00
ai_client_factory.py Fix module execution paths and SL/TP logic for crypto bot 2025-12-27 23:33:19 +08:00
crypto_trading.db Auto update trading data: 2025-12-29 15:45:50 2025-12-29 15:45:50 +08:00
database_manager.py Refactor: Separate Crypto/Gold strategies & Integrate Advanced Algos (SMC, MFH, WOAm) with Self-Learning AI 2025-12-28 22:54:33 +08:00
deepseek_client.py Sync crypto strategy with gold strategy updates: 2025-12-29 16:00:07 +08:00
okx_data_processor.py Fix OKX timeframe format compatibility issue 2025-12-28 23:33:30 +08:00
optimization.py Update Gold and Crypto bots: optimize hold status display and enable self-learning optimization 2025-12-29 13:07:52 +08:00
qwen_client.py Sync crypto strategy with gold strategy updates: 2025-12-29 16:00:07 +08:00
README.md Add crypto trading bot strategy with OKX integration, AI analysis (DeepSeek/Qwen), and automated trading logic 2025-12-27 23:22:18 +08:00
requirements.txt Add crypto trading bot strategy with OKX integration, AI analysis (DeepSeek/Qwen), and automated trading logic 2025-12-27 23:22:18 +08:00
run_bot_watchdog.bat Update crypto watchdog script and ensure all changes are synced 2025-12-28 12:28:22 +08:00
run_bot_watchdog.sh Auto-install dependencies in watchdog scripts 2025-12-27 23:40:59 +08:00
trading_bot.py Sync crypto strategy with gold strategy updates: 2025-12-29 16:00:07 +08:00
visualization.py Refactor: Separate Crypto/Gold strategies & Integrate Advanced Algos (SMC, MFH, WOAm) with Self-Learning AI 2025-12-28 22:54:33 +08:00

OKX Crypto Trading Strategy

This project is a quantitative trading strategy designed for OKX cryptocurrency exchange, based on an AI-driven architecture using DeepSeek and Qwen models.

Project Structure

  • crypto/trading_bot.py: Main entry point for the trading bot. Orchestrates data fetching, AI analysis, and trade execution.
  • crypto/okx_data_processor.py: Handles interaction with OKX API via ccxt. Fetches OHLCV data and calculates technical indicators (EMA, RSI, ATR).
  • crypto/ai_client_factory.py: Factory for creating AI clients.
  • crypto/deepseek_client.py: Client for DeepSeek API (Market Structure Analysis).
  • crypto/qwen_client.py: Client for Qwen API (Strategy Optimization and Decision Making).
  • crypto/database_manager.py: Manages the SQLite database for trade logging.
  • crypto/.env: Configuration file for API keys.
  • crypto/requirements.txt: Python dependencies.

Setup

  1. Install Dependencies:

    pip install -r crypto/requirements.txt
    
  2. Configuration: The crypto/.env file has been pre-configured with your provided OKX API keys. Note: You need to add your SILICONFLOW_API_KEY to the .env file for the AI models to work.

  3. Run the Bot: To run a single pass of the strategy:

    python crypto/trading_bot.py
    

    Or use the watchdog script to keep it running:

    ./crypto/run_bot_watchdog.sh
    

Strategy Logic

  1. Data Acquisition: Fetches historical candle data from OKX.
  2. Feature Engineering: Calculates technical indicators (EMA, RSI, ATR, Volatility).
  3. Market Analysis (DeepSeek): Analyzes market structure, support/resistance, and trends.
  4. Decision Making (Qwen): Combines market analysis with technical signals to generate trading decisions (Buy/Sell/Hold) and manage risk (Stop Loss/Take Profit).
  5. Execution: Executes trades on OKX (currently in logging mode, uncomment execution lines in trading_bot.py to enable live trading).

Notes

  • The bot currently logs actions instead of executing real trades for safety. Review trading_bot.py's execute_trade method to enable real orders.
  • Ensure your API keys have the necessary permissions (Trade, Read).