diff --git a/.env.example b/.env.example index 0b874ce..a74823e 100644 --- a/.env.example +++ b/.env.example @@ -60,7 +60,7 @@ MAKER_MAX_CLOSE_SLIPPAGE_PCT=0.05 # Maker close slippage guard (fallbacks MAKER_PRICE_TICK=0.1 # Maker price tick size (defaults to PRICE_TICK) # Maker-points Binance depth imbalance monitor -MAKER_POINTS_BINANCE_DEPTH_WINDOW_BPS=5 # Binance depth monitor window around best bid/ask (bps) +MAKER_POINTS_BINANCE_DEPTH_WINDOW_BPS=3 # Binance depth monitor window around best bid/ask (bps) MAKER_POINTS_BINANCE_DEPTH_IMBALANCE_RATIO=8 # Imbalance threshold ratio (e.g. 8 => one side >= 8x) # Grid strategy defaults diff --git a/docs/standx/maker-points-guide.md b/docs/standx/maker-points-guide.md index 98449ba..cd181e7 100644 --- a/docs/standx/maker-points-guide.md +++ b/docs/standx/maker-points-guide.md @@ -132,7 +132,7 @@ MAKER_POINTS_ORDER_AMOUNT=0.01 MAKER_POINTS_CLOSE_THRESHOLD=0.1 MAKER_POINTS_STOP_LOSS_USD=0 MAKER_POINTS_MIN_REPRICE_BPS=3 -MAKER_POINTS_BINANCE_DEPTH_WINDOW_BPS=5 +MAKER_POINTS_BINANCE_DEPTH_WINDOW_BPS=3 MAKER_POINTS_BINANCE_DEPTH_IMBALANCE_RATIO=8 # ===== 挂单档位开关 ===== @@ -175,7 +175,7 @@ MAKER_POINTS_ORDER_AMOUNT=0.01 MAKER_POINTS_CLOSE_THRESHOLD=0.1 MAKER_POINTS_STOP_LOSS_USD=0 MAKER_POINTS_MIN_REPRICE_BPS=3 -MAKER_POINTS_BINANCE_DEPTH_WINDOW_BPS=5 +MAKER_POINTS_BINANCE_DEPTH_WINDOW_BPS=3 MAKER_POINTS_BINANCE_DEPTH_IMBALANCE_RATIO=8 MAKER_POINTS_BAND_0_10=true MAKER_POINTS_BAND_10_30=true @@ -218,7 +218,7 @@ bun run pm2:start:maker-points | `MAKER_POINTS_ORDER_AMOUNT` | 每笔挂单数量 | 建议 `0.01` 起步 | | `MAKER_POINTS_CLOSE_THRESHOLD` | 持仓达到多少开始平仓 | 设为 `0` 表示不自动平仓 | | `MAKER_POINTS_STOP_LOSS_USD` | 亏损多少美元强制平仓 | 设为 `0` 表示关闭止损 | -| `MAKER_POINTS_BINANCE_DEPTH_WINDOW_BPS` | Binance 失衡检测窗口(bps) | 默认 `5` | +| `MAKER_POINTS_BINANCE_DEPTH_WINDOW_BPS` | Binance 失衡检测窗口(bps) | 默认 `3` | | `MAKER_POINTS_BINANCE_DEPTH_IMBALANCE_RATIO` | Binance 失衡比例阈值 | 默认 `8` | | `MAKER_POINTS_BAND_*` | 三个挂单档位的开关 | 全部 `true` 即可 | | `STANDX_TOKEN_CREATE_DATE` | Token 创建日期 | 推荐配置,格式 YYYY-MM-DD | diff --git a/src/config.ts b/src/config.ts index fcdd9b8..2cbd705 100644 --- a/src/config.ts +++ b/src/config.ts @@ -227,7 +227,7 @@ export interface MakerPointsConfig { minRepriceBps: number; /** 是否根据 Binance 盘口深度失衡自动取消单边挂单,默认 true */ enableBinanceDepthCancel: boolean; - /** Binance 深度监控窗口(bps),默认 5 */ + /** Binance 深度监控窗口(bps),默认 3 */ binanceDepthWindowBps?: number; /** Binance 深度失衡比例阈值,默认 8 */ binanceDepthImbalanceRatio?: number; @@ -258,7 +258,7 @@ export const makerPointsConfig: MakerPointsConfig = { band30To100Amount: parseNumber(process.env.MAKER_POINTS_BAND_30_100_AMOUNT, defaultMakerPointsAmount), minRepriceBps: parseNumber(process.env.MAKER_POINTS_MIN_REPRICE_BPS, 3), enableBinanceDepthCancel: parseBoolean(process.env.MAKER_POINTS_BINANCE_DEPTH_CANCEL, true), - binanceDepthWindowBps: parseNumber(process.env.MAKER_POINTS_BINANCE_DEPTH_WINDOW_BPS, 5), + binanceDepthWindowBps: parseNumber(process.env.MAKER_POINTS_BINANCE_DEPTH_WINDOW_BPS, 3), binanceDepthImbalanceRatio: parseNumber(process.env.MAKER_POINTS_BINANCE_DEPTH_IMBALANCE_RATIO, 8), filterMinDepth: parseNumber(process.env.MAKER_POINTS_FILTER_MIN_DEPTH, 10), }; diff --git a/src/strategy/maker-points-engine.ts b/src/strategy/maker-points-engine.ts index 7084ba2..0685f38 100644 --- a/src/strategy/maker-points-engine.ts +++ b/src/strategy/maker-points-engine.ts @@ -211,7 +211,7 @@ export class MakerPointsEngine { : 8, depthWindowBps: Number.isFinite(this.config.binanceDepthWindowBps) ? Math.max(1, Number(this.config.binanceDepthWindowBps)) - : 5, + : 3, speedMs: 100, logger: (context, error) => { this.tradeLog.push("warn", `Binance ${context} 异常: ${extractMessage(error)}`); diff --git a/tests/maker-points-binance-depth-config.test.ts b/tests/maker-points-binance-depth-config.test.ts index 81291e1..52e391e 100644 --- a/tests/maker-points-binance-depth-config.test.ts +++ b/tests/maker-points-binance-depth-config.test.ts @@ -27,7 +27,7 @@ class StubAdapter implements ExchangeAdapter { } describe("MakerPointsEngine Binance depth monitor config", () => { - it("uses default 5bps window and ratio 8", () => { + it("uses default 3bps window and ratio 8", () => { const engine = new MakerPointsEngine( { symbol: "BTC-USD", @@ -55,7 +55,7 @@ describe("MakerPointsEngine Binance depth monitor config", () => { const trackerOptions = ((engine as any).binanceDepth as { options?: { depthWindowBps?: number; ratio?: number } }) .options; - expect(trackerOptions?.depthWindowBps).toBe(5); + expect(trackerOptions?.depthWindowBps).toBe(3); expect(trackerOptions?.ratio).toBe(8); engine.stop();