Files
trade/data/service/bnkline.ts
T
Rekey ebaef5042e 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 合约交易对
2026-06-16 19:02:16 +08:00

27 lines
829 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { fetchKlines as fetchKlinesFromExchange } from "../exchanges";
import type { Kline } from "../types";
/**
* 获取 Binance 1m K 线数据(基于 MainClient REST API)。
*
* 内部复用 fetchKlines 静态方法,自动路由到正确的交易所客户端,
* 包含限流、Binance SDK 原生转换等逻辑。
* 返回本系统标准化 {@link Kline} 数组。
*
* @param symbol - 交易对符号(如 "BTCUSDT"
* @param startTime - 起始时间(Unix ms
* @param limit - 单次拉取条数,默认 500(最大 1000)
*/
export async function fetchKlines(
symbol: string,
startTime: number,
limit = 500,
): Promise<Kline[]> {
return fetchKlinesFromExchange({
exchange: 'binance',
type: 'spot',
symbol,
startTime,
limit,
});
}