Loading...
Loading...
Compare original and translation side by side
Skill by ara.so — Daily 2026 Skills collection.
由ara.so开发的Skill — 属于Daily 2026 Skills合集。
max_no_pricePaperExchangeClientmax_no_pricePaperExchangeClientgit clone https://github.com/sterlingcrispin/nothing-ever-happens.git
cd nothing-ever-happens
pip install -r requirements.txt
cp config.example.json config.json
cp .env.example .envgit clone https://github.com/sterlingcrispin/nothing-ever-happens.git
cd nothing-ever-happens
pip install -r requirements.txt
cp config.example.json config.json
cp .env.example .envconfig.jsonconfig.jsonstrategies.nothing_happens{
"strategies": {
"nothing_happens": {
"max_no_price": 0.08,
"order_size_usdc": 1.0,
"max_open_positions": 50,
"scan_interval_seconds": 60,
"min_liquidity_usdc": 100,
"exclude_keywords": ["sport", "nfl", "nba", "mlb", "nhl", "soccer", "tennis"]
}
}
}CONFIG_PATH=/path/to/other_config.json python -m bot.mainstrategies.nothing_happens{
"strategies": {
"nothing_happens": {
"max_no_price": 0.08,
"order_size_usdc": 1.0,
"max_open_positions": 50,
"scan_interval_seconds": 60,
"min_liquidity_usdc": 100,
"exclude_keywords": ["sport", "nfl", "nba", "mlb", "nhl", "soccer", "tennis"]
}
}
}CONFIG_PATH=/path/to/other_config.json python -m bot.main.env.envundefinedundefined
> **Never hardcode secrets.** Always use environment variable references.
---
> **切勿硬编码机密信息**,始终使用环境变量引用。
---undefinedundefined
The dashboard will bind to `$PORT` or `$DASHBOARD_PORT` when set.
---
仪表盘将绑定到`$PORT`或`$DASHBOARD_PORT`(若已设置)。
---bot/
main.py # Entry point — starts the runtime loop
strategies/
nothing_happens.py # Core strategy: scan, filter, buy NO
exchange/
client.py # Live exchange client (Polymarket CLOB API)
paper_client.py # PaperExchangeClient for safe simulation
dashboard.py # HTTP dashboard server
recovery.py # Persist and restore open positions
scripts/
db_stats.py # Inspect DB table counts and recent activity
export_db.py # Export live DB tables
wallet_history.py # Positions, trades, balances for configured wallet
parse_logs.py # Convert Heroku JSON logs to readable output
tests/ # Unit and regression testsbot/
main.py # 入口文件 — 启动运行循环
strategies/
nothing_happens.py # 核心策略:扫描、过滤、买入“否”选项
exchange/
client.py # 实盘交易所客户端(Polymarket CLOB API)
paper_client.py # PaperExchangeClient用于安全模拟交易
dashboard.py # HTTP仪表盘服务器
recovery.py # 持久化和恢复未平仓头寸
scripts/
db_stats.py # 查看数据库表计数和近期活动
export_db.py # 导出实盘数据库表
wallet_history.py # 查看配置钱包的头寸、交易和余额
parse_logs.py # 将Heroku JSON日志转换为可读格式
tests/ # 单元测试和回归测试python -m pytest -qpython -m pytest -qundefinedundefined
---
---export HEROKU_APP_NAME=my-polymarket-botexport HEROKU_APP_NAME=my-polymarket-bot
> Do **not** run the `worker` dyno. It exists only to fail fast if started accidentally.
> 请勿运行`worker` dyno,它仅用于在意外启动时快速失败。./alive.sh # Check if the app is alive
./logs.sh # Tail logs
./live_enabled.sh # Enable live trading
./live_disabled.sh # Disable live trading (back to paper)
./kill.sh # Stop the bot$HEROKU_APP_NAME./logs.sh my-polymarket-bot./alive.sh # 检查应用是否运行
./logs.sh # 查看实时日志
./live_enabled.sh # 启用实盘交易
./live_disabled.sh # 禁用实盘交易(切换回模拟模式)
./kill.sh # 停止机器人$HEROKU_APP_NAME./logs.sh my-polymarket-botPaperExchangeClient| Variable | Required value |
|---|---|
| |
| |
| |
PRIVATE_KEYFUNDER_ADDRESS12DATABASE_URLPOLYGON_RPC_URLPaperExchangeClient| 变量 | 必填值 |
|---|---|
| |
| |
| |
PRIVATE_KEYFUNDER_ADDRESS12DATABASE_URLPOLYGON_RPC_URLimport os
def is_live_mode() -> bool:
return (
os.getenv("BOT_MODE") == "live"
and os.getenv("LIVE_TRADING_ENABLED", "").lower() == "true"
and os.getenv("DRY_RUN", "true").lower() == "false"
)
print("Live mode:", is_live_mode())import os
def is_live_mode() -> bool:
return (
os.getenv("BOT_MODE") == "live"
and os.getenv("LIVE_TRADING_ENABLED", "").lower() == "true"
and os.getenv("DRY_RUN", "true").lower() == "false"
)
print("Live mode:", is_live_mode())import json, os
config_path = os.getenv("CONFIG_PATH", "config.json")
with open(config_path) as f:
config = json.load(f)
strategy_cfg = config["strategies"]["nothing_happens"]
max_no_price = strategy_cfg["max_no_price"] # e.g. 0.08
order_size = strategy_cfg["order_size_usdc"] # e.g. 1.0
print(f"Will buy NO when price <= {max_no_price} USDC, size={order_size} USDC")import json, os
config_path = os.getenv("CONFIG_PATH", "config.json")
with open(config_path) as f:
config = json.load(f)
strategy_cfg = config["strategies"]["nothing_happens"]
max_no_price = strategy_cfg["max_no_price"] # 示例:0.08
order_size = strategy_cfg["order_size_usdc"] # 示例:1.0
print(f"当价格 <= {max_no_price} USDC时买入‘否’选项,订单规模={order_size} USDC")import asyncio
from bot.main import main
asyncio.run(main())import asyncio
from bot.main import main
asyncio.run(main())DATABASE_URL=$DATABASE_URL python scripts/db_stats.pyDATABASE_URL=$DATABASE_URL python scripts/db_stats.pyheroku logs --num=1500 -a "$HEROKU_APP_NAME" | python scripts/parse_logs.py --html > report.htmlheroku logs --num=1500 -a "$HEROKU_APP_NAME" | python scripts/parse_logs.py --html > report.htmlpython scripts/export_db.py --app "$HEROKU_APP_NAME"python scripts/export_db.py --app "$HEROKU_APP_NAME"heroku config:set LIVE_TRADING_ENABLED=false -a "$HEROKU_APP_NAME"heroku config:set LIVE_TRADING_ENABLED=false -a "$HEROKU_APP_NAME"
The bot will immediately fall back to paper mode on next cycle without a restart.
机器人将在下一个循环中立即切换回模拟模式,无需重启。config.jsonundefinedconfig.jsonundefinedundefinedundefined{
"strategies": {
"nothing_happens": {
"exclude_keywords": ["sport", "nfl", "nba", "mlb", "nhl", "soccer", "tennis", "golf", "ufc", "esport"]
}
}
}{
"strategies": {
"nothing_happens": {
"exclude_keywords": ["sport", "nfl", "nba", "mlb", "nhl", "soccer", "tennis", "golf", "ufc", "esport"]
}
}
}| Symptom | Likely Cause | Fix |
|---|---|---|
| Bot uses paper mode unexpectedly | One of the three live flags is missing/wrong | Check all three: |
| Postgres not provisioned | |
| Orders never transmit | | |
| Dashboard not accessible | | |
| Worker dyno crashes immediately | Don't run worker dyno | |
| Bot buys sports markets | Keywords not in | Add sport/league names to config |
| Logs unreadable (JSON) | Heroku structured logging | Pipe through |
| 症状 | 可能原因 | 解决方法 |
|---|---|---|
| 机器人意外使用模拟模式 | 三个实盘标志中有一个缺失或设置错误 | 检查全部三个标志: |
实盘模式下出现 | 未配置Postgres | |
| 订单始终无法传输 | | |
| 仪表盘无法访问 | 未设置 | |
| Worker dyno立即崩溃 | 请勿运行worker dyno | |
| 机器人买入体育类市场 | 排除关键词列表中缺少相关词汇 | 将体育/联赛名称添加到配置中 |
| 日志不可读(JSON格式) | Heroku使用结构化日志 | 通过 |