crypto-hft

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Crypto HFT - Binary Market Trading

Crypto HFT - 二元市场交易

Trade Polymarket's crypto binary markets with 4 automated strategies. Just say what you want!
Available market durations (pick one):
  • 5-minute: BTC only - ultra-high frequency HFT
  • 15-minute: All assets (BTC, ETH, SOL, XRP) - balanced, most popular
  • 1-hour: All assets - faster swing trading
  • 4-hour: All assets - multi-hour trends
  • Daily: All assets - position trading, overnight holds
Each round has UP/DOWN token pairs that settle at 0 or 1 using Chainlink price feeds.
Starts in dry-run mode by default (no real orders). Test for free before going live!
借助4种自动化策略交易Polymarket的加密货币二元市场。直接说出你的需求即可!
支持的市场周期(选择其一):
  • 5分钟:仅支持BTC - 超高频率HFT
  • 15分钟:全资产(BTC、ETH、SOL、XRP) - 均衡型,最受欢迎
  • 1小时:全资产 - 快速波段交易
  • 4小时:全资产 - 多小时趋势交易
  • 每日:全资产 - 头寸交易,隔夜持有
每个交易周期包含UP/DOWN代币对,通过Chainlink价格馈送最终结算为0或1。
默认以dry-run模式启动(无真实订单)。实盘交易前可免费测试!

Talk to Clodds Naturally

自然语言指令交互

Just say what you want to trade:
"Trade 5-minute BTC markets"
→ /hft start --preset 5min-btc

"Start 1-hour trading on all assets"
→ /hft start --preset 1h-all

"I want 4-hour swing trades"
→ /hft start --preset 4h-all

"Show me daily market presets"
→ /hft preset list

"Trade conservatively on 15-minute markets"
→ /hft start --preset conservative

"Aggressive all-in on 15-min with all strategies"
→ /hft start --preset aggressive
直接说出你的交易需求即可:
"Trade 5-minute BTC markets"
→ /hft start --preset 5min-btc

"Start 1-hour trading on all assets"
→ /hft start --preset 1h-all

"I want 4-hour swing trades"
→ /hft start --preset 4h-all

"Show me daily market presets"
→ /hft preset list

"Trade conservatively on 15-minute markets"
→ /hft start --preset conservative

"Aggressive all-in on 15-min with all strategies"
→ /hft start --preset aggressive

Quick Start

快速开始

/crypto-hft start                          # 15-min (default): BTC,ETH,SOL,XRP
/crypto-hft start --preset 5min-btc        # 5-minute BTC (fast, aggressive)
/crypto-hft start --preset 1h-all          # 1-hour all assets
/crypto-hft start --preset 4h-all          # 4-hour all assets (swing)
/crypto-hft start --preset daily-all       # Daily all assets (position)
/crypto-hft start BTC,ETH --dry-run       # 15-min specific assets, dry run
/crypto-hft status                         # Check stats + open positions
/crypto-hft stop                           # Stop and show summary
For live trading, set Polymarket env vars and omit
--dry-run
:
bash
export POLY_PRIVATE_KEY="..."
export POLY_FUNDER_ADDRESS="..."
export POLY_API_KEY="..."
export POLY_API_SECRET="..."
export POLY_API_PASSPHRASE="..."
/crypto-hft start                          # 默认15分钟周期:BTC、ETH、SOL、XRP
/crypto-hft start --preset 5min-btc        # 5分钟周期BTC(高频、激进型)
/crypto-hft start --preset 1h-all          # 1小时周期全资产
/crypto-hft start --preset 4h-all          # 4小时周期全资产(波段交易)
/crypto-hft start --preset daily-all       # 每日周期全资产(头寸交易)
/crypto-hft start BTC,ETH --dry-run       # 15分钟周期指定资产,模拟运行
/crypto-hft status                         # 查看统计数据+未平仓头寸
/crypto-hft stop                           # 停止交易并显示汇总
若要进行实盘交易,需设置Polymarket环境变量并省略
--dry-run
参数:
bash
export POLY_PRIVATE_KEY="..."
export POLY_FUNDER_ADDRESS="..."
export POLY_API_KEY="..."
export POLY_API_SECRET="..."
export POLY_API_PASSPHRASE="..."

Commands

命令列表

Start / Stop

启动/停止

/crypto-hft start [ASSETS] [--size N] [--dry-run] [--preset NAME]
/crypto-hft stop
/crypto-hft start [ASSETS] [--size N] [--dry-run] [--preset NAME]
/crypto-hft stop

Monitor

监控

/crypto-hft status       Stats, round info, open positions
/crypto-hft positions    Last 20 closed trades with PnL
/crypto-hft markets      Active markets from Gamma API (5-min or 15-min)
/crypto-hft round        Current round slot and timing
/crypto-hft status       统计数据、交易周期信息、未平仓头寸
/crypto-hft positions    最近20笔平仓交易及盈亏(PnL)
/crypto-hft markets      从Gamma API获取的活跃市场(5分钟或15分钟周期)
/crypto-hft round        当前交易周期时段及时间安排

Configure (while running)

运行中配置

/crypto-hft config                                 Show current config
/crypto-hft config --tp 15 --sl 12                 Set take-profit/stop-loss %
/crypto-hft config --size 30 --max-pos 4           Set trade size and max positions
/crypto-hft config --ratchet on --trailing off      Toggle exit features
/crypto-hft config --max-loss 100                   Set daily loss limit
/crypto-hft config                                 查看当前配置
/crypto-hft config --tp 15 --sl 12                 设置止盈/止损百分比
/crypto-hft config --size 30 --max-pos 4           设置交易规模及最大持仓数
/crypto-hft config --ratchet on --trailing off      切换退出功能
/crypto-hft config --max-loss 100                   设置每日亏损上限

Strategy Control

策略控制

/crypto-hft enable momentum          Enable a strategy
/crypto-hft disable expiry_fade      Disable a strategy
/crypto-hft enable momentum          启用某一策略
/crypto-hft disable expiry_fade      禁用某一策略

Presets

预设配置

/crypto-hft preset list              Show all presets
/crypto-hft preset save my_config    Save current config as preset
/crypto-hft preset load scalper      Load a preset (into running engine or for next start)
/crypto-hft preset delete my_config  Delete a saved preset
/crypto-hft preset list              查看所有预设配置
/crypto-hft preset save my_config    将当前配置保存为预设
/crypto-hft preset load scalper      加载预设配置(应用于运行中的引擎或下次启动)
/crypto-hft preset delete my_config  删除已保存的预设配置

Strategies

交易策略

StrategyEntry ConditionOrder ModeBest For
momentumSpot price moved, poly laggingmaker_then_takerCatching delayed reactions
mean_reversionToken mispriced, spot calmmaker (0% fee)Range-bound markets
penny_clipperOscillating in zone, price below meanmaker (0% fee)Tight spread scalping
expiry_fadeNear expiry, skewed pricing, flat spottaker (speed)Late-round mean reversion
策略入场条件订单模式适用场景
momentum现货价格变动,Polymarket价格滞后maker_then_taker捕捉滞后的价格反应
mean_reversion代币定价偏差,现货市场平稳maker(0手续费)区间震荡市场
penny_clipper价格在区间内震荡,低于均值maker(0手续费)窄点差剥头皮交易
expiry_fade临近结算,定价失衡,现货市场平稳taker(速度优先)交易周期末期的均值回归

Built-in Presets

内置预设配置

By Market Duration

按市场周期分类

5-Minute (BTC Only)

5分钟周期(仅BTC)

PresetSizeMax PosStrategiesFeatures
5min-btc$151All 4Aggressive - 10s min age
5min-btc-conservative$101MR, PCConservative - 15s min age
预设交易规模最大持仓数启用策略特性
5min-btc$151全部4种激进型 - 最小交易周期时长10秒
5min-btc-conservative$101MR、PC保守型 - 最小交易周期时长15秒

1-Hour (All Assets)

1小时周期(全资产)

PresetSizeMax PosStrategiesFeatures
1h-all$203All 4Balanced - ratchet + trailing
预设交易规模最大持仓数启用策略特性
1h-all$203全部4种均衡型 - 启用ratchet+ trailing功能

4-Hour (All Assets - Swing)

4小时周期(全资产 - 波段交易)

PresetSizeMax PosStrategiesFeatures
4h-all$304Mom + MRSwing trading focus
预设交易规模最大持仓数启用策略特性
4h-all$304Mom + MR专注波段交易

Daily (All Assets - Position)

每日周期(全资产 - 头寸交易)

PresetSizeMax PosStrategiesFeatures
daily-all$504Mom + MRPosition trading, tight ratchet
预设交易规模最大持仓数启用策略特性
daily-all$504Mom + MR头寸交易,严格ratchet机制

15-Minute (Classic - All Assets)

15分钟周期(经典型 - 全资产)

PresetSizeMax PosStrategiesRisk
conservative$102MR, PCLow - dry run, tight stops
aggressive$504All 4High - live, wide stops
scalper$203PC onlyMedium - ratchet on
momentum_only$303Mom onlyMedium - ratchet + trailing
Legend: MR=mean_reversion, PC=penny_clipper, Mom=momentum
预设交易规模最大持仓数启用策略风险等级
conservative$102MR、PC低风险 - 模拟运行,严格止损
aggressive$504全部4种高风险 - 实盘运行,宽松止损
scalper$203仅PC中风险 - 启用ratchet功能
momentum_only$303仅Mom中风险 - 启用ratchet+ trailing功能
说明: MR=mean_reversion,PC=penny_clipper,Mom=momentum

Market Duration Comparison

市场周期对比

Aspect5-Min1-Hour4-HourDaily
AssetsBTCAllAllAll
Duration300s3,600s14,400s86,400s
Min Round Age10s60s120s600s
Min Time Left50s180s600s3,600s
Force Exit10s60s120s600s
Best ForHFT scalpingFast swingSwing tradingPosition trading
LiquidityThinGoodVery goodExcellent
Fee ImpactCriticalModerateLowVery low
Daily Cycles2882461
Trading Strategy by Duration:
  • 5-min: Ultra-high frequency, requires tight risk management, penny_clipper focus
  • 1-hour: Balanced entry points, good for mean reversion + momentum
  • 4-hour: Swing trading, catch multi-hour trends, focus on momentum
  • Daily: Position trading, macroeconomic drivers, long holding periods
维度5分钟1小时4小时每日
支持资产BTC全资产全资产全资产
周期时长300秒3600秒14400秒86400秒
最小交易周期时长10秒60秒120秒600秒
剩余最小时长50秒180秒600秒3600秒
强制退出时长10秒60秒120秒600秒
适用场景HFT剥头皮交易快速波段交易波段交易头寸交易
流动性稀薄良好非常好极佳
手续费影响关键中等极低
每日交易次数2882461
按周期选择交易策略:
  • 5分钟:超高频率交易,需严格风险管理,重点使用penny_clipper策略
  • 1小时:均衡入场点,适合均值回归+动量策略
  • 4小时:波段交易,捕捉多小时趋势,重点使用动量策略
  • 每日:头寸交易,关注宏观驱动因素,持有周期长

Exit Logic

退出逻辑

Positions are monitored every 500ms with 9 exit types (in priority order):
  1. Force exit - < 30s before expiry (15-min) or < 10s (5-min)
  2. Take profit - PnL >= TP% (default 15%)
  3. Stop loss - PnL <= -SL% (default 12%)
  4. Ratchet floor - Progressive giveback from confirmed high-water mark
  5. Trailing stop - Tightens as expiry approaches
  6. Depth collapse - Orderbook depth dropped 60%+ while price dropping
  7. Stale profit - Profitable but bid unchanged for 7s
  8. Stagnant profit - At +3% for 13s with no progress
  9. Time exit - Approaching minimum time left
系统每500毫秒监控一次头寸,包含9种优先级递减的退出类型:
  1. 强制退出 - 距离结算剩余时间<30秒(15分钟周期)或<10秒(5分钟周期)
  2. 止盈 - 盈亏(PnL)≥止盈百分比(默认15%)
  3. 止损 - 盈亏(PnL)≤-止损百分比(默认12%)
  4. Ratchet止损底线 - 从确认的最高盈利点逐步回撤
  5. 追踪止损 - 临近结算时收紧止损
  6. 深度崩溃 - 订单簿深度下降60%以上且价格下跌
  7. 盈利停滞 - 处于盈利状态但买价7秒未变动
  8. 盈利僵持 - 盈利3%但13秒无进展
  9. 时间退出 - 接近剩余最小时长

Architecture

架构

Binance WS (spot) --> CryptoFeed --> Strategy Evaluators --> Entry Signals
Gamma API ---------> MarketScanner --> Round Detection    |
                                                          v
Poly Orderbook ----> OBI/Spread/Depth --> Exit Checks --> ExecutionService
                                    |
                              PositionManager (ratchet, trailing, depth collapse)
Binance WS (spot) --> CryptoFeed --> Strategy Evaluators --> Entry Signals
Gamma API ---------> MarketScanner --> Round Detection    |
                                                          v
Poly Orderbook ----> OBI/Spread/Depth --> Exit Checks --> ExecutionService
                                    |
                              PositionManager (ratchet, trailing, depth collapse)