移除 Redis、精简配置,新增 Docker 支持
- position_closer: 去掉 Redis 依赖,平仓条件仅名义+未实现盈亏 - requirements: 移除 redis - settings.toml: 仅保留实际使用的配置项 - 新增 Dockerfile(仅安装依赖)、docker-compose(挂载代码与配置) - 新增 .dockerignore、.gitignore(含 nohup.log) Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
39
settings.toml.example
Normal file
39
settings.toml.example
Normal file
@@ -0,0 +1,39 @@
|
||||
# 币安永续合约定时平仓 - 配置
|
||||
# Dynaconf 加载顺序:环境变量 > .secrets.toml > 本文件
|
||||
# 敏感项(binance_api_key / binance_api_secret)请放在 .secrets.toml
|
||||
binance_api_secret = "PsqCaorS7JtTyqVMxxGudwm2A627FAlS8QmkwCW3HgkBzKuvNfmSrvM3VZASC8T2"
|
||||
binance_api_key = "b8AAFR9GkJRtPxhkEqhoYe13IH7nj9hwht24TWVHv1X4CVRA4ZSt9Hs3nSbqPzhc"
|
||||
# ---------- 币安 ----------
|
||||
# 合约 API 地址,含 testnet 则使用测试网
|
||||
binance_base_url = "https://fapi.binance.com"
|
||||
|
||||
# ---------- Redis ----------
|
||||
redis_url = "redis://hs002.oopsapi.com:63791/0"
|
||||
# 强制平仓合约的 Set key,向此 set 添加 symbol 即触发平仓
|
||||
redis_close_key = "close_position:contracts"
|
||||
# 总未实现盈亏历史的 Sorted Set key(score=时间戳, member=时间戳:盈亏值),用于平仓前置条件
|
||||
redis_unrealized_profit_history_key = "close_position:unrealized_profit_history"
|
||||
|
||||
# ---------- 平仓前置条件 ----------
|
||||
# 近 N 秒内最小总未实现盈亏作为基准;当前总未实现盈亏 - 该最小 > unrealized_profit_min_rise 才继续执行平仓(默认 300)
|
||||
unrealized_profit_window_seconds = 300
|
||||
# 平仓前置条件:当前总未实现盈亏 - 近 N 秒最小总未实现盈亏 须大于此值(USDT)才执行平仓(默认 2)
|
||||
unrealized_profit_min_rise = 2
|
||||
|
||||
# ---------- 平仓规则 ----------
|
||||
# 大仓位阈值(USDT):多空名义价值总和大于此值且盈利大于 notional_large_close_min_profit 时平仓(默认 50)
|
||||
notional_threshold = 50
|
||||
# 大仓位平仓最低盈利(USDT):大仓位未实现盈亏须大于此值才平仓(默认 0.3)
|
||||
notional_large_close_min_profit = 0.3
|
||||
# 小仓位平仓阈值(USDT):多空名义价值总和小于此值且盈利大于 small_close_min_profit 时平仓(默认 30)
|
||||
notional_small_close_threshold = 30
|
||||
# 小仓位平仓最低盈利(USDT):小仓位未实现盈亏须大于此值才平仓(默认 0.03)
|
||||
small_close_min_profit = 0.03
|
||||
|
||||
# ---------- 其他 ----------
|
||||
# 默认 true(dry-run,不真实下单);设为 false 或环境变量 DRY_RUN=0 时真实下单
|
||||
dry_run = true
|
||||
# WebSocket 建立连接超时(秒),超时则退出,避免 async with socket 无限挂起
|
||||
ws_connection_timeout = 30
|
||||
# 定时轮询间隔(秒),当前流程为一次扫描+WS 监听,此配置保留备用
|
||||
interval_seconds = 60
|
||||
Reference in New Issue
Block a user