添加 USDT-M 合约数据支持(配置层 + 清理多余字段)
- 配置层:env.yaml 新增 binance_futures API Key 段,validators + config 同步 - 清理 TradingPair 实体:删除 kline_interval、kline_intervals、kline_synthesis_enabled - 删除 fetchKlines 系列函数的 interval 参数,硬编码为 1m - 更新 SQL seed 数据、example、base_rest 接口、types 接口 - 新增 AGENTS/08-boundaries.md 执行纪律 - 新增 PLAN-add-futures-data.md 方案文档
This commit is contained in:
@@ -34,7 +34,10 @@ export interface RedisConfig {
|
||||
|
||||
/** 交易所 API 密钥配置(按交易所 ID 索引) */
|
||||
export interface ExchangeConfig {
|
||||
/** 现货市场 API Key */
|
||||
binance: ExchangeApiKeys;
|
||||
/** USDT-M 永续合约 API Key */
|
||||
binance_futures: ExchangeApiKeys;
|
||||
// 未来扩展:okx、bybit 等
|
||||
[exchangeId: string]: ExchangeApiKeys | undefined;
|
||||
}
|
||||
@@ -105,6 +108,15 @@ export function validateConfig(raw: unknown): EnvConfig {
|
||||
const binanceApiKey = assertString(binanceObj["api_key"], "exchange.binance.api_key");
|
||||
const binanceApiSecret = assertString(binanceObj["api_secret"], "exchange.binance.api_secret");
|
||||
|
||||
// --- binance_futures ---
|
||||
const binanceFutures = exObj["binance_futures"];
|
||||
if (typeof binanceFutures !== "object" || binanceFutures === null) {
|
||||
throw new Error("[config] env.yaml exchange 缺少 binance_futures 配置");
|
||||
}
|
||||
const futuresObj = binanceFutures as Record<string, unknown>;
|
||||
const futuresApiKey = assertString(futuresObj["api_key"], "exchange.binance_futures.api_key");
|
||||
const futuresApiSecret = assertString(futuresObj["api_secret"], "exchange.binance_futures.api_secret");
|
||||
|
||||
// --- logging ---
|
||||
const logging = obj["logging"];
|
||||
if (typeof logging !== "object" || logging === null) {
|
||||
@@ -132,6 +144,10 @@ export function validateConfig(raw: unknown): EnvConfig {
|
||||
api_key: binanceApiKey,
|
||||
api_secret: binanceApiSecret,
|
||||
},
|
||||
binance_futures: {
|
||||
api_key: futuresApiKey,
|
||||
api_secret: futuresApiSecret,
|
||||
},
|
||||
},
|
||||
logging: {
|
||||
level: logLevel,
|
||||
|
||||
Reference in New Issue
Block a user