Update Binance WebSocket configuration and enhance depth handling

- Changed WebSocket base URL to support both spot and futures trading.
- Adjusted depth tracking parameters for improved performance, increasing the ratio and reducing speed.
- Enhanced payload parsing to accommodate additional data structures from Binance, ensuring robust handling of bids and asks.
- Updated comments for clarity on connection behavior and heartbeat monitoring.
This commit is contained in:
discountry
2026-01-22 10:23:07 +08:00
parent 24339929dc
commit fe7b8eb6f3
2 changed files with 20 additions and 11 deletions
+3 -3
View File
@@ -190,10 +190,10 @@ export class MakerPointsEngine {
this.priceTick = Math.max(1e-9, this.config.priceTick);
this.qtyStep = Math.max(1e-9, this.config.qtyStep);
this.binanceDepth = new BinanceDepthTracker(resolveBinanceSymbol(this.config.symbol), {
baseUrl: process.env.BINANCE_WS_URL,
baseUrl: process.env.BINANCE_SPOT_WS_URL ?? process.env.BINANCE_WS_URL,
levels: 20,
ratio: 5,
speedMs: 500,
ratio: 9,
speedMs: 100,
logger: (context, error) => {
this.tradeLog.push("warn", `Binance ${context} 异常: ${extractMessage(error)}`);
},