# 币安永续合约定时平仓 # 用法: # 首次:复制 .secrets.toml.example 为 .secrets.toml 并填写 API 密钥 # 运行一次: docker compose run --rm position-closer # 后台定时: docker compose up -d (按 profile 或 command 配置循环) services: position-closer: build: . image: bn-position-closer:latest container_name: position-closer # 挂载项目目录,代码与配置均从宿主机读取(不写入镜像) volumes: - .:/app:ro # 可选:用环境变量覆盖配置(如 CI/云环境) environment: - BINANCE_POSITION_DRY_RUN=${DRY_RUN:-true} env_file: - .env # 默认运行一次;需每小时循环时可改为 command: ["sh", "-c", "while true; do python -m position_closer; sleep 3600; done"] command: ["python", "-m", "position_closer"] restart: "no"