Fix: Restore English README.md

This commit is contained in:
tinkle-community
2025-10-28 22:16:42 +08:00
parent a726702302
commit 3eabfbb402

655
README.md
View File

@@ -1,136 +1,140 @@
# 🤖 NOFX - AI驱动的币安合约自动交易竞赛系统
# 🤖 NOFX - AI-Driven Binance Futures Auto Trading Competition System
[![Go Version](https://img.shields.io/badge/Go-1.21+-00ADD8?style=flat&logo=go)](https://golang.org/)
[![React](https://img.shields.io/badge/React-18+-61DAFB?style=flat&logo=react)](https://reactjs.org/)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-3178C6?style=flat&logo=typescript)](https://www.typescriptlang.org/)
[![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
一个基于 **DeepSeek/Qwen AI** 的币安合约自动交易系统,支持**多AI模型实盘竞赛**具备完整的市场分析、AI决策、**自我学习机制**和专业的Web监控界面。
> ⚠️ **风险提示**本系统为实验性项目AI自动交易存在重大风险强烈建议仅用于学习研究或小额资金测试
**Languages:** [English](README.md) | [中文](README.zh-CN.md) | [Українська](README.uk.md) | [Русский](README.ru.md)
---
## ✨ 核心特性
An automated Binance futures trading system powered by **DeepSeek/Qwen AI**, supporting **multi-AI model live trading competition**, featuring comprehensive market analysis, AI decision-making, **self-learning mechanism**, and professional Web monitoring interface.
### 🏆 多AI竞赛模式
- **Qwen vs DeepSeek** 实盘对抗
- 独立账户管理,独立决策日志
- 实时性能对比图表
- 收益率PK胜率统计
### 🧠 AI自我学习机制NEW
- **历史反馈**: 每次决策前分析最近20个周期的交易表现
- **智能优化**:
- 识别表现最佳/最差币种
- 计算胜率、盈亏比、平均盈利
- 避免重复错误(连续亏损的币种)
- 强化成功策略(高胜率的交易模式)
- **动态调整**: AI根据历史表现自主调整交易风格
### 📊 智能市场分析
- **3分钟K线**: 实时价格、EMA20、MACD、RSI(7)
- **4小时K线**: 长期趋势、EMA20/50、ATR、RSI(14)
- **持仓量分析**: 市场情绪、资金流向判断
- **OI Top追踪**: 持仓量增长最快的20个币种
- **AI500币种池**: 高评分币种自动筛选
- **流动性过滤**: 自动过滤持仓价值<15M USD的低流动性币种
### 🎯 专业风险控制
- **单币种仓位上限**:
- 山寨币 1.5倍账户净值
- BTC/ETH 10倍账户净值
- **固定杠杆**: 山寨币20倍 | BTC/ETH 50倍
- **保证金管理**: 总使用率90%AI自主决策使用率
- **风险回报比**: 强制1:2止损:止盈
- **防止仓位叠加**: 同币种同方向不允许重复开仓
### 🎨 风格UI
- **专业交易界面**: 视觉设计
- **暗色主题**: 经典配色金色#F0B90B + 深色背景
- **实时数据**: 5秒刷新账户持仓图表
- **收益率曲线**: 账户净值历史走势美元/百分比切换
- **性能对比图**: 多AI收益率实时对比
- **动画效果**: 流畅的hover过渡加载动画
### 📝 完整决策记录
- **思维链记录**: AI的完整推理过程CoT
- **历史表现**: 整体胜率平均盈利盈亏比
- **最近交易**: 最近5笔交易详情开仓价平仓价盈亏%
- **币种统计**: 各币种表现胜率平均盈亏
- **JSON日志**: 每次决策完整记录便于复盘分析
> ⚠️ **Risk Warning**: This system is experimental. AI auto-trading carries significant risks. Strongly recommended for learning/research purposes or testing with small amounts only!
---
## 🏗️ 技术架构
## ✨ Core Features
### 🏆 Multi-AI Competition Mode
- **Qwen vs DeepSeek** live trading battle
- Independent account management and decision logs
- Real-time performance comparison charts
- ROI PK and win rate statistics
### 🧠 AI Self-Learning Mechanism (NEW!)
- **Historical Feedback**: Analyzes last 20 cycles of trading performance before each decision
- **Smart Optimization**:
- Identifies best/worst performing coins
- Calculates win rate, profit/loss ratio, average profit
- Avoids repeating mistakes (consecutive losing coins)
- Reinforces successful strategies (high win rate patterns)
- **Dynamic Adjustment**: AI autonomously adjusts trading style based on historical performance
### 📊 Intelligent Market Analysis
- **3-minute K-line**: Real-time price, EMA20, MACD, RSI(7)
- **4-hour K-line**: Long-term trend, EMA20/50, ATR, RSI(14)
- **Open Interest Analysis**: Market sentiment, capital flow judgment
- **OI Top Tracking**: Top 20 coins with fastest growing open interest
- **AI500 Coin Pool**: Automatic high-score coin screening
- **Liquidity Filter**: Auto-filters low liquidity coins (<15M USD position value)
### 🎯 Professional Risk Control
- **Per-Coin Position Limit**:
- Altcoins 1.5x account equity
- BTC/ETH 10x account equity
- **Fixed Leverage**: Altcoins 20x | BTC/ETH 50x
- **Margin Management**: Total usage 90%, AI autonomous decision on usage rate
- **Risk-Reward Ratio**: Mandatory 1:2 (stop-loss:take-profit)
- **Prevent Position Stacking**: No duplicate opening of same coin/direction
### 🎨 Professional UI
- **Professional Trading Interface**: Binance-style visual design
- **Dark Theme**: Classic color scheme (Gold #F0B90B + dark background)
- **Real-time Data**: 5-second refresh for accounts, positions, charts
- **Equity Curve**: Historical account value trend (USD/percentage toggle)
- **Performance Comparison Chart**: Real-time multi-AI ROI comparison
- **Smooth Animations**: Fluid hover, transition, and loading effects
### 📝 Complete Decision Recording
- **Chain of Thought**: AI's complete reasoning process (CoT)
- **Historical Performance**: Overall win rate, average profit, profit/loss ratio
- **Recent Trades**: Last 5 trade details (entry price exit price P/L%)
- **Coin Statistics**: Per-coin performance (win rate, average P/L)
- **JSON Logs**: Complete decision records for post-trade analysis
---
## 🏗️ Technical Architecture
```
nofx/
├── main.go # 程序入口多trader管理器
├── config.json # 配置文件API密钥、多trader配置
├── main.go # Program entry (multi-trader manager)
├── config.json # Configuration file (API keys, multi-trader config)
├── api/ # HTTP API服务
│ └── server.go # Gin框架,RESTful API
├── api/ # HTTP API service
│ └── server.go # Gin framework, RESTful API
├── trader/ # 交易核心
│ ├── auto_trader.go # 自动交易主控(单trader
│ └── binance_futures.go # 币安合约API封装
├── trader/ # Trading core
│ ├── auto_trader.go # Auto trading main controller (single trader)
│ └── binance_futures.go # Binance futures API wrapper
├── manager/ # 多trader管理
│ └── trader_manager.go # 管理多个trader实例
├── manager/ # Multi-trader management
│ └── trader_manager.go # Manages multiple trader instances
├── market/ # 市场数据与AI决策
│ ├── market_data.go # 市场数据获取K线、指标
│ ├── ai_decision_engine.go # AI决策引擎(含历史反馈)
│ └── ai_signal.go # AI API调用(DeepSeek/Qwen
├── market/ # Market data & AI decisions
│ ├── market_data.go # Market data fetching (K-line, indicators)
│ ├── ai_decision_engine.go # AI decision engine (with historical feedback)
│ └── ai_signal.go # AI API calls (DeepSeek/Qwen)
├── pool/ # 币种池管理
│ └── coin_pool.go # AI500 + OI Top合并池
├── pool/ # Coin pool management
│ └── coin_pool.go # AI500 + OI Top merged pool
├── logger/ # 日志系统
│ └── decision_logger.go # 决策记录 + 表现分析
├── logger/ # Logging system
│ └── decision_logger.go # Decision recording + performance analysis
├── decision_logs/ # 决策日志存储
│ ├── trader1/ # Trader 1的日志
│ └── trader2/ # Trader 2的日志
├── decision_logs/ # Decision log storage
│ ├── trader1/ # Trader 1 logs
│ └── trader2/ # Trader 2 logs
└── web/ # React前端
└── web/ # React frontend
├── src/
│ ├── components/ # React组件
│ │ ├── EquityChart.tsx # 收益率曲线图
│ │ ├── ComparisonChart.tsx # 多AI对比图
│ │ └── CompetitionPage.tsx # 竞赛排行榜
│ ├── lib/api.ts # API调用封装
│ ├── types/index.ts # TypeScript类型
│ ├── index.css # Binance风格样式
│ └── App.tsx # 主应用
│ ├── components/ # React components
│ │ ├── EquityChart.tsx # Equity curve chart
│ │ ├── ComparisonChart.tsx # Multi-AI comparison chart
│ │ └── CompetitionPage.tsx # Competition leaderboard
│ ├── lib/api.ts # API call wrapper
│ ├── types/index.ts # TypeScript types
│ ├── index.css # Binance-style CSS
│ └── App.tsx # Main app
└── package.json
```
### 核心依赖
### Core Dependencies
**后端 (Go)**
- `github.com/adshao/go-binance/v2` - 币安API客户端
- `github.com/markcheno/go-talib` - 技术指标计算TA-Lib
- `github.com/gin-gonic/gin` - HTTP API框架
**Backend (Go)**
- `github.com/adshao/go-binance/v2` - Binance API client
- `github.com/markcheno/go-talib` - Technical indicator calculation (TA-Lib)
- `github.com/gin-gonic/gin` - HTTP API framework
**前端 (React + TypeScript)**
- `react` + `react-dom` - UI框架
- `recharts` - 图表库收益率曲线对比图
- `swr` - 数据获取和缓存
- `tailwindcss` - CSS框架
**Frontend (React + TypeScript)**
- `react` + `react-dom` - UI framework
- `recharts` - Chart library (equity curve, comparison charts)
- `swr` - Data fetching and caching
- `tailwindcss` - CSS framework
---
## 🚀 快速开始
## 🚀 Quick Start
### 1. 环境要求
### 1. Environment Requirements
- **Go 1.21+**
- **Node.js 18+**
- **TA-Lib** 技术指标计算
- **TA-Lib** library (technical indicator calculation)
#### 安装 TA-Lib
#### Installing TA-Lib
**macOS:**
```bash
@@ -142,32 +146,32 @@ brew install ta-lib
sudo apt-get install libta-lib0-dev
```
**其他系统**: 参考 [TA-Lib官方文档](https://github.com/markcheno/go-talib)
**Other systems**: Refer to [TA-Lib Official Documentation](https://github.com/markcheno/go-talib)
### 2. 克隆项目
### 2. Clone the Project
```bash
git clone <repository-url>
git clone https://github.com/tinkle-community/nofx.git
cd nofx
```
### 3. 安装依赖
### 3. Install Dependencies
**后端:**
**Backend:**
```bash
go mod download
```
**前端:**
**Frontend:**
```bash
cd web
npm install
cd ..
```
### 4. 配置系统
### 4. System Configuration
创建 `config.json` 文件
Create `config.json` file (use `config.json.example` as template):
```json
{
@@ -201,319 +205,240 @@ cd ..
}
```
**配置说明:**
- `traders`: 可配置1-N个trader单AI或多AI竞赛
- `id`: Trader唯一标识用于日志目录
- `ai_model`: "qwen" "deepseek"
- `binance_api_key/secret_key`: 每个trader使用独立的币安账户
- `initial_balance`: 初始余额用于计算盈亏%
- `scan_interval_minutes`: 决策周期建议3-5分钟
- `coin_pool_api_url`: AI500币种池API可选
- `oi_top_api_url`: OI Top持仓量API可选
**Configuration Notes:**
- `traders`: Configure 1-N traders (single AI or multi-AI competition)
- `id`: Unique trader identifier (used for log directory)
- `ai_model`: "qwen" or "deepseek"
- `binance_api_key/secret_key`: Each trader uses independent Binance account
- `initial_balance`: Initial balance (for calculating P/L%)
- `scan_interval_minutes`: Decision cycle (recommended 3-5 minutes)
- `coin_pool_api_url`: AI500 coin pool API (optional)
- `oi_top_api_url`: OI Top open interest API (optional)
### 5. 运行系统
### 5. Run the System
**启动后端AI交易系统 + API服务器:**
**Start backend (AI trading system + API server):**
```bash
go build -o nofx
./nofx
```
**启动前端(Web Dashboard:**
**Start frontend (Web Dashboard):**
新开终端窗口
Open a new terminal:
```bash
cd web
npm run dev
```
**访问界面:**
**Access the interface:**
```
Web Dashboard: http://localhost:3000
API Server: http://localhost:8080
```
### 6. 停止系统
### 6. Stop the System
在两个终端中分别按 `Ctrl+C`
Press `Ctrl+C` in both terminals
---
## 📖 AI决策流程
## 📖 AI Decision Flow
每个决策周期默认3分钟系统按以下流程运行
Each decision cycle (default 3 minutes), the system runs the following process:
```
┌─────────────────────────────────────────────────────┐
│ 1. 分析历史表现最近20个周期
│ 1. Analyze Historical Performance (last 20 cycles)
├─────────────────────────────────────────────────────┤
│ ✓ 计算整体胜率、平均盈利、盈亏比
│ ✓ 统计各币种表现(胜率、平均盈亏)
│ ✓ 识别最佳/最差币种
│ ✓ 列出最近5笔交易详情
│ ✓ Calculate overall win rate, avg profit, P/L ratio
│ ✓ Statistics for each coin (win rate, avg P/L)
│ ✓ Identify best/worst coins
│ ✓ List last 5 trade details
└─────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────┐
│ 2. 获取账户状态
│ 2. Get Account Status
├─────────────────────────────────────────────────────┤
│ • 账户净值、可用余额
│ • 持仓数量、总盈亏
│ • 保证金使用率
│ • Account equity, available balance
│ • Number of positions, total P/L
│ • Margin usage rate
└─────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────┐
│ 3. 分析现有持仓(如果有)
│ 3. Analyze Existing Positions (if any)
├─────────────────────────────────────────────────────┤
│ • 获取每个持仓的市场数据
│ • 计算技术指标(RSIMACDEMA
│ • AI判断是否需要平仓
│ • Get market data for each position
│ • Calculate technical indicators (RSI, MACD, EMA)
│ • AI decides whether to close positions
└─────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────┐
│ 4. 评估新机会(候选币种池)
│ 4. Evaluate New Opportunities (candidate coin pool)
├─────────────────────────────────────────────────────┤
│ • 获取AI500高评分币种前20个
│ • 获取OI Top持仓增长币种前20个
│ • 合并去重,过滤低流动性币种(<15M
│ • 批量获取市场数据和技术指标
│ • Get AI500 high-score coins (top 20)
│ • Get OI Top growing coins (top 20)
│ • Merge and deduplicate, filter low liquidity
│ • Batch fetch market data and technical indicators
└─────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────┐
│ 5. AI综合决策
│ 5. AI Comprehensive Decision
├─────────────────────────────────────────────────────┤
│ • 查看历史反馈(胜率、最佳/最差币种)
│ • Chain of Thought 思维链分析
│ • 输出决策:平仓/开仓/持有/观望
│ • 包含杠杆、仓位、止损、止盈
│ • Review historical feedback (win rate, best/worst)
│ • Chain of Thought analysis
│ • Output decision: close/open/hold/wait
│ • Includes leverage, position size, SL, TP
└─────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────┐
│ 6. 执行交易
│ 6. Execute Trades
├─────────────────────────────────────────────────────┤
│ • 优先级排序:先平仓,再开仓
│ • 精度自动适配LOT_SIZE
│ • 防止仓位叠加(同币种同方向拒绝开仓)
│ • 平仓后自动取消所有挂单
│ • Priority: close first, then open
│ • Auto-adapt precision (LOT_SIZE)
│ • Prevent position stacking (reject duplicate)
│ • Auto-cancel all orders after closing
└─────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────┐
│ 7. 记录日志
│ 7. Record Logs
├─────────────────────────────────────────────────────┤
│ • 保存完整决策记录到 decision_logs/
│ • 包含思维链、决策JSON、账户快照、执行结果
│ • Save complete decision to decision_logs/ │
│ • Includes CoT, decision JSON, account snapshot
└─────────────────────────────────────────────────────┘
```
---
## 🧠 AI自我学习示例
## 🧠 AI Self-Learning Example
### 历史反馈Prompt中自动添加
### Historical Feedback (Auto-added to Prompt)
```markdown
## 📊 历史表现反馈
## 📊 Historical Performance Feedback
### 整体表现
- **总交易数**: 15 笔 (盈利: 8 | 亏损: 7)
- **胜率**: 53.3%
- **平均盈利**: +3.2% | 平均亏损: -2.1%
- **盈亏比**: 1.52:1
### Overall Performance
- **Total Trades**: 15 (Profit: 8 | Loss: 7)
- **Win Rate**: 53.3%
- **Average Profit**: +3.2% | Average Loss: -2.1%
- **Profit/Loss Ratio**: 1.52:1
### 最近交易
### Recent Trades
1. BTCUSDT LONG: 95000.0000 → 97500.0000 = +2.63% ✓
2. ETHUSDT SHORT: 3500.0000 → 3450.0000 = +1.43% ✓
3. SOLUSDT LONG: 185.0000 → 180.0000 = -2.70% ✗
4. BNBUSDT LONG: 610.0000 → 625.0000 = +2.46% ✓
5. ADAUSDT LONG: 0.8500 → 0.8300 = -2.35% ✗
### 币种表现
- **最佳**: BTCUSDT (胜率75%, 平均+2.5%)
- **最差**: SOLUSDT (胜率25%, 平均-1.8%)
### Coin Performance
- **Best**: BTCUSDT (Win rate 75%, avg +2.5%)
- **Worst**: SOLUSDT (Win rate 25%, avg -1.8%)
```
### AI如何使用反馈
### How AI Uses Feedback
1. **避免连续亏损币种**: 看到SOLUSDT连续3次止损AI会避开或更谨慎
2. **强化成功策略**: BTC突破做多胜率75%AI会继续这个模式
3. **动态调整风格**: 胜率<40%时变保守盈亏比>2时保持激进
4. **识别市场环境**: 连续亏损可能说明市场震荡,减少交易频率
1. **Avoid consecutive losers**: Seeing SOLUSDT with 3 consecutive stop-losses, AI avoids or is more cautious
2. **Reinforce successful strategies**: BTC breakout long with 75% win rate, AI continues this pattern
3. **Dynamic style adjustment**: Win rate <40% conservative; P/L ratio >2 → maintain aggressive
4. **Identify market conditions**: Consecutive losses may indicate choppy market, reduce trading frequency
---
## 📊 Web界面功能
## 📊 Web Interface Features
### 1. 竞赛页面(Competition
### 1. Competition Page
- **🏆 排行榜**: 实时收益率排名,金色边框突出显示领先者
- **📈 性能对比图**: 双AI收益率曲线对比紫色vs蓝色
- **⚔️ Head-to-Head**: 直接对比,显示领先差距
- **实时数据**: 总净值、盈亏%、持仓数、保证金使用率
- **🏆 Leaderboard**: Real-time ROI ranking, golden border highlights leader
- **📈 Performance Comparison**: Dual AI ROI curve comparison (purple vs blue)
- **⚔️ Head-to-Head**: Direct comparison showing lead margin
- **Real-time Data**: Total equity, P/L%, position count, margin usage
### 2. 详情页面(Details
### 2. Details Page
- **账户净值曲线**: 历史走势图(美元/百分比切换)
- **统计信息**: 总周期、成功/失败、开仓/平仓统计
- **持仓表格**: 所有持仓详情(入场价、当前价、盈亏%、强平价)
- **AI决策日志**: 最近决策记录(可展开思维链)
- **Equity Curve**: Historical trend chart (USD/percentage toggle)
- **Statistics**: Total cycles, success/fail, open/close stats
- **Position Table**: All position details (entry price, current price, P/L%, liquidation price)
- **AI Decision Logs**: Recent decision records (expandable CoT)
### 3. 实时更新
### 3. Real-time Updates
- 系统状态、账户信息、持仓列表:**每5秒刷新**
- 决策日志、统计信息:**10秒刷新**
- 收益率图表:**10秒刷新**
- System status, account info, position list: **5-second refresh**
- Decision logs, statistics: **10-second refresh**
- Equity charts: **10-second refresh**
---
## 🎛️ API接口
## 🎛️ API Endpoints
### 竞赛相关
### Competition Related
```bash
GET /api/competition # 竞赛排行榜(所有trader
GET /api/traders # Trader列表
GET /api/competition # Competition leaderboard (all traders)
GET /api/traders # Trader list
```
### 单Trader相关
### Single Trader Related
```bash
GET /api/status?trader_id=xxx # 系统状态
GET /api/account?trader_id=xxx # 账户信息
GET /api/positions?trader_id=xxx # 持仓列表
GET /api/equity-history?trader_id=xxx # 净值历史(图表数据)
GET /api/decisions/latest?trader_id=xxx # 最新5条决策
GET /api/statistics?trader_id=xxx # 统计信息
GET /api/status?trader_id=xxx # System status
GET /api/account?trader_id=xxx # Account info
GET /api/positions?trader_id=xxx # Position list
GET /api/equity-history?trader_id=xxx # Equity history (chart data)
GET /api/decisions/latest?trader_id=xxx # Latest 5 decisions
GET /api/statistics?trader_id=xxx # Statistics
```
### 系统接口
### System Endpoints
```bash
GET /health # 健康检查
GET /api/config # 系统配置
GET /health # Health check
GET /api/config # System configuration
```
---
## 📝 决策日志格式
## ⚠️ Important Risk Warnings
每次AI决策都会生成详细的JSON日志
### Trading Risks
### 日志文件路径
```
decision_logs/
├── qwen_trader/
│ └── decision_20251028_153042_cycle15.json
└── deepseek_trader/
└── decision_20251028_153045_cycle15.json
```
1. **Cryptocurrency markets are extremely volatile**, AI decisions don't guarantee profit
2. **Futures trading uses leverage**, losses may exceed principal
3. **Extreme market conditions** may lead to liquidation risk
4. **Funding rates** may affect holding costs
5. **Liquidity risk**: Some coins may experience slippage
### 日志内容示例
### Technical Risks
```json
{
"timestamp": "2025-10-28T15:30:42+08:00",
"cycle_number": 15,
"cot_trace": "当前持仓ETHUSDT多头盈利+2.3%,趋势良好继续持有...",
"decision_json": "[{\"symbol\":\"BTCUSDT\",\"action\":\"open_long\"...}]",
"account_state": {
"total_balance": 1045.80,
"available_balance": 823.40,
"position_count": 3,
"margin_used_pct": 21.3
},
"positions": [...],
"candidate_coins": ["BTCUSDT", "ETHUSDT", ...],
"decisions": [
{
"action": "open_long",
"symbol": "BTCUSDT",
"quantity": 0.015,
"leverage": 50,
"price": 95800.0,
"order_id": 123456789,
"success": true
}
],
"execution_log": ["✓ BTCUSDT open_long 成功"],
"success": true
}
```
1. **Network latency** may cause price slippage
2. **API rate limits** may affect trade execution
3. **AI API timeouts** may cause decision failures
4. **System bugs** may trigger unexpected behavior
### Usage Recommendations
**Recommended**
- Use only funds you can afford to lose for testing
- Start with small amounts (recommended 100-500 USDT)
- Regularly check system operation status
- Monitor account balance changes
- Analyze AI decision logs to understand strategy
**Not Recommended**
- Invest all funds or borrowed money
- Run unsupervised for long periods
- Blindly trust AI decisions
- Use without understanding the system
- Run during extreme market volatility
---
## 🔧 风险控制详解
## 🛠️ Common Issues
### 单币种仓位限制
### 1. Compilation error: TA-Lib not found
| 币种类型 | 仓位价值上限 | 杠杆 | 保证金占用 | 示例1000U账户 |
|---------|-------------|------|-----------|------------------|
| 山寨币 | 1.5倍净值 | 20x | 7.5% | 最多开1500U仓位 = 75U保证金 |
| BTC/ETH | 10倍净值 | 50x | 20% | 最多开10000U仓位 = 200U保证金 |
### 为什么这样设计?
1. **高杠杆 + 小仓位 = 分散风险**
- 20倍杠杆1500U仓位只需75U保证金
- 可以同时开10+个小仓位,分散单币种风险
2. **单币种风险可控**
- 山寨币仓位≤1.5倍净值5%反向波动 = 7.5%损失
- BTC仓位≤10倍净值2%反向波动 = 20%损失
3. **不限制总保证金使用率**
- AI根据市场机会自主决策保证金使用率
- 上限90%,但不强制满仓
- 有好机会就开仓,没机会就观望
### 防止过度交易
- **同币种同方向不允许重复开仓**: 防止AI连续开同一个仓位导致超限
- **先平仓后开仓**: 换仓时确保先释放保证金
- **止损止盈强制检查**: 风险回报比≥1:2
---
## ⚠️ 重要风险提示
### 交易风险
1. **加密货币市场波动极大**AI决策不保证盈利
2. **合约交易使用杠杆**,亏损可能超过本金
3. **市场极端行情**下可能出现爆仓风险
4. **资金费率**可能影响持仓成本
5. **流动性风险**:某些币种可能出现滑点
### 技术风险
1. **网络延迟**可能导致价格滑点
2. **API限流**可能影响交易执行
3. **AI API超时**可能导致决策失败
4. **系统Bug**可能引发意外行为
### 使用建议
**建议做法**
- 仅使用可承受损失的资金测试
- 从小额资金开始建议100-500 USDT
- 定期检查系统运行状态
- 监控账户余额变化
- 分析AI决策日志理解策略
**不建议做法**
- 投入全部资金或借贷资金
- 长时间无人监控运行
- 盲目信任AI决策
- 在不理解系统的情况下使用
- 在市场极端波动时运行
---
## 🛠️ 常见问题
### 1. 编译错误TA-Lib not found
**解决**: 安装TA-Lib库
**Solution**: Install TA-Lib library
```bash
# macOS
brew install ta-lib
@@ -522,103 +447,103 @@ brew install ta-lib
sudo apt-get install libta-lib0-dev
```
### 2. 精度错误:Precision is over the maximum
### 2. Precision error: Precision is over the maximum
**解决**: 系统已自动处理精度,从Binance获取LOT_SIZE。如仍报错,检查网络连接。
**Solution**: System auto-handles precision from Binance LOT_SIZE. If error persists, check network connection.
### 3. AI API超时
### 3. AI API timeout
**解决**:
- 检查API密钥是否正确
- 检查网络连接(可能需要代理)
- 系统超时时间已设置为120秒
**Solution**:
- Check if API key is correct
- Check network connection (may need proxy)
- System timeout is set to 120 seconds
### 4. 前端无法连接后端
### 4. Frontend can't connect to backend
**解决**:
- 确保后端正在运行(http://localhost:8080
- 检查端口8080是否被占用
- 查看浏览器控制台错误信息
**Solution**:
- Ensure backend is running (http://localhost:8080)
- Check if port 8080 is occupied
- Check browser console for errors
### 5. 币种池API失败
### 5. Coin pool API failure
**解决**:
- 币种池API是可选的
- 如果API失败系统会使用默认主流币种BTCETH等)
- 检查config.json中的API URL和auth参数
**Solution**:
- Coin pool API is optional
- If API fails, system uses default mainstream coins (BTC, ETH, etc.)
- Check API URL and auth parameter in config.json
---
## 📈 性能优化建议
## 📈 Performance Optimization Tips
1. **合理设置决策周期**: 建议3-5分钟避免过度交易
2. **控制候选币种数量**: 系统默认分析AI500前20 + OI Top20
3. **定期清理日志**: 避免占用过多磁盘空间
4. **监控API调用次数**: 避免触发Binance限流权重限制
5. **小额资金测试**: 先用100-500 USDT测试策略有效性
1. **Set reasonable decision cycle**: Recommended 3-5 minutes, avoid over-trading
2. **Control candidate coin count**: System defaults to AI500 top 20 + OI Top top 20
3. **Regularly clean logs**: Avoid excessive disk usage
4. **Monitor API call count**: Avoid triggering Binance rate limits
5. **Test with small capital**: First test with 100-500 USDT for strategy validation
---
## 🔄 更新日志
## 🔄 Changelog
### v2.0.0 (2025-10-28)
**重大更新:**
- ✅ AI自我学习机制(历史反馈、表现分析)
-多Trader竞赛模式Qwen vs DeepSeek
- ✅ Binance风格UI完整模仿币安界面
-性能对比图表(收益率实时对比)
-风险控制优化(单币种仓位上限调整)
**Major Updates:**
- ✅ AI self-learning mechanism (historical feedback, performance analysis)
-Multi-trader competition mode (Qwen vs DeepSeek)
- ✅ Binance-style UI (complete Binance interface imitation)
-Performance comparison charts (real-time ROI comparison)
-Risk control optimization (per-coin position limit adjustment)
**Bug修复:**
- 修复初始余额硬编码问题
- 修复多trader数据同步问题
- 优化图表数据对齐(使用cycle_number
**Bug Fixes:**
- Fixed hardcoded initial balance issue
- Fixed multi-trader data sync issue
- Optimized chart data alignment (using cycle_number)
### v1.0.0 (2025-10-27)
- 初始版本发布
- 基础AI交易功能
- 决策日志系统
- 简单Web界面
- Initial release
- Basic AI trading functionality
- Decision logging system
- Simple Web interface
---
## 📄 开源协议
## 📄 License
MIT License - 详见 [LICENSE](LICENSE) 文件
MIT License - See [LICENSE](LICENSE) file for details
---
## 🤝 贡献
## 🤝 Contributing
欢迎提交IssuePull Request
Issues and Pull Requests are welcome!
### 开发指南
### Development Guide
1. Fork项目
2. 创建功能分支 (`git checkout -b feature/AmazingFeature`)
3. 提交更改 (`git commit -m 'Add some AmazingFeature'`)
4. 推送到分支 (`git push origin feature/AmazingFeature`)
5. 开启Pull Request
1. Fork the project
2. Create feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to branch (`git push origin feature/AmazingFeature`)
5. Open Pull Request
---
## 📬 联系方式
## 📬 Contact
如有问题或建议,请提交 [GitHub Issue](https://github.com/yourusername/nofx/issues)
For questions or suggestions, please submit a [GitHub Issue](https://github.com/tinkle-community/nofx/issues)
---
## 🙏 致谢
## 🙏 Acknowledgments
- [Binance API](https://binance-docs.github.io/apidocs/futures/cn/) - 币安合约API
- [Binance API](https://binance-docs.github.io/apidocs/futures/en/) - Binance Futures API
- [DeepSeek](https://platform.deepseek.com/) - DeepSeek AI API
- [Qwen](https://dashscope.aliyuncs.com/) - 阿里云通义千问
- [TA-Lib](https://ta-lib.org/) - 技术指标库
- [Recharts](https://recharts.org/) - React图表库
- [Qwen](https://dashscope.aliyuncs.com/) - Alibaba Cloud Qwen
- [TA-Lib](https://ta-lib.org/) - Technical indicator library
- [Recharts](https://recharts.org/) - React chart library
---
**最后更新**: 2025-10-28
**Last Updated**: 2025-10-28
**用AI的力量探索量化交易的可能性**
**Explore the possibilities of quantitative trading with the power of AI!**