feat: 添加尾盘策略配置指南文档和前端链接
- 新增中文和英文配置指南文档(docs/zh|en/crypto-tail-strategy-user-guide.md) - 在尾盘策略列表页面添加配置指南链接按钮 - 根据用户语言自动跳转到对应语言的 GitHub 文档预览 - 添加多语言翻译键(中文简体/繁体/英文) Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,452 @@
|
||||
# Crypto Tail Strategy Configuration Guide
|
||||
|
||||
## Part 1: What is Crypto Tail Strategy?
|
||||
|
||||
Crypto Tail Strategy is an automated trading strategy designed specifically for Polymarket crypto markets' **5-minute** or **15-minute** "Up or Down" markets.
|
||||
|
||||
**Core Logic**: Within a specified time window, when the market price enters your set price range, the system will automatically buy at a fixed price (0.99) without manual operation.
|
||||
|
||||
**Use Cases**:
|
||||
- You want to capture price fluctuations at the end of market cycles
|
||||
- You want to automate trading execution and avoid manual monitoring
|
||||
- You have some judgment about market trends and want to set conditions for automatic triggering
|
||||
|
||||
---
|
||||
|
||||
## Part 2: How the Strategy Works
|
||||
|
||||
### 2.1 Basic Flow
|
||||
|
||||
```
|
||||
Cycle Start → Within Time Window → Price Enters Range → Auto Order
|
||||
```
|
||||
|
||||
1. **Cycle**: Each market runs on fixed cycles (5 minutes or 15 minutes)
|
||||
- 5-minute market: Every 5 minutes is a cycle (e.g., 10:00, 10:05, 10:10...)
|
||||
- 15-minute market: Every 15 minutes is a cycle (e.g., 10:00, 10:15, 10:30...)
|
||||
|
||||
2. **Time Window**: You can set a time period within the cycle
|
||||
- Example: 15-minute market, set window to "3 minutes ~ 12 minutes"
|
||||
- Meaning: Only triggers between the 3rd and 12th minute after cycle start
|
||||
|
||||
3. **Price Range**: Set the trigger price range
|
||||
- Example: Minimum price 0.50, Maximum price 0.80
|
||||
- Meaning: Only triggers when market price is between 0.50 ~ 0.80
|
||||
|
||||
4. **Auto Order**: After conditions are met, the system automatically buys at price 0.99
|
||||
|
||||
### 2.2 Important Limitations
|
||||
|
||||
- **Maximum one trigger per cycle**: Within the same cycle, even if conditions are met multiple times, only one order is placed
|
||||
- **Fixed order price**: All orders are submitted at price 0.99
|
||||
- **Requires separate wallet**: It's recommended to use a dedicated wallet for tail strategies to avoid conflicts with other operations (manual trading, copy trading, etc.)
|
||||
|
||||
---
|
||||
|
||||
## Part 3: Parameter Details
|
||||
|
||||
### 3.1 Basic Parameters
|
||||
|
||||
| Parameter | Description | Required | Example |
|
||||
|-----------|-------------|----------|---------|
|
||||
| **Account** | Select the wallet account for trading | ✅ | Account A |
|
||||
| **Strategy Name** | Name your strategy for easy identification | ❌ | "BTC 15min Tail Strategy" |
|
||||
| **Market** | Select the market to trade (5-minute or 15-minute) | ✅ | btc-updown-15m |
|
||||
|
||||
### 3.2 Cycle Settings
|
||||
|
||||
| Parameter | Description | Required | Example |
|
||||
|-----------|-------------|----------|---------|
|
||||
| **Cycle Length** | Automatically determined by selected market | ✅ | 15 minutes (900 seconds) |
|
||||
| **Time Window Start** | Minutes after cycle start to begin monitoring | ✅ | 3 min 0 sec |
|
||||
| **Time Window End** | Minutes after cycle start to stop monitoring | ✅ | 12 min 0 sec |
|
||||
|
||||
**Time Window Explanation**:
|
||||
- 5-minute market: Can choose any time period within 0 ~ 5 minutes
|
||||
- 15-minute market: Can choose any time period within 0 ~ 15 minutes
|
||||
- **Start time must ≤ End time**
|
||||
- Times outside the window won't trigger even if price conditions are met
|
||||
|
||||
**Example**:
|
||||
- 15-minute market, window "3 min 0 sec ~ 12 min 0 sec"
|
||||
- 0 ~ 3 minutes after cycle start: Not monitoring
|
||||
- 3 ~ 12 minutes after cycle start: Monitoring price, triggers when conditions met
|
||||
- 12 ~ 15 minutes after cycle start: Not monitoring
|
||||
|
||||
### 3.3 Price Range
|
||||
|
||||
| Parameter | Description | Required | Range | Example |
|
||||
|-----------|-------------|----------|-------|---------|
|
||||
| **Minimum Price (minPrice)** | Minimum trigger price | ✅ | 0 ~ 1 | 0.50 |
|
||||
| **Maximum Price (maxPrice)** | Maximum trigger price | ❌ | 0 ~ 1, default 1 | 0.80 |
|
||||
|
||||
**Price Range Explanation**:
|
||||
- Price range is a decimal between 0 ~ 1
|
||||
- Only triggers when market price is within [Minimum Price, Maximum Price]
|
||||
- If maximum price is not filled, defaults to 1.0 (triggers as long as price ≥ minimum price)
|
||||
|
||||
**Example**:
|
||||
- Minimum price 0.50, Maximum price 0.80
|
||||
- Price 0.45: Not triggered (below minimum)
|
||||
- Price 0.60: Triggered ✅ (within range)
|
||||
- Price 0.85: Not triggered (above maximum)
|
||||
|
||||
### 3.4 Investment Amount
|
||||
|
||||
| Parameter | Description | Required | Example |
|
||||
|-----------|-------------|----------|---------|
|
||||
| **Investment Mode** | Choose ratio or fixed amount | ✅ | Ratio / Fixed Amount |
|
||||
| **Ratio (%)** | Percentage of account balance to invest | Conditionally required | 10% (Account has 100 USDC, invest 10 USDC) |
|
||||
| **Fixed Amount (USDC)** | Fixed amount to invest each time | Conditionally required | 50 USDC |
|
||||
|
||||
**Investment Mode Explanation**:
|
||||
|
||||
**Mode 1: By Ratio (RATIO)**
|
||||
- Each trigger invests a percentage of current available balance
|
||||
- Example: Account has 100 USDC, set ratio to 10%
|
||||
- 1st trigger: Invest 10 USDC
|
||||
- 2nd trigger: If balance becomes 90 USDC, invest 9 USDC
|
||||
- **Advantages**: Automatically adapts to account balance changes
|
||||
- **Disadvantages**: Investment amount may vary each time
|
||||
|
||||
**Mode 2: Fixed Amount (FIXED)**
|
||||
- Each trigger invests a fixed specified amount
|
||||
- Example: Set fixed amount to 50 USDC
|
||||
- Every trigger invests 50 USDC
|
||||
- **Advantages**: Stable investment amount, easy to manage
|
||||
- **Disadvantages**: Need to ensure sufficient account balance
|
||||
|
||||
**Notes**:
|
||||
- Minimum order amount: At least 1 USDC
|
||||
- If account balance is insufficient, order will fail and record failure reason
|
||||
|
||||
### 3.5 Minimum Spread (Advanced Feature)
|
||||
|
||||
The minimum spread feature filters market volatility, only triggering when Binance BTC/USDC price movement reaches a certain magnitude.
|
||||
|
||||
| Parameter | Description | Required | Example |
|
||||
|-----------|-------------|----------|---------|
|
||||
| **Minimum Spread Mode** | Choose spread validation method | ✅ | None / Fixed / Auto |
|
||||
| **Minimum Spread Value** | Fill when using Fixed mode | Conditionally required | 30 |
|
||||
|
||||
**Three Mode Explanations**:
|
||||
|
||||
**Mode 1: None (NONE)**
|
||||
- No spread validation
|
||||
- Triggers as long as time window and price range conditions are met
|
||||
- **Suitable for**: Not concerned about Binance price volatility, only watching Polymarket price
|
||||
|
||||
**Mode 2: Fixed (FIXED)**
|
||||
- Set a fixed minimum spread value (unit: USDC)
|
||||
- Only triggers when Binance BTC/USDC K-line spread (|close price - open price|) ≥ set value
|
||||
- **Example**: Set to 30
|
||||
- Binance K-line spread ≥ 30 in cycle: Triggered ✅
|
||||
- Binance K-line spread < 30 in cycle: Not triggered
|
||||
- **Suitable for**: You know the expected spread threshold
|
||||
|
||||
**Mode 3: Auto (AUTO)**
|
||||
- System automatically calculates minimum spread based on historical 20 K-lines
|
||||
- Calculation logic:
|
||||
1. Get recent 20 K-lines (matching strategy cycle)
|
||||
2. Filter by direction (Up direction only looks at rising K-lines, Down direction only looks at falling K-lines)
|
||||
3. Remove outliers (using IQR method)
|
||||
4. Calculate average spread × 0.8 as minimum spread
|
||||
- **Suitable for**: Want automatic adjustment based on historical data, no manual setup needed
|
||||
|
||||
**Spread Explanation**:
|
||||
- Spread = |close price - open price|
|
||||
- Example: Open price 50000, close price 50030, spread = 30
|
||||
- Larger spread indicates greater price volatility in that cycle
|
||||
|
||||
---
|
||||
|
||||
## Part 4: Configuration Examples
|
||||
|
||||
### Example 1: Simple Strategy (5-minute Market)
|
||||
|
||||
**Scenario**: In the last 2 minutes of a 5-minute market, if price is below 0.60, automatically buy 10 USDC
|
||||
|
||||
**Configuration**:
|
||||
```
|
||||
Account: Account A
|
||||
Strategy Name: BTC 5min Simple Strategy
|
||||
Market: btc-updown-5m
|
||||
Time Window: 3 min 0 sec ~ 5 min 0 sec
|
||||
Minimum Price: 0.00
|
||||
Maximum Price: 0.60
|
||||
Investment Mode: Fixed Amount
|
||||
Fixed Amount: 10 USDC
|
||||
Minimum Spread Mode: None
|
||||
Enabled: On
|
||||
```
|
||||
|
||||
**Explanation**:
|
||||
- 0 ~ 3 minutes after cycle start: Not monitoring
|
||||
- 3 ~ 5 minutes after cycle start: If price ≤ 0.60, automatically buy 10 USDC
|
||||
|
||||
---
|
||||
|
||||
### Example 2: Ratio Investment Strategy (15-minute Market)
|
||||
|
||||
**Scenario**: In the middle segment (5 ~ 10 minutes) of a 15-minute market, if price is between 0.40 ~ 0.70, invest 15% of account balance
|
||||
|
||||
**Configuration**:
|
||||
```
|
||||
Account: Account B
|
||||
Strategy Name: BTC 15min Ratio Strategy
|
||||
Market: btc-updown-15m
|
||||
Time Window: 5 min 0 sec ~ 10 min 0 sec
|
||||
Minimum Price: 0.40
|
||||
Maximum Price: 0.70
|
||||
Investment Mode: By Ratio
|
||||
Ratio: 15%
|
||||
Minimum Spread Mode: None
|
||||
Enabled: On
|
||||
```
|
||||
|
||||
**Explanation**:
|
||||
- Assuming account balance is 100 USDC
|
||||
- 5 ~ 10 minutes after cycle start: If price is between 0.40 ~ 0.70, automatically buy about 15 USDC (100 × 15%)
|
||||
|
||||
---
|
||||
|
||||
### Example 3: Strategy with Spread Filter (15-minute Market)
|
||||
|
||||
**Scenario**: In the latter segment (10 ~ 14 minutes) of a 15-minute market, if price is between 0.50 ~ 0.80 and Binance spread ≥ 50, invest 20 USDC
|
||||
|
||||
**Configuration**:
|
||||
```
|
||||
Account: Account C
|
||||
Strategy Name: BTC 15min Spread Strategy
|
||||
Market: btc-updown-15m
|
||||
Time Window: 10 min 0 sec ~ 14 min 0 sec
|
||||
Minimum Price: 0.50
|
||||
Maximum Price: 0.80
|
||||
Investment Mode: Fixed Amount
|
||||
Fixed Amount: 20 USDC
|
||||
Minimum Spread Mode: Fixed
|
||||
Minimum Spread Value: 50
|
||||
Enabled: On
|
||||
```
|
||||
|
||||
**Explanation**:
|
||||
- 10 ~ 14 minutes after cycle start: Only triggers when both conditions are met:
|
||||
1. Price is between 0.50 ~ 0.80 ✅
|
||||
2. Binance BTC/USDC spread ≥ 50 ✅
|
||||
- If spread is only 30, won't trigger even if price condition is met
|
||||
|
||||
---
|
||||
|
||||
### Example 4: Auto Spread Strategy (15-minute Market)
|
||||
|
||||
**Scenario**: In the early segment (2 ~ 8 minutes) of a 15-minute market, if price is between 0.30 ~ 0.90, invest 20% of account balance, spread calculated automatically by system
|
||||
|
||||
**Configuration**:
|
||||
```
|
||||
Account: Account D
|
||||
Strategy Name: BTC 15min Auto Spread Strategy
|
||||
Market: btc-updown-15m
|
||||
Time Window: 2 min 0 sec ~ 8 min 0 sec
|
||||
Minimum Price: 0.30
|
||||
Maximum Price: 0.90
|
||||
Investment Mode: By Ratio
|
||||
Ratio: 20%
|
||||
Minimum Spread Mode: Auto
|
||||
Enabled: On
|
||||
```
|
||||
|
||||
**Explanation**:
|
||||
- System automatically calculates minimum spread based on historical 20 K-lines
|
||||
- 2 ~ 8 minutes after cycle start: Only triggers when both conditions are met:
|
||||
1. Price is between 0.30 ~ 0.90 ✅
|
||||
2. Binance BTC/USDC spread ≥ system-calculated minimum spread ✅
|
||||
|
||||
---
|
||||
|
||||
## Part 5: Frequently Asked Questions
|
||||
|
||||
### Q1: When will the strategy trigger?
|
||||
|
||||
**A**: All of the following conditions must be met simultaneously:
|
||||
1. ✅ Current time is within the time window
|
||||
2. ✅ Market price is within [Minimum Price, Maximum Price] range
|
||||
3. ✅ This cycle hasn't triggered yet (maximum one trigger per cycle)
|
||||
4. ✅ If minimum spread is set, Binance spread must also meet the condition
|
||||
|
||||
### Q2: Why didn't my strategy trigger?
|
||||
|
||||
**Possible reasons**:
|
||||
1. **Time window incorrect**: Current time is not within the set time window
|
||||
2. **Price not in range**: Market price is not within [Minimum Price, Maximum Price] range
|
||||
3. **Already triggered this cycle**: This cycle has already triggered once, won't trigger again
|
||||
4. **Spread not met**: If minimum spread is set, Binance spread hasn't reached the requirement
|
||||
5. **Insufficient account balance**: Account balance is less than the set investment amount
|
||||
6. **Strategy not enabled**: Check if strategy's enabled status is "On"
|
||||
|
||||
### Q3: What does "maximum one trigger per cycle" mean?
|
||||
|
||||
**A**: Within each cycle (5 minutes or 15 minutes), even if conditions are met multiple times, only one order is placed.
|
||||
|
||||
**Example**:
|
||||
- 15-minute market, cycle starts at 10:00
|
||||
- At 10:05, price meets condition, triggers order ✅
|
||||
- At 10:08, price meets condition again, but won't place another order (already triggered this cycle)
|
||||
- At 10:15, new cycle starts, can trigger again
|
||||
|
||||
### Q4: What's the difference between fixed amount and ratio?
|
||||
|
||||
**Fixed Amount**:
|
||||
- Invests the same amount each trigger
|
||||
- Example: Set 50 USDC, every trigger is 50 USDC
|
||||
- Need to ensure sufficient account balance
|
||||
|
||||
**By Ratio**:
|
||||
- Invests a percentage of account balance each trigger
|
||||
- Example: Set 10%, when account has 100 USDC, invest 10 USDC, after balance becomes 90 USDC, next trigger invests 9 USDC
|
||||
- Automatically adapts to balance changes
|
||||
|
||||
### Q5: What's the use of the minimum spread feature?
|
||||
|
||||
**A**: Minimum spread filters market volatility, only triggering when Binance BTC/USDC price movement reaches a certain magnitude.
|
||||
|
||||
**Scenario**:
|
||||
- If market volatility is small (spread < set value), may not be worth trading
|
||||
- By setting minimum spread, can avoid triggering when volatility is too small
|
||||
|
||||
**Three mode selection suggestions**:
|
||||
- **None**: Not concerned about Binance price volatility, only watching Polymarket price
|
||||
- **Fixed**: You know the expected spread threshold (e.g., at least 30 USDC movement is worth trading)
|
||||
- **Auto**: Want automatic adjustment based on historical data, no manual setup needed
|
||||
|
||||
### Q6: Why is it recommended to use a separate wallet?
|
||||
|
||||
**A**: To avoid the following issues:
|
||||
1. **Balance changes**: If wallet is also used for manual trading, balance changes may affect strategy execution
|
||||
2. **Position conflicts**: Manual trading and strategy trading may conflict
|
||||
3. **Management confusion**: Difficult to distinguish which orders are from strategy vs manual
|
||||
|
||||
**Recommendation**: Create a dedicated wallet, only for tail strategies.
|
||||
|
||||
### Q7: Why is the order price fixed at 0.99?
|
||||
|
||||
**A**: This is a design feature of the strategy:
|
||||
- 0.99 is the highest price in the market (close to 1.0)
|
||||
- Buying at the highest price ensures orders execute quickly
|
||||
- Although buying price is higher, the strategy's core is capturing market volatility, not pursuing optimal price
|
||||
|
||||
### Q8: Does the strategy depend on auto-redeem functionality?
|
||||
|
||||
**A**: Yes, tail strategy depends on auto-redeem functionality.
|
||||
|
||||
**Reasons**:
|
||||
- Strategy orders create positions after execution
|
||||
- These positions need to be automatically redeemed after market settlement
|
||||
- If auto-redeem is not configured, positions may not be redeemed in time
|
||||
|
||||
**Configuration Requirements**:
|
||||
- Configure Builder API Key in "System Settings"
|
||||
- Enable auto-redeem functionality
|
||||
|
||||
---
|
||||
|
||||
## Part 6: Important Notes
|
||||
|
||||
### 6.1 Account Requirements
|
||||
|
||||
- ✅ Account must have API Key, API Secret, API Passphrase configured
|
||||
- ✅ Account must have sufficient USDC balance
|
||||
- ✅ Recommended to use a dedicated wallet to avoid conflicts with other operations
|
||||
|
||||
### 6.2 Time Window Settings
|
||||
|
||||
- ⚠️ Start time must ≤ End time
|
||||
- ⚠️ Time window cannot exceed cycle length (5-minute market ≤ 5 minutes, 15-minute market ≤ 15 minutes)
|
||||
- ⚠️ Recommended to set reasonable time windows, avoid triggering at cycle start or end
|
||||
|
||||
### 6.3 Price Range Settings
|
||||
|
||||
- ⚠️ Minimum price must ≤ Maximum price
|
||||
- ⚠️ Price range is a decimal between 0 ~ 1
|
||||
- ⚠️ Recommended to set reasonable price ranges based on market conditions
|
||||
|
||||
### 6.4 Investment Amount Settings
|
||||
|
||||
- ⚠️ Minimum order amount: At least 1 USDC
|
||||
- ⚠️ Ensure sufficient account balance to avoid order failures
|
||||
- ⚠️ Ratio mode: Note the impact of account balance changes on investment amount
|
||||
|
||||
### 6.5 Minimum Spread Settings
|
||||
|
||||
- ⚠️ Fixed mode: Need to fill reasonable spread value (unit: USDC)
|
||||
- ⚠️ Auto mode: System automatically calculates at cycle start, no manual setup needed
|
||||
- ⚠️ Setting spread too large may make strategy difficult to trigger
|
||||
|
||||
### 6.6 Other Notes
|
||||
|
||||
- ⚠️ Strategy is enabled by default after creation, can disable "Enabled Status" if need to pause
|
||||
- ⚠️ Maximum one trigger per cycle, set trigger conditions reasonably
|
||||
- ⚠️ Strategy depends on auto-redeem functionality, ensure Builder API Key is configured
|
||||
- ⚠️ Recommended to regularly check trigger records to understand strategy execution
|
||||
|
||||
---
|
||||
|
||||
## Part 7: Strategy Management
|
||||
|
||||
### 7.1 View Strategy List
|
||||
|
||||
On the "Crypto Tail Strategy" page, you can view all strategies:
|
||||
- Strategy name
|
||||
- Market information
|
||||
- Time window
|
||||
- Price range
|
||||
- Investment mode
|
||||
- Enabled status
|
||||
- Last trigger time
|
||||
- Statistics like total profit, win rate
|
||||
|
||||
### 7.2 View Trigger Records
|
||||
|
||||
Click on a strategy to view detailed trigger records:
|
||||
- Trigger time
|
||||
- Market price
|
||||
- Investment amount
|
||||
- Order ID
|
||||
- Order status (success/fail)
|
||||
- Settlement information (profit/loss, win rate, etc.)
|
||||
|
||||
### 7.3 Edit Strategy
|
||||
|
||||
You can modify strategy parameters at any time:
|
||||
- Time window
|
||||
- Price range
|
||||
- Investment mode
|
||||
- Minimum spread settings
|
||||
- Enabled status
|
||||
|
||||
**Note**: Modified strategies take effect in the next cycle.
|
||||
|
||||
### 7.4 Delete Strategy
|
||||
|
||||
After deleting a strategy:
|
||||
- Strategy configuration is deleted
|
||||
- Historical trigger records are retained
|
||||
- Already placed orders are not affected
|
||||
|
||||
---
|
||||
|
||||
## Part 8: Summary
|
||||
|
||||
Crypto Tail Strategy is a powerful automated trading tool that can help you:
|
||||
|
||||
1. **Automated Trading**: No need for manual monitoring, system executes automatically
|
||||
2. **Precise Control**: Precisely control trigger conditions through time windows and price ranges
|
||||
3. **Flexible Configuration**: Supports both ratio and fixed amount investment modes
|
||||
4. **Risk Filtering**: Filter market volatility through minimum spread feature
|
||||
|
||||
**Usage Recommendations**:
|
||||
- For first-time users, start with simple strategies (no spread filter)
|
||||
- After familiarizing, try adding spread filter features
|
||||
- Regularly check trigger records, adjust strategy parameters based on actual situation
|
||||
- Use a dedicated wallet to avoid conflicts with other operations
|
||||
|
||||
**Happy Trading!** 🚀
|
||||
@@ -0,0 +1,452 @@
|
||||
# 尾盘策略配置指南
|
||||
|
||||
## 一、什么是尾盘策略?
|
||||
|
||||
尾盘策略是一种自动化交易策略,专门用于 Polymarket 加密市场的 **5分钟** 或 **15分钟** "Up or Down" 市场。
|
||||
|
||||
**核心逻辑**:在指定时间窗口内,当市场价格进入您设定的价格区间时,系统会自动以固定价格(0.99)买入,无需手动操作。
|
||||
|
||||
**适用场景**:
|
||||
- 您希望捕捉市场在周期末段的价格波动
|
||||
- 您想自动化执行交易,避免手动盯盘
|
||||
- 您对市场走势有一定判断,希望设置条件自动触发
|
||||
|
||||
---
|
||||
|
||||
## 二、策略工作原理
|
||||
|
||||
### 2.1 基本流程
|
||||
|
||||
```
|
||||
周期开始 → 时间窗口内 → 价格进入区间 → 自动下单
|
||||
```
|
||||
|
||||
1. **周期**:每个市场按固定周期运行(5分钟或15分钟)
|
||||
- 5分钟市场:每5分钟为一个周期(如 10:00、10:05、10:10...)
|
||||
- 15分钟市场:每15分钟为一个周期(如 10:00、10:15、10:30...)
|
||||
|
||||
2. **时间窗口**:您可以在周期内设置一个时间段
|
||||
- 例如:15分钟市场,设置窗口为「3分钟~12分钟」
|
||||
- 表示:从周期开始后第3分钟到第12分钟之间才会触发
|
||||
|
||||
3. **价格区间**:设置触发价格范围
|
||||
- 例如:最低价 0.50,最高价 0.80
|
||||
- 表示:当市场价格在 0.50~0.80 之间时才会触发
|
||||
|
||||
4. **自动下单**:满足条件后,系统自动以 0.99 的价格买入
|
||||
|
||||
### 2.2 重要限制
|
||||
|
||||
- **每周期最多触发一次**:同一个周期内,即使多次满足条件,也只下单一次
|
||||
- **固定下单价格**:所有订单都以 0.99 的价格提交
|
||||
- **需要单独钱包**:建议使用专门的钱包运行尾盘策略,避免与其他操作(手动交易、跟单等)冲突
|
||||
|
||||
---
|
||||
|
||||
## 三、参数详细说明
|
||||
|
||||
### 3.1 基础参数
|
||||
|
||||
| 参数 | 说明 | 必填 | 示例 |
|
||||
|------|------|------|------|
|
||||
| **账户** | 选择用于交易的钱包账户 | ✅ | 账户A |
|
||||
| **策略名称** | 给策略起个名字,方便识别 | ❌ | "BTC 15分钟尾盘策略" |
|
||||
| **市场** | 选择要交易的市场(5分钟或15分钟) | ✅ | btc-updown-15m |
|
||||
|
||||
### 3.2 周期设置
|
||||
|
||||
| 参数 | 说明 | 必填 | 示例 |
|
||||
|------|------|------|------|
|
||||
| **周期长度** | 由选择的市场自动确定 | ✅ | 15分钟(900秒) |
|
||||
| **时间窗口开始** | 从周期起点算起,多少分钟后开始监听 | ✅ | 3分0秒 |
|
||||
| **时间窗口结束** | 从周期起点算起,多少分钟后停止监听 | ✅ | 12分0秒 |
|
||||
|
||||
**时间窗口说明**:
|
||||
- 5分钟市场:可选 0~5 分钟内的任意时间段
|
||||
- 15分钟市场:可选 0~15 分钟内的任意时间段
|
||||
- **开始时间必须 ≤ 结束时间**
|
||||
- 窗口外的时间即使价格满足也不会触发
|
||||
|
||||
**示例**:
|
||||
- 15分钟市场,窗口「3分0秒 ~ 12分0秒」
|
||||
- 周期开始后 0~3 分钟:不监听
|
||||
- 周期开始后 3~12 分钟:监听价格,满足条件即触发
|
||||
- 周期开始后 12~15 分钟:不监听
|
||||
|
||||
### 3.3 价格区间
|
||||
|
||||
| 参数 | 说明 | 必填 | 取值范围 | 示例 |
|
||||
|------|------|------|----------|------|
|
||||
| **最低价 (minPrice)** | 触发的最低价格 | ✅ | 0~1 | 0.50 |
|
||||
| **最高价 (maxPrice)** | 触发的最高价格 | ❌ | 0~1,默认1 | 0.80 |
|
||||
|
||||
**价格区间说明**:
|
||||
- 价格范围是 0~1 之间的小数
|
||||
- 当市场价格在 [最低价, 最高价] 区间内时才会触发
|
||||
- 如果不填最高价,默认使用 1.0(即只要价格 ≥ 最低价就触发)
|
||||
|
||||
**示例**:
|
||||
- 最低价 0.50,最高价 0.80
|
||||
- 价格 0.45:不触发(低于最低价)
|
||||
- 价格 0.60:触发 ✅(在区间内)
|
||||
- 价格 0.85:不触发(高于最高价)
|
||||
|
||||
### 3.4 投入金额
|
||||
|
||||
| 参数 | 说明 | 必填 | 示例 |
|
||||
|------|------|------|------|
|
||||
| **投入方式** | 选择按比例或固定金额 | ✅ | 按比例 / 固定金额 |
|
||||
| **比例 (%)** | 按账户余额的百分比投入 | 条件必填 | 10%(账户有100 USDC,投入10 USDC) |
|
||||
| **固定金额 (USDC)** | 每次固定投入的金额 | 条件必填 | 50 USDC |
|
||||
|
||||
**投入方式说明**:
|
||||
|
||||
**方式一:按比例 (RATIO)**
|
||||
- 每次触发时,按账户当前可用余额的百分比投入
|
||||
- 例如:账户有 100 USDC,设置比例 10%
|
||||
- 第1次触发:投入 10 USDC
|
||||
- 第2次触发:如果余额变为 90 USDC,投入 9 USDC
|
||||
- **优点**:自动适应账户余额变化
|
||||
- **缺点**:每次投入金额可能不同
|
||||
|
||||
**方式二:固定金额 (FIXED)**
|
||||
- 每次触发时,固定投入指定金额
|
||||
- 例如:设置固定金额 50 USDC
|
||||
- 每次触发都投入 50 USDC
|
||||
- **优点**:投入金额稳定,便于管理
|
||||
- **缺点**:需要确保账户余额充足
|
||||
|
||||
**注意事项**:
|
||||
- 最小下单金额:至少 1 USDC
|
||||
- 如果账户余额不足,下单会失败并记录失败原因
|
||||
|
||||
### 3.5 最小价差(高级功能)
|
||||
|
||||
最小价差功能用于过滤市场波动,只在币安 BTC/USDC 价格波动达到一定幅度时才触发。
|
||||
|
||||
| 参数 | 说明 | 必填 | 示例 |
|
||||
|------|------|------|------|
|
||||
| **最小价差模式** | 选择价差校验方式 | ✅ | 无 / 固定 / 自动 |
|
||||
| **最小价差值** | 固定模式时填写 | 条件必填 | 30 |
|
||||
|
||||
**三种模式说明**:
|
||||
|
||||
**模式一:无 (NONE)**
|
||||
- 不进行价差校验
|
||||
- 只要时间窗口和价格区间满足就触发
|
||||
- **适合**:不关心币安价格波动,只看 Polymarket 价格
|
||||
|
||||
**模式二:固定 (FIXED)**
|
||||
- 设置一个固定的最小价差值(单位:USDC)
|
||||
- 当币安 BTC/USDC 的 K 线价差(|收盘价 - 开盘价|)≥ 设定值时,才触发
|
||||
- **示例**:设置 30
|
||||
- 周期内币安 K 线价差 ≥ 30:触发 ✅
|
||||
- 周期内币安 K 线价差 < 30:不触发
|
||||
- **适合**:您知道期望的价差阈值
|
||||
|
||||
**模式三:自动 (AUTO)**
|
||||
- 系统根据历史 20 根 K 线自动计算最小价差
|
||||
- 计算逻辑:
|
||||
1. 获取最近 20 根 K 线(与策略周期一致)
|
||||
2. 按方向筛选(Up 方向只看上涨的 K 线,Down 方向只看下跌的 K 线)
|
||||
3. 剔除异常值(使用 IQR 方法)
|
||||
4. 计算平均价差 × 0.8 作为最小价差
|
||||
- **适合**:希望根据历史数据自动调整,无需手动设置
|
||||
|
||||
**价差说明**:
|
||||
- 价差 = |收盘价 - 开盘价|
|
||||
- 例如:开盘价 50000,收盘价 50030,价差 = 30
|
||||
- 价差越大,说明该周期内价格波动越大
|
||||
|
||||
---
|
||||
|
||||
## 四、配置示例
|
||||
|
||||
### 示例1:简单策略(5分钟市场)
|
||||
|
||||
**场景**:在 5 分钟市场的最后 2 分钟,如果价格低于 0.60,自动买入 10 USDC
|
||||
|
||||
**配置**:
|
||||
```
|
||||
账户:账户A
|
||||
策略名称:BTC 5分钟简单策略
|
||||
市场:btc-updown-5m
|
||||
时间窗口:3分0秒 ~ 5分0秒
|
||||
最低价:0.00
|
||||
最高价:0.60
|
||||
投入方式:固定金额
|
||||
固定金额:10 USDC
|
||||
最小价差模式:无
|
||||
启用状态:开启
|
||||
```
|
||||
|
||||
**说明**:
|
||||
- 周期开始后 0~3 分钟:不监听
|
||||
- 周期开始后 3~5 分钟:如果价格 ≤ 0.60,自动买入 10 USDC
|
||||
|
||||
---
|
||||
|
||||
### 示例2:比例投入策略(15分钟市场)
|
||||
|
||||
**场景**:在 15 分钟市场的中段(5~10分钟),如果价格在 0.40~0.70 之间,投入账户余额的 15%
|
||||
|
||||
**配置**:
|
||||
```
|
||||
账户:账户B
|
||||
策略名称:BTC 15分钟比例策略
|
||||
市场:btc-updown-15m
|
||||
时间窗口:5分0秒 ~ 10分0秒
|
||||
最低价:0.40
|
||||
最高价:0.70
|
||||
投入方式:按比例
|
||||
比例:15%
|
||||
最小价差模式:无
|
||||
启用状态:开启
|
||||
```
|
||||
|
||||
**说明**:
|
||||
- 假设账户余额 100 USDC
|
||||
- 周期开始后 5~10 分钟:如果价格在 0.40~0.70 之间,自动买入约 15 USDC(100 × 15%)
|
||||
|
||||
---
|
||||
|
||||
### 示例3:带价差过滤的策略(15分钟市场)
|
||||
|
||||
**场景**:在 15 分钟市场的后段(10~14分钟),如果价格在 0.50~0.80 之间,且币安价差 ≥ 50,投入 20 USDC
|
||||
|
||||
**配置**:
|
||||
```
|
||||
账户:账户C
|
||||
策略名称:BTC 15分钟价差策略
|
||||
市场:btc-updown-15m
|
||||
时间窗口:10分0秒 ~ 14分0秒
|
||||
最低价:0.50
|
||||
最高价:0.80
|
||||
投入方式:固定金额
|
||||
固定金额:20 USDC
|
||||
最小价差模式:固定
|
||||
最小价差值:50
|
||||
启用状态:开启
|
||||
```
|
||||
|
||||
**说明**:
|
||||
- 周期开始后 10~14 分钟:同时满足以下条件才触发
|
||||
1. 价格在 0.50~0.80 之间 ✅
|
||||
2. 币安 BTC/USDC 价差 ≥ 50 ✅
|
||||
- 如果价差只有 30,即使价格满足也不会触发
|
||||
|
||||
---
|
||||
|
||||
### 示例4:自动价差策略(15分钟市场)
|
||||
|
||||
**场景**:在 15 分钟市场的前段(2~8分钟),如果价格在 0.30~0.90 之间,投入账户余额的 20%,价差由系统自动计算
|
||||
|
||||
**配置**:
|
||||
```
|
||||
账户:账户D
|
||||
策略名称:BTC 15分钟自动价差策略
|
||||
市场:btc-updown-15m
|
||||
时间窗口:2分0秒 ~ 8分0秒
|
||||
最低价:0.30
|
||||
最高价:0.90
|
||||
投入方式:按比例
|
||||
比例:20%
|
||||
最小价差模式:自动
|
||||
启用状态:开启
|
||||
```
|
||||
|
||||
**说明**:
|
||||
- 系统会根据历史 20 根 K 线自动计算最小价差
|
||||
- 周期开始后 2~8 分钟:同时满足以下条件才触发
|
||||
1. 价格在 0.30~0.90 之间 ✅
|
||||
2. 币安 BTC/USDC 价差 ≥ 系统计算的最小价差 ✅
|
||||
|
||||
---
|
||||
|
||||
## 五、常见问题
|
||||
|
||||
### Q1:策略什么时候会触发?
|
||||
|
||||
**A**:需要同时满足以下条件:
|
||||
1. ✅ 当前时间在时间窗口内
|
||||
2. ✅ 市场价格在 [最低价, 最高价] 区间内
|
||||
3. ✅ 本周期尚未触发过(每周期最多触发一次)
|
||||
4. ✅ 如果设置了最小价差,币安价差也需要满足条件
|
||||
|
||||
### Q2:为什么我的策略没有触发?
|
||||
|
||||
**可能原因**:
|
||||
1. **时间窗口不对**:当前时间不在设定的时间窗口内
|
||||
2. **价格不在区间**:市场价格不在 [最低价, 最高价] 范围内
|
||||
3. **本周期已触发**:该周期已经触发过一次,不会再触发
|
||||
4. **价差不满足**:如果设置了最小价差,币安价差未达到要求
|
||||
5. **账户余额不足**:账户余额小于设定的投入金额
|
||||
6. **策略未启用**:检查策略的启用状态是否为"开启"
|
||||
|
||||
### Q3:每周期最多触发一次是什么意思?
|
||||
|
||||
**A**:每个周期(5分钟或15分钟)内,即使多次满足条件,也只下单一次。
|
||||
|
||||
**示例**:
|
||||
- 15分钟市场,周期从 10:00 开始
|
||||
- 10:05 时价格满足条件,触发下单 ✅
|
||||
- 10:08 时价格再次满足条件,但不会再次下单(本周期已触发)
|
||||
- 10:15 开始新周期,可以再次触发
|
||||
|
||||
### Q4:固定金额和按比例有什么区别?
|
||||
|
||||
**固定金额**:
|
||||
- 每次触发都投入相同金额
|
||||
- 例如:设置 50 USDC,每次都是 50 USDC
|
||||
- 需要确保账户余额充足
|
||||
|
||||
**按比例**:
|
||||
- 每次触发时按账户余额的百分比投入
|
||||
- 例如:设置 10%,账户有 100 USDC 时投入 10 USDC,余额变为 90 USDC 后下次投入 9 USDC
|
||||
- 自动适应余额变化
|
||||
|
||||
### Q5:最小价差功能有什么用?
|
||||
|
||||
**A**:最小价差用于过滤市场波动,只在币安 BTC/USDC 价格波动达到一定幅度时才触发。
|
||||
|
||||
**场景**:
|
||||
- 如果市场波动很小(价差 < 设定值),可能不值得交易
|
||||
- 通过设置最小价差,可以避免在波动过小时触发
|
||||
|
||||
**三种模式选择建议**:
|
||||
- **无**:不关心币安价格波动,只看 Polymarket 价格
|
||||
- **固定**:您知道期望的价差阈值(例如:至少波动 30 USDC 才值得交易)
|
||||
- **自动**:希望根据历史数据自动调整,无需手动设置
|
||||
|
||||
### Q6:为什么建议使用单独的钱包?
|
||||
|
||||
**A**:避免以下问题:
|
||||
1. **余额变化**:如果钱包同时用于手动交易,余额变化可能影响策略执行
|
||||
2. **仓位冲突**:手动交易和策略交易可能产生冲突
|
||||
3. **管理混乱**:难以区分哪些订单是策略产生的,哪些是手动产生的
|
||||
|
||||
**建议**:创建一个专门的钱包,只用于尾盘策略。
|
||||
|
||||
### Q7:下单价格为什么是固定的 0.99?
|
||||
|
||||
**A**:这是策略的设计特点:
|
||||
- 0.99 是市场中的最高价格(接近 1.0)
|
||||
- 以最高价买入可以确保订单快速成交
|
||||
- 虽然买入价格较高,但策略的核心是捕捉市场波动,而非追求最优价格
|
||||
|
||||
### Q8:策略需要依赖自动赎回功能吗?
|
||||
|
||||
**A**:是的,尾盘策略依赖自动赎回功能。
|
||||
|
||||
**原因**:
|
||||
- 策略下单后会形成仓位
|
||||
- 这些仓位需要在市场结算后自动赎回
|
||||
- 如果未配置自动赎回,仓位可能无法及时赎回
|
||||
|
||||
**配置要求**:
|
||||
- 在「系统设置」中配置 Builder API Key
|
||||
- 开启自动赎回功能
|
||||
|
||||
---
|
||||
|
||||
## 六、注意事项
|
||||
|
||||
### 6.1 账户要求
|
||||
|
||||
- ✅ 账户必须配置 API Key、API Secret、API Passphrase
|
||||
- ✅ 账户必须有足够的 USDC 余额
|
||||
- ✅ 建议使用专门的钱包,避免与其他操作冲突
|
||||
|
||||
### 6.2 时间窗口设置
|
||||
|
||||
- ⚠️ 开始时间必须 ≤ 结束时间
|
||||
- ⚠️ 时间窗口不能超出周期长度(5分钟市场 ≤ 5分钟,15分钟市场 ≤ 15分钟)
|
||||
- ⚠️ 建议设置合理的时间窗口,避免在周期开始或结束时触发
|
||||
|
||||
### 6.3 价格区间设置
|
||||
|
||||
- ⚠️ 最低价必须 ≤ 最高价
|
||||
- ⚠️ 价格范围是 0~1 之间的小数
|
||||
- ⚠️ 建议根据市场情况设置合理的价格区间
|
||||
|
||||
### 6.4 投入金额设置
|
||||
|
||||
- ⚠️ 最小下单金额:至少 1 USDC
|
||||
- ⚠️ 确保账户余额充足,避免下单失败
|
||||
- ⚠️ 按比例模式:注意账户余额变化对投入金额的影响
|
||||
|
||||
### 6.5 最小价差设置
|
||||
|
||||
- ⚠️ 固定模式:需要填写合理的价差值(单位:USDC)
|
||||
- ⚠️ 自动模式:系统会在周期开始时自动计算,无需手动设置
|
||||
- ⚠️ 价差设置过大可能导致策略难以触发
|
||||
|
||||
### 6.6 其他注意事项
|
||||
|
||||
- ⚠️ 策略创建后默认启用,如需暂停可以关闭"启用状态"
|
||||
- ⚠️ 每周期最多触发一次,请合理设置触发条件
|
||||
- ⚠️ 策略依赖自动赎回功能,请确保已配置 Builder API Key
|
||||
- ⚠️ 建议定期查看触发记录,了解策略执行情况
|
||||
|
||||
---
|
||||
|
||||
## 七、策略管理
|
||||
|
||||
### 7.1 查看策略列表
|
||||
|
||||
在「尾盘策略」页面可以查看所有策略:
|
||||
- 策略名称
|
||||
- 市场信息
|
||||
- 时间窗口
|
||||
- 价格区间
|
||||
- 投入方式
|
||||
- 启用状态
|
||||
- 最后触发时间
|
||||
- 总收益、胜率等统计信息
|
||||
|
||||
### 7.2 查看触发记录
|
||||
|
||||
点击策略可以查看详细的触发记录:
|
||||
- 触发时间
|
||||
- 市场价格
|
||||
- 投入金额
|
||||
- 订单ID
|
||||
- 订单状态(成功/失败)
|
||||
- 结算信息(盈亏、胜率等)
|
||||
|
||||
### 7.3 编辑策略
|
||||
|
||||
可以随时修改策略参数:
|
||||
- 时间窗口
|
||||
- 价格区间
|
||||
- 投入方式
|
||||
- 最小价差设置
|
||||
- 启用状态
|
||||
|
||||
**注意**:修改后的策略会在下一个周期生效。
|
||||
|
||||
### 7.4 删除策略
|
||||
|
||||
删除策略后:
|
||||
- 策略配置会被删除
|
||||
- 历史触发记录会保留
|
||||
- 已下单的订单不受影响
|
||||
|
||||
---
|
||||
|
||||
## 八、总结
|
||||
|
||||
尾盘策略是一个强大的自动化交易工具,可以帮助您:
|
||||
|
||||
1. **自动化交易**:无需手动盯盘,系统自动执行
|
||||
2. **精准控制**:通过时间窗口和价格区间精确控制触发条件
|
||||
3. **灵活配置**:支持比例和固定金额两种投入方式
|
||||
4. **风险过滤**:通过最小价差功能过滤市场波动
|
||||
|
||||
**使用建议**:
|
||||
- 初次使用建议从简单策略开始(无价差过滤)
|
||||
- 熟悉后再尝试添加价差过滤功能
|
||||
- 定期查看触发记录,根据实际情况调整策略参数
|
||||
- 使用专门的钱包,避免与其他操作冲突
|
||||
|
||||
**祝您交易顺利!** 🚀
|
||||
Reference in New Issue
Block a user