一个为捕捉市场极端波动而生的、拥有“猎手级”智能扫描引擎的OKX现货交易机器人。
A spot trading bot for OKX, engineered to capture extreme market volatility with its "Hunter-Class" intelligent scanning engine.
Languages:
English (Click to Expand)
Most trading bots are passive. You tell them what to trade, and they execute. This bot is a hunter. It actively seeks out the most volatile and potentially profitable opportunities in the market for you.
| Feature | Standard Bots | Volatility Hunter Bot |
|---|---|---|
| Opportunity Discovery | ❌ Manual (User must find coins) | ✅ Automatic: "Gem Hunter" engine scans the entire market to find the best coins. |
| Parameter Configuration | Manual & Complex | ✅ Intelligent: Recommends optimized parameters based on real-time volatility. |
| Strategy Adaptability | Often rigid | ✅ Dual-Mode: Adapts strategy (Grid/Sniper) based on your capital size. |
| Risk Management | Basic Stop-Loss | ✅ Dynamic: High-frequency Guardian thread ensures a precise trailing stop-loss. |
| User Experience | Command-line or basic UI | ✅ Modern & Intuitive: Full-featured GUI with internationalization (EN/ZH). |
This is the core of the bot. It's not just a simple volume filter. The engine analyzes every USDT pair on OKX and assigns a "Volatility Score" based on a multi-factor weighted model:
- ATR (Average True Range): Measures raw price volatility.
- Pin Bar Analysis: Detects assets with recent high-wick candles ("pins"), a strong indicator of volatility and liquidity battles.
- Trading Activity (TPM): Measures trades-per-minute to gauge market interest and activity.
- Liquidity: Ensures the asset has enough volume for safe entry and exit.
The bot then presents you with the top-scoring asset, turning market chaos into a clear, actionable trading signal.
Stop guessing parameters. Based on the "Gem Hunter's" analysis, the bot instantly recommends a full strategy profile:
- Dynamic Spread & Step: Wider spreads for highly volatile assets, tighter for calmer ones.
- Adaptive Grid Density: Automatically adjusts the number of grid pairs based on capital and volatility, maximizing capital efficiency.
- ATR-Based Stop-Loss: Sets a logical stop-loss distance based on the asset's actual recent volatility.
Risk management cannot be slow. The Guardian runs in a separate, high-priority thread, polling the price at a much higher frequency than the main trading loop. This decoupling ensures that your trailing stop-loss is monitored with millisecond precision, protecting your capital from sudden market crashes, independent of any other task the bot is performing.
This bot is a powerful tool in its current state, but it's important to understand its scope. This project is under active development, and here's a look at what's planned for the future.
- ✅ OKX-Exclusive: The current version is tightly integrated with the OKX v5 API for spot trading.
- ✅ Standalone Engine: The bot relies entirely on its internal "Gem Hunter" scanning engine. It does not currently support external signals from platforms like TradingView (via webhooks).
- ✅ Focused Trading: The bot is designed to find the single best trading opportunity and focus on it. It does not support running strategies on multiple currency pairs simultaneously.
- 🔹 Multi-Exchange Integration: The top priority is to refactor the API client into a modular structure, allowing for the addition of other major exchanges like Binance, Bybit, or KuCoin.
- 🔹 TradingView Webhook Support: A major upcoming feature will be the ability to listen for webhook alerts from TradingView, allowing users to execute their own custom strategies.
- 🔹 Multi-Symbol Portfolio Mode: An advanced mode that would allow the bot to run multiple, independent strategies on different coins at the same time.
- 🔹 Strategy Backtesting: Integrating a simple backtesting framework to test strategy parameters on historical data.
-
Clone the Repository
git clone https://github.com/UPwith-me/Orion-Trader.git
-
Navigate & Create Virtual Environment (Recommended)
cd Orion-Trader python -m venv venv -
Activate Environment & Install Dependencies
# Activate on Windows .\venv\Scripts\activate # Activate on macOS/Linux source venv/bin/activate # Install requirements pip install -r requirements.txt
-
Configure API Keys
- Find the
.env.examplefile in the project directory. - Make a copy of it and rename the copy to
.env. - Open the
.envfile and fill in your OKX API keys.
- Find the
Launch the GUI with python okx_bot.py. The workflow is designed to be intuitive: Scan -> Review -> Start.
This project is for educational purposes. Cryptocurrency trading involves significant risk. The author is not responsible for any financial losses. Use at your own risk.
中文 (点击展开)
大多数交易机器人都很被动——你告诉它交易什么,它才执行。而这个机器人,是一个猎手。 它主动为你出击,在整个市场中搜寻最混乱、最剧烈、也最有可能盈利的机会。
| 功能亮点 | 普通机器人 | 妖币猎手机器人 |
|---|---|---|
| 机会发现 | ❌ 手动选择 (用户必须自己找币) | ✅ 全自动: “妖币猎手”引擎扫描全市场,找到最佳交易对。 |
| 参数配置 | 手动设置,复杂且凭感觉 | ✅ 智能化: 基于实时波动率,一键生成最优参数建议。 |
| 策略适应性 | 通常很死板 | ✅ 双模式: 根据资金规模,自动切换“网格”或“狙击”策略。 |
| 风险管理 | 基础的固定止损 | ✅ 动态化: 独立的高频“守护者”线程,实现毫秒级精准追踪止损。 |
| 用户体验 | 命令行或简陋界面 | ✅ 现代化: 功能完整的图形界面,并支持中英双语切换。 |
这是机器人的灵魂。它不是简单的成交量过滤器,而是对OKX上所有USDT交易对进行分析,并根据一个多因子加权模型给出一个“波动率分数”:
- ATR (平均真实波幅): 衡量原始的价格波动烈度。
- 插针分析 (Pin Bar): 识别近期出现长上下影线的资产。这种“插针”行为是波动性和多空博弈的最强信号。
- 交易活跃度 (TPM): 计算每分钟的成交笔数,衡量市场关注度和交投热度。
- 流动性分析: 确保资产有足够的深度,让大资金也能安全进出。
最终,机器人会将评分最高的“猎物”呈现在你面前,将纷繁的市场噪音,转化为一个清晰、可执行的交易信号。
告别猜测参数。基于“妖币猎手”的分析结果,机器人能瞬间为你推荐一整套策略档案:
- 动态价差与步长: 对高波动资产使用更宽的价差网,对平稳资产则更密集,以适应不同节奏。
- 自适应网格密度: 根据你的资金和市场波动性,自动调整网格对数,最大化资金效率。
- ATR动态止损: 基于资产近期的真实波动幅度,设定一个逻辑严密的初始止损距离。
风险管理,唯快不破。“守护者”在一个独立的、高优先级的线程中运行,它轮询价格的频率远高于主交易循环。这种“解耦”设计确保了你的追踪止损能被毫秒级精确监控,使其在市场闪崩时能第一时间保护你的本金,而不受机器人其他任务(如下单、日志记录)的任何影响。
当前版本的机器人已是一个强大工具,但了解其明确的设计范围同样重要。这是一个活跃开发中的项目,以下是我们对未来的规划。
- ✅ OKX 交易所专属: 当前版本为 OKX v5 API 深度集成,专注于现货交易。
- ✅ 内置引擎驱动: 机器人完全依赖其内置的“妖币猎手”扫描引擎来发现机会,暂不支持接收 TradingView 等外部平台的信号(例如通过 Webhook)。
- ✅ 单币种专注策略: 机器人的核心设计是找到当下市场中唯一最佳的交易机会并集中处理,暂不支持在多个币种上同时运行多个策略。
- 🔹 多交易所支持: 最高优先级是将API客户端重构为模块化结构,以便未来能接入币安 (Binance)、Bybit、KuCoin 等其他主流交易所。
- 🔹 TradingView Webhook 对接: 一个重要的新功能,使机器人能接收来自 TradingView 的告警信号,从而执行用户的自定义策略。
- 🔹 多币种组合模式: 开发一种高级模式,允许机器人在多个不同币种上,同时运行多个独立的交易策略。
- 🔹 策略回测框架: 集成一个简单的回测系统,用于在历史数据上测试策略参数的有效性。
-
克隆仓库
git clone https://github.com/UPwith-me/Orion-Trader.git
-
进入目录并创建虚拟环境 (推荐)
cd Orion-Trader python -m venv venv -
激活环境并安装依赖
# 在 Windows 上激活 .\venv\Scripts\activate # 在 macOS/Linux 上激活 source venv/bin/activate # 安装依赖 pip install -r requirements.txt
-
配置API密钥
- 找到项目目录中的
.env.example文件。 - 复制该文件,并将副本重命名为
.env。 - 打开
.env文件,填入你从OKX官网申请的API密钥。
- 找到项目目录中的
运行 python okx_bot.py 启动图形界面。整个工作流非常直观:扫描 -> 审查 -> 启动。
本项目仅为技术研究目的,数字货币交易风险极高。作者对使用此软件造成的任何资金损失概不负责。请您务必自行承担风险。

