refactor(exchanges): fetchKlines 改为 params 对象签名,新增 type/exchange 参数

- 新增 FetchKlinesParams 接口统一 fetchKlines 参数(exchange/type/symbol/startTime/limit/endTime)
- BaseRestClient 抽象方法 + MarketDataFeed 接口改为 params 对象签名
- BinanceRestClient / BinanceFuturesRestClient 由调用方传入 type,不再硬编码 spot/um
- index.ts 新增静态 fetchKlines(params) 便捷函数,按 exchange+type 自动路由
- exchange.ts / bnkline.ts 调用方适配新签名
- 初始化 SQL 补充 BNBUSDT/SOLUSDT 合约交易对
This commit is contained in:
Rekey
2026-06-16 19:02:16 +08:00
parent 705a2f6ea0
commit ebaef5042e
7 changed files with 87 additions and 56 deletions
+3 -11
View File
@@ -13,7 +13,7 @@
// ============================================================
import { logger } from "../utils/logger";
import type { Kline, MarketInfo, RestClientConfig } from "../types";
import type { Kline, MarketInfo, FetchKlinesParams, RestClientConfig } from "../types";
import { DEFAULT_REST_CONFIG } from "../types/base";
// ============================================================
@@ -83,17 +83,9 @@ export abstract class BaseRestClient {
* 2. 将原始数据转换为本系统标准化 Kline 结构
* 3. 处理分页逻辑(若时间跨度超过单次请求上限)
*
* @param symbol - 交易对符号(如 BTCUSDT)
* @param startTime - 起始时间(Unix ms
* @param limit - 单次最大条数(默认取自 config.defaultLimit
* @param endTime - 结束时间(Unix ms),可选
* @param params - fetchKlines 统一参数对象
*/
abstract fetchKlines(
symbol: string,
startTime: number,
limit?: number,
endTime?: number,
): Promise<Kline[]>;
abstract fetchKlines(params: FetchKlinesParams): Promise<Kline[]>;
/**
* 获取交易所交易对信息(REST)。