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

- 优化订单簿请求:仅在需要时请求,避免不必要的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
+8 -8
View File
@@ -597,10 +597,10 @@
"priceToleranceTooltip": "Allowed adjustment range for copy price based on Leader price, used to adjust price within Leader price ± tolerance range to improve fill rate. For example: set to 5%, Leader price is 0.5, then copy price can be in 0.475-0.525 range.",
"priceTolerancePlaceholder": "Default 5% (optional)",
"minOrderDepth": "Min Order Depth (USDC)",
"minOrderDepthTooltip": "Minimum order depth (USDC amount), NULL means this filter is not enabled. Ensures market has sufficient liquidity",
"minOrderDepthTooltip": "Check total order amount (bids + asks) in orderbook to ensure sufficient liquidity. Leave empty to disable",
"minOrderDepthPlaceholder": "For example: 100 (optional, leave empty to disable)",
"maxSpread": "Max Spread (Absolute Price)",
"maxSpreadTooltip": "Maximum spread (absolute price), NULL means this filter is not enabled. Avoid copying in markets with excessive spreads",
"maxSpreadTooltip": "Maximum spread (absolute price). Avoid copying in markets with excessive spreads. Leave empty to disable",
"maxSpreadPlaceholder": "For example: 0.05 (5 cents, optional, leave empty to disable)",
"minOrderbookDepth": "Min Orderbook Depth (USDC)",
"minOrderbookDepthTooltip": "Minimum orderbook depth (USDC amount), NULL means this filter is not enabled. Check depth of first N levels",
@@ -654,10 +654,10 @@
"priceToleranceTooltip": "Allowed adjustment range for copy price based on Leader price, used to adjust price within Leader price ± tolerance range to improve fill rate. For example: set to 5%, Leader price is 0.5, then copy price can be in 0.475-0.525 range.",
"priceTolerancePlaceholder": "Default 5% (optional)",
"minOrderDepth": "Min Order Depth (USDC)",
"minOrderDepthTooltip": "Minimum order depth (USDC amount), NULL means this filter is not enabled. Ensures market has sufficient liquidity",
"minOrderDepthTooltip": "Check total order amount (bids + asks) in orderbook to ensure sufficient liquidity. Leave empty to disable",
"minOrderDepthPlaceholder": "For example: 100 (optional, leave empty to disable)",
"maxSpread": "Max Spread (Absolute Price)",
"maxSpreadTooltip": "Maximum spread (absolute price), NULL means this filter is not enabled. Avoid copying in markets with excessive spreads",
"maxSpreadTooltip": "Maximum spread (absolute price). Avoid copying in markets with excessive spreads. Leave empty to disable",
"maxSpreadPlaceholder": "For example: 0.05 (5 cents, optional, leave empty to disable)",
"minOrderbookDepth": "Min Orderbook Depth (USDC)",
"minOrderbookDepthTooltip": "Minimum orderbook depth (USDC amount), NULL means this filter is not enabled. Check depth of first N levels",
@@ -719,10 +719,10 @@
"delaySecondsPlaceholder": "Default 0 (copy immediately)",
"filterConditions": "Filter Conditions (Optional)",
"minOrderDepth": "Min Order Depth (USDC)",
"minOrderDepthTooltip": "Minimum order depth (USDC amount), NULL means this filter is not enabled. Ensures market has sufficient liquidity",
"minOrderDepthTooltip": "Check total order amount (bids + asks) in orderbook to ensure sufficient liquidity. Leave empty to disable",
"minOrderDepthPlaceholder": "For example: 100 (optional, leave empty to disable)",
"maxSpread": "Max Spread (Absolute Price)",
"maxSpreadTooltip": "Maximum spread (absolute price), NULL means this filter is not enabled. Avoid copying in markets with excessive spreads",
"maxSpreadTooltip": "Maximum spread (absolute price). Avoid copying in markets with excessive spreads. Leave empty to disable",
"maxSpreadPlaceholder": "For example: 0.05 (5 cents, optional, leave empty to disable)",
"minOrderbookDepth": "Min Orderbook Depth (USDC)",
"minOrderbookDepthTooltip": "Minimum orderbook depth (USDC amount), NULL means this filter is not enabled. Check depth of first N levels",
@@ -794,10 +794,10 @@
"delaySecondsPlaceholder": "Default 0 (copy immediately)",
"filterConditions": "Filter Conditions (Optional)",
"minOrderDepth": "Min Order Depth (USDC)",
"minOrderDepthTooltip": "Minimum order depth (USDC amount), NULL means this filter is not enabled",
"minOrderDepthTooltip": "Check total order amount (bids + asks) in orderbook to ensure sufficient liquidity. Leave empty to disable",
"minOrderDepthPlaceholder": "For example: 100 (optional, leave empty to disable)",
"maxSpread": "Max Spread (Absolute Price)",
"maxSpreadTooltip": "Maximum spread (absolute price), NULL means this filter is not enabled",
"maxSpreadTooltip": "Maximum spread (absolute price). Avoid copying in markets with excessive spreads. Leave empty to disable",
"maxSpreadPlaceholder": "For example: 0.05 (5 cents, optional, leave empty to disable)",
"minOrderbookDepth": "Min Orderbook Depth (USDC)",
"minOrderbookDepthTooltip": "Minimum orderbook depth (USDC amount), NULL means this filter is not enabled",
+8 -8
View File
@@ -512,10 +512,10 @@
"priceToleranceTooltip": "允许跟单价格在 Leader 价格基础上的调整范围,用于在 Leader 价格 ± 容忍度范围内调整价格,提高成交率。例如:设置为 5%,Leader 价格为 0.5,则跟单价格可在 0.475-0.525 范围内。",
"priceTolerancePlaceholder": "默认 5%(可选)",
"minOrderDepth": "最小订单深度 (USDC)",
"minOrderDepthTooltip": "最小订单深度(USDC金额),NULL表示不启用此过滤。确保市场有足够的流动性",
"minOrderDepthTooltip": "检查订单簿的总订单金额(买盘+卖盘),确保市场有足够的流动性。不填写则不启用此过滤",
"minOrderDepthPlaceholder": "例如:100(可选,不填写表示不启用)",
"maxSpread": "最大价差(绝对价格)",
"maxSpreadTooltip": "最大价差(绝对价格)NULL表示不启用此过滤。避免在价差过大的市场跟单",
"maxSpreadTooltip": "最大价差(绝对价格)。避免在价差过大的市场跟单。不填写则不启用此过滤",
"maxSpreadPlaceholder": "例如:0.05(5美分,可选,不填写表示不启用)",
"minOrderbookDepth": "最小订单簿深度 (USDC)",
"minOrderbookDepthTooltip": "最小订单簿深度(USDC金额),NULL表示不启用此过滤。检查前 N 档的深度",
@@ -569,10 +569,10 @@
"priceToleranceTooltip": "允许跟单价格在 Leader 价格基础上的调整范围,用于在 Leader 价格 ± 容忍度范围内调整价格,提高成交率。例如:设置为 5%,Leader 价格为 0.5,则跟单价格可在 0.475-0.525 范围内。",
"priceTolerancePlaceholder": "默认 5%(可选)",
"minOrderDepth": "最小订单深度 (USDC)",
"minOrderDepthTooltip": "最小订单深度(USDC金额),NULL表示不启用此过滤。确保市场有足够的流动性",
"minOrderDepthTooltip": "检查订单簿的总订单金额(买盘+卖盘),确保市场有足够的流动性。不填写则不启用此过滤",
"minOrderDepthPlaceholder": "例如:100(可选,不填写表示不启用)",
"maxSpread": "最大价差(绝对价格)",
"maxSpreadTooltip": "最大价差(绝对价格)NULL表示不启用此过滤。避免在价差过大的市场跟单",
"maxSpreadTooltip": "最大价差(绝对价格)。避免在价差过大的市场跟单。不填写则不启用此过滤",
"maxSpreadPlaceholder": "例如:0.05(5美分,可选,不填写表示不启用)",
"minOrderbookDepth": "最小订单簿深度 (USDC)",
"minOrderbookDepthTooltip": "最小订单簿深度(USDC金额),NULL表示不启用此过滤。检查前 N 档的深度",
@@ -646,10 +646,10 @@
"delaySecondsPlaceholder": "默认 0(立即跟单)",
"filterConditions": "过滤条件(可选)",
"minOrderDepth": "最小订单深度 (USDC)",
"minOrderDepthTooltip": "最小订单深度(USDC金额),NULL表示不启用此过滤。确保市场有足够的流动性",
"minOrderDepthTooltip": "检查订单簿的总订单金额(买盘+卖盘),确保市场有足够的流动性。不填写则不启用此过滤",
"minOrderDepthPlaceholder": "例如:100(可选,不填写表示不启用)",
"maxSpread": "最大价差(绝对价格)",
"maxSpreadTooltip": "最大价差(绝对价格)NULL表示不启用此过滤。避免在价差过大的市场跟单",
"maxSpreadTooltip": "最大价差(绝对价格)。避免在价差过大的市场跟单。不填写则不启用此过滤",
"maxSpreadPlaceholder": "例如:0.05(5美分,可选,不填写表示不启用)",
"minOrderbookDepth": "最小订单簿深度 (USDC)",
"minOrderbookDepthTooltip": "最小订单簿深度(USDC金额),NULL表示不启用此过滤。检查前 N 档的深度",
@@ -721,10 +721,10 @@
"delaySecondsPlaceholder": "默认 0(立即跟单)",
"filterConditions": "过滤条件(可选)",
"minOrderDepth": "最小订单深度 (USDC)",
"minOrderDepthTooltip": "最小订单深度(USDC金额),NULL表示不启用此过滤",
"minOrderDepthTooltip": "检查订单簿的总订单金额(买盘+卖盘),确保市场有足够的流动性。不填写则不启用此过滤",
"minOrderDepthPlaceholder": "例如:100(可选,不填写表示不启用)",
"maxSpread": "最大价差(绝对价格)",
"maxSpreadTooltip": "最大价差(绝对价格)NULL表示不启用此过滤",
"maxSpreadTooltip": "最大价差(绝对价格)。避免在价差过大的市场跟单。不填写则不启用此过滤",
"maxSpreadPlaceholder": "例如:0.05(5美分,可选,不填写表示不启用)",
"minOrderbookDepth": "最小订单簿深度 (USDC)",
"minOrderbookDepthTooltip": "最小订单簿深度(USDC金额),NULL表示不启用此过滤",
+8 -8
View File
@@ -597,10 +597,10 @@
"priceToleranceTooltip": "允許跟單價格在 Leader 價格基礎上的調整範圍,用於在 Leader 價格 ± 容忍度範圍內調整價格,提高成交率。例如:設置為 5%,Leader 價格為 0.5,則跟單價格可在 0.475-0.525 範圍內。",
"priceTolerancePlaceholder": "默認 5%(可選)",
"minOrderDepth": "最小訂單深度 (USDC)",
"minOrderDepthTooltip": "最小訂單深度(USDC金額),NULL表示不啟用此過濾。確保市場有足夠的流動性",
"minOrderDepthTooltip": "檢查訂單簿的總訂單金額(買盤+賣盤),確保市場有足夠的流動性。不填寫則不啟用此過濾",
"minOrderDepthPlaceholder": "例如:100(可選,不填寫表示不啟用)",
"maxSpread": "最大價差(絕對價格)",
"maxSpreadTooltip": "最大價差(絕對價格)NULL表示不啟用此過濾。避免在價差過大的市場跟單",
"maxSpreadTooltip": "最大價差(絕對價格)。避免在價差過大的市場跟單。不填寫則不啟用此過濾",
"maxSpreadPlaceholder": "例如:0.05(5美分,可選,不填寫表示不啟用)",
"minOrderbookDepth": "最小訂單簿深度 (USDC)",
"minOrderbookDepthTooltip": "最小訂單簿深度(USDC金額),NULL表示不啟用此過濾。檢查前 N 檔的深度",
@@ -654,10 +654,10 @@
"priceToleranceTooltip": "允許跟單價格在 Leader 價格基礎上的調整範圍,用於在 Leader 價格 ± 容忍度範圍內調整價格,提高成交率。例如:設置為 5%,Leader 價格為 0.5,則跟單價格可在 0.475-0.525 範圍內。",
"priceTolerancePlaceholder": "默認 5%(可選)",
"minOrderDepth": "最小訂單深度 (USDC)",
"minOrderDepthTooltip": "最小訂單深度(USDC金額),NULL表示不啟用此過濾。確保市場有足夠的流動性",
"minOrderDepthTooltip": "檢查訂單簿的總訂單金額(買盤+賣盤),確保市場有足夠的流動性。不填寫則不啟用此過濾",
"minOrderDepthPlaceholder": "例如:100(可選,不填寫表示不啟用)",
"maxSpread": "最大價差(絕對價格)",
"maxSpreadTooltip": "最大價差(絕對價格)NULL表示不啟用此過濾。避免在價差過大的市場跟單",
"maxSpreadTooltip": "最大價差(絕對價格)。避免在價差過大的市場跟單。不填寫則不啟用此過濾",
"maxSpreadPlaceholder": "例如:0.05(5美分,可選,不填寫表示不啟用)",
"minOrderbookDepth": "最小訂單簿深度 (USDC)",
"minOrderbookDepthTooltip": "最小訂單簿深度(USDC金額),NULL表示不啟用此過濾。檢查前 N 檔的深度",
@@ -719,10 +719,10 @@
"delaySecondsPlaceholder": "默認 0(立即跟單)",
"filterConditions": "過濾條件(可選)",
"minOrderDepth": "最小訂單深度 (USDC)",
"minOrderDepthTooltip": "最小訂單深度(USDC金額),NULL表示不啟用此過濾。確保市場有足夠的流動性",
"minOrderDepthTooltip": "檢查訂單簿的總訂單金額(買盤+賣盤),確保市場有足夠的流動性。不填寫則不啟用此過濾",
"minOrderDepthPlaceholder": "例如:100(可選,不填寫表示不啟用)",
"maxSpread": "最大價差(絕對價格)",
"maxSpreadTooltip": "最大價差(絕對價格)NULL表示不啟用此過濾。避免在價差過大的市場跟單",
"maxSpreadTooltip": "最大價差(絕對價格)。避免在價差過大的市場跟單。不填寫則不啟用此過濾",
"maxSpreadPlaceholder": "例如:0.05(5美分,可選,不填寫表示不啟用)",
"minOrderbookDepth": "最小訂單簿深度 (USDC)",
"minOrderbookDepthTooltip": "最小訂單簿深度(USDC金額),NULL表示不啟用此過濾。檢查前 N 檔的深度",
@@ -794,10 +794,10 @@
"delaySecondsPlaceholder": "默認 0(立即跟單)",
"filterConditions": "過濾條件(可選)",
"minOrderDepth": "最小訂單深度 (USDC)",
"minOrderDepthTooltip": "最小訂單深度(USDC金額),NULL表示不啟用此過濾",
"minOrderDepthTooltip": "檢查訂單簿的總訂單金額(買盤+賣盤),確保市場有足夠的流動性。不填寫則不啟用此過濾",
"minOrderDepthPlaceholder": "例如:100(可選,不填寫表示不啟用)",
"maxSpread": "最大價差(絕對價格)",
"maxSpreadTooltip": "最大價差(絕對價格)NULL表示不啟用此過濾",
"maxSpreadTooltip": "最大價差(絕對價格)。避免在價差過大的市場跟單。不填寫則不啟用此過濾",
"maxSpreadPlaceholder": "例如:0.05(5美分,可選,不填寫表示不啟用)",
"minOrderbookDepth": "最小訂單簿深度 (USDC)",
"minOrderbookDepthTooltip": "最小訂單簿深度(USDC金額),NULL表示不啟用此過濾",