1adb093100
- 每个交易所独立子类:BinanceRestClient extends BaseRestClient - 统一入口 createRestClient(exchangeId) 工厂函数 - KLINE_INTERVAL_MS 移至 constants.ts - fetchKlines 签名统一为 (symbol, startTime, limit?, endTime?) - throttle 限流实际生效 - convertBinanceKline interval 参数化 - 删除 filterConsecutive 死代码 - 更新 run/exchange.ts 和 service/bnkline.ts 调用方
19 lines
461 B
TypeScript
19 lines
461 B
TypeScript
import type { KlineInterval } from "../types";
|
|
|
|
/** K 线周期 → 毫秒数映射(用于时间桶计算) */
|
|
export const KLINE_INTERVAL_MS: Record<KlineInterval, number> = {
|
|
"1m": 60_000,
|
|
"3m": 180_000,
|
|
"5m": 300_000,
|
|
"15m": 900_000,
|
|
"30m": 1_800_000,
|
|
"1h": 3_600_000,
|
|
"2h": 7_200_000,
|
|
"4h": 14_400_000,
|
|
"6h": 21_600_000,
|
|
"8h": 28_800_000,
|
|
"1d": 86_400_000,
|
|
"1w": 604_800_000,
|
|
"1mon": 2_592_000_000,
|
|
};
|