Files
smith1ee 1a4688a931 Initial commit
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 10:13:14 +08:00

219 lines
7.6 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# =============================================================================
# poly_bot 环境配置
# Environment Configuration
#
# 复制为 .env 后填写必填项:
# Copy to .env and fill required fields:
# cp .env.example .env
# =============================================================================
# -----------------------------------------------------------------------------
# [1] 账户认证
# Account & Authentication REQUIRED
# -----------------------------------------------------------------------------
# Polymarket 私钥(64 位 hex,可带或不带 0x 前缀)
# Private key (64-char hex, with or without 0x prefix)
# 邮箱/Magic 账号: https://reveal.magic.link/polymarket
# Email/Magic: https://reveal.magic.link/polymarket
# 浏览器钱包: 导出对应 EOA 私钥
# Browser wallet: export your EOA private key
POLYMARKET_PRIVATE_KEY=
# 资金托管地址(Settings 里显示的 Address,非 EOA 签名地址)
# Funder address from Polymarket Settings (NOT your EOA signer address)
# https://polymarket.com/settings?tab=builder → Address
# 邮箱与浏览器钱包在 V2 下通常均为 deposit wallet,填 Settings 地址即可
# For V2, both email and browser accounts usually use the deposit wallet from Settings
POLYMARKET_PROXY_ADDRESS=
# -----------------------------------------------------------------------------
# [2] Builder API REQUIRED for Merge
# Merge / Redeem 前必须填写
# -----------------------------------------------------------------------------
# 在 Polymarket → Settings → Builders → Create New 获取
# Get from Polymarket → Settings → Builders → Create New
POLY_BUILDER_API_KEY=
POLY_BUILDER_SECRET=
POLY_BUILDER_PASSPHRASE=
# -----------------------------------------------------------------------------
# [3] CLOB 接口
# CLOB API optional
# -----------------------------------------------------------------------------
# API 地址 — 使用 https://clob.polymarket.com(不要用 clob-v2.polymarket.com
# API endpoint — use https://clob.polymarket.com (NOT clob-v2.polymarket.com)
CLOB_API_URL=https://clob.polymarket.com
# 签名类型 — 按「资金托管钱包类型」选择,与登录方式(邮箱/钱包)无必然对应
# Signature type — based on funder wallet type, NOT login method (email vs browser)
#
# Poly1271 | deposit | 3 — V2 deposit wallet(默认;邮箱/Magic 与浏览器钱包均适用)
# Poly1271 | deposit | 3 — V2 deposit wallet (default; email/Magic and browser wallet)
#
# Proxy | magic | email — 仅 V1 旧 Magic 代理(Settings 地址 = ProxyFactory 推导地址)
# Proxy | magic | email — legacy Magic proxy only (Settings addr = ProxyFactory derive)
#
# GnosisSafe | safe — Gnosis Safe
# Eoa | 0 — 纯 EOA 直连(无需 POLYMARKET_PROXY_ADDRESS
# Eoa | 0 — direct EOA (no POLYMARKET_PROXY_ADDRESS)
#
# 若 Proxy 下单报 "please use the deposit wallet flow" → 改用 Poly1271
# If Proxy orders fail with "please use the deposit wallet flow" → use Poly1271
SIGNATURE_TYPE=Poly1271
# -----------------------------------------------------------------------------
# [4] 链上 & Relayer
# On-chain & Relayer optional
# -----------------------------------------------------------------------------
RELAYER_URL=https://relayer-v2.polymarket.com
# Merge / Redeem 输出代币(默认 pUSD
# Output token after Merge or Redeem (default: pUSD)
MERGE_OUTPUT_TOKEN=pUSD
# Merge 后自动 wrap 为 pUSD
# Auto-wrap merge proceeds to pUSD via Collateral Onramp
MERGE_WRAP_TO_PUSD=true
REDEEM_OUTPUT_TOKEN=pUSD
# Polygon RPC(不填则使用内置公共节点)
# Polygon RPC (uses built-in public node if unset)
# RPC_URL=https://polygon-bor-rpc.publicnode.com
# -----------------------------------------------------------------------------
# [5] 市场发现
# Market Discovery optional
# -----------------------------------------------------------------------------
# 监控的加密货币符号,逗号分隔
# Comma-separated crypto symbols to monitor
CRYPTO_SYMBOLS=btc,eth
# 距下一窗口结束前多少秒刷新市场
# Seconds before next window ends to refresh markets
MARKET_REFRESH_ADVANCE_SECS=5
# -----------------------------------------------------------------------------
# [6] 套利 & 下单
# Arbitrage & Orders optional
# -----------------------------------------------------------------------------
# 最小利润阈值(0.001 = 0.1%
# Min profit threshold (0.001 = 0.1%)
MIN_PROFIT_THRESHOLD=0.001
# 单笔最大下单量(USDC / pUSD)
# Max order size per trade (USDC / pUSD)
MAX_ORDER_SIZE_USDC=10.0
# 执行条件: yes + no <= 1 - spread(如 spread=0.01 时在 0.99 执行)
# Execute when yes + no <= 1 - spread (e.g. spread=0.01 triggers at 0.99)
ARBITRAGE_EXECUTION_SPREAD=0.03
# YES / NO 价格下限,0 = 不限制
# Min YES/NO price; 0 = no filter
MIN_YES_PRICE_THRESHOLD=0.2
MIN_NO_PRICE_THRESHOLD=0.2
# 滑点 [first, second]: 下降侧用 second,上涨/持平用 first
# Slippage [first, second]: use second for declining side, first for rising/flat
SLIPPAGE=0.01,0.01
# 订单类型: GTC | GTD | FOK | FAK
# Order type: GTC | GTD | FOK | FAK
ARBITRAGE_ORDER_TYPE=GTD
# GTD 订单过期时间(秒),仅 ARBITRAGE_ORDER_TYPE=GTD 时生效
# GTD order expiry in seconds (only when ARBITRAGE_ORDER_TYPE=GTD)
GTD_EXPIRATION_SECS=300
# -----------------------------------------------------------------------------
# [7] 风控 & 收尾
# Risk & Wind-down optional
# -----------------------------------------------------------------------------
# 每轮最大风险敞口(USDC
# Max exposure per round (USDC)
RISK_MAX_EXPOSURE_USDC=1000.0
# 持仓不平衡阈值(0.1 = 10%)
# Position imbalance threshold (0.1 = 10%)
RISK_IMBALANCE_THRESHOLD=0.1
# 对冲止盈 / 止损比例
# Hedge take-profit / stop-loss ratio
HEDGE_TAKE_PROFIT_PCT=0.05
HEDGE_STOP_LOSS_PCT=0.05
# 市场结束前 N 分钟停止套利,0 = 不限制
# Stop arbitrage N minutes before market end; 0 = no limit
STOP_ARBITRAGE_BEFORE_END_MINUTES=2
# 窗口结束前收尾(取消挂单 → Merge → 市价卖剩余),0 = 关闭
# Wind-down before window end (cancel orders → Merge → market sell remainder); 0 = disabled
WIND_DOWN_BEFORE_WINDOW_END_MINUTES=1
# 收尾时单腿卖出限价
# Limit price for single-leg sell during wind-down
WIND_DOWN_SELL_PRICE=0.01
# 定时 Merge 间隔(分钟),0 = 关闭
# Scheduled Merge interval in minutes; 0 = disabled
MERGE_INTERVAL_MINUTES=1
# -----------------------------------------------------------------------------
# [8] 持仓同步
# Position Sync optional
# -----------------------------------------------------------------------------
# 持仓同步间隔(秒)
# Position sync interval in seconds
POSITION_SYNC_INTERVAL_SECS=10
# 仓位平衡检查间隔(秒)
# Position balance check interval in seconds
POSITION_BALANCE_INTERVAL_SECS=60
# 不平衡阈值
# Imbalance threshold to trigger balance action
POSITION_BALANCE_THRESHOLD=2.0
# 最小总持仓要求
# Min total position required to run balance check
POSITION_BALANCE_MIN_TOTAL=5.0
# -----------------------------------------------------------------------------
# [9] 日志 & 界面
# Logging & UI optional
# -----------------------------------------------------------------------------
# 日志级别: trace | debug | info | warn | error
# Log level: trace | debug | info | warn | error
RUST_LOG=info
# 日志文件路径
# Log file path
# LOG_FILE=bot.log
# 启用终端 UI
# Enable terminal dashboard UI
# TUI_ENABLED=true
# 纯文本日志(关闭 TUI 着色)
# Plain-text logs (disable TUI styling)
# PLAIN_LOGS=false