优化跟单过滤逻辑和卖出价格计算

- 优化订单簿请求:仅在需要时请求,避免不必要的API调用
- 卖出价格改为市价卖出:优先使用订单簿bestBid,失败则使用Leader价格,固定按90%计算
- 价格容忍度默认值:如果为0,自动使用5%
- 使用枚举和数据类优化checkFilters方法:
  - 新增FilterResult数据类和FilterStatus枚举
  - 移除无用字段isBuyOrder参数
  - 使用类型安全的枚举替代字符串判断
- 优化代码结构:减少if-else嵌套,使用链式调用
- 移除最小订单簿深度功能(minOrderbookDepth)
- 优化最小订单深度逻辑:检查所有方向(买盘+卖盘)的总深度
This commit is contained in:
WrBug
2025-12-09 00:52:50 +08:00
parent d393bd7b40
commit f0c40533cf
18 changed files with 235 additions and 257 deletions
-4
View File
@@ -112,7 +112,6 @@ export interface CopyTradingTemplate {
// 过滤条件
minOrderDepth?: string
maxSpread?: string
minOrderbookDepth?: string
minPrice?: string // 最低价格(可选),NULL表示不限制最低价
maxPrice?: string // 最高价格(可选),NULL表示不限制最高价
createdAt: number
@@ -204,7 +203,6 @@ export interface CopyTrading {
// 过滤条件
minOrderDepth?: string
maxSpread?: string
minOrderbookDepth?: string
minPrice?: string // 最低价格(可选),NULL表示不限制最低价
maxPrice?: string // 最高价格(可选),NULL表示不限制最高价
// 新增配置字段
@@ -248,7 +246,6 @@ export interface CopyTradingCreateRequest {
// 过滤条件
minOrderDepth?: string
maxSpread?: string
minOrderbookDepth?: string
minPrice?: string // 最低价格(可选),NULL表示不限制最低价
maxPrice?: string // 最高价格(可选),NULL表示不限制最高价
// 新增配置字段
@@ -280,7 +277,6 @@ export interface CopyTradingUpdateRequest {
// 过滤条件
minOrderDepth?: string
maxSpread?: string
minOrderbookDepth?: string
minPrice?: string // 最低价格(可选),NULL表示不限制最低价
maxPrice?: string // 最高价格(可选),NULL表示不限制最高价
// 新增配置字段