优化跟单过滤逻辑和卖出价格计算
- 优化订单簿请求:仅在需要时请求,避免不必要的API调用 - 卖出价格改为市价卖出:优先使用订单簿bestBid,失败则使用Leader价格,固定按90%计算 - 价格容忍度默认值:如果为0,自动使用5% - 使用枚举和数据类优化checkFilters方法: - 新增FilterResult数据类和FilterStatus枚举 - 移除无用字段isBuyOrder参数 - 使用类型安全的枚举替代字符串判断 - 优化代码结构:减少if-else嵌套,使用链式调用 - 移除最小订单簿深度功能(minOrderbookDepth) - 优化最小订单深度逻辑:检查所有方向(买盘+卖盘)的总深度
This commit is contained in:
@@ -56,7 +56,6 @@ const CopyTradingEdit: React.FC = () => {
|
||||
supportSell: found.supportSell,
|
||||
minOrderDepth: found.minOrderDepth ? parseFloat(found.minOrderDepth) : undefined,
|
||||
maxSpread: found.maxSpread ? parseFloat(found.maxSpread) : undefined,
|
||||
minOrderbookDepth: found.minOrderbookDepth ? parseFloat(found.minOrderbookDepth) : undefined,
|
||||
minPrice: found.minPrice ? parseFloat(found.minPrice) : undefined,
|
||||
maxPrice: found.maxPrice ? parseFloat(found.maxPrice) : undefined,
|
||||
configName: found.configName || '',
|
||||
@@ -122,7 +121,6 @@ const CopyTradingEdit: React.FC = () => {
|
||||
supportSell: values.supportSell,
|
||||
minOrderDepth: values.minOrderDepth?.toString(),
|
||||
maxSpread: values.maxSpread?.toString(),
|
||||
minOrderbookDepth: values.minOrderbookDepth?.toString(),
|
||||
minPrice: values.minPrice?.toString(),
|
||||
maxPrice: values.maxPrice?.toString(),
|
||||
configName: values.configName?.trim() || undefined,
|
||||
@@ -381,7 +379,7 @@ const CopyTradingEdit: React.FC = () => {
|
||||
<Form.Item
|
||||
label={t('copyTradingEdit.minOrderDepth') || '最小订单深度 (USDC)'}
|
||||
name="minOrderDepth"
|
||||
tooltip={t('copyTradingEdit.minOrderDepthTooltip') || '最小订单深度(USDC金额),NULL表示不启用此过滤'}
|
||||
tooltip={t('copyTradingEdit.minOrderDepthTooltip') || '检查订单簿的总订单金额(买盘+卖盘),确保市场有足够的流动性。不填写则不启用此过滤'}
|
||||
>
|
||||
<InputNumber
|
||||
min={0}
|
||||
@@ -395,7 +393,7 @@ const CopyTradingEdit: React.FC = () => {
|
||||
<Form.Item
|
||||
label={t('copyTradingEdit.maxSpread') || '最大价差(绝对价格)'}
|
||||
name="maxSpread"
|
||||
tooltip={t('copyTradingEdit.maxSpreadTooltip') || '最大价差(绝对价格),NULL表示不启用此过滤'}
|
||||
tooltip={t('copyTradingEdit.maxSpreadTooltip') || '最大价差(绝对价格)。避免在价差过大的市场跟单。不填写则不启用此过滤'}
|
||||
>
|
||||
<InputNumber
|
||||
min={0}
|
||||
@@ -406,20 +404,6 @@ const CopyTradingEdit: React.FC = () => {
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
label={t('copyTradingEdit.minOrderbookDepth') || '最小订单簿深度 (USDC)'}
|
||||
name="minOrderbookDepth"
|
||||
tooltip={t('copyTradingEdit.minOrderbookDepthTooltip') || '最小订单簿深度(USDC金额),NULL表示不启用此过滤'}
|
||||
>
|
||||
<InputNumber
|
||||
min={0}
|
||||
step={0.0001}
|
||||
precision={4}
|
||||
style={{ width: '100%' }}
|
||||
placeholder={t('copyTradingEdit.minOrderbookDepthPlaceholder') || '例如:50(可选,不填写表示不启用)'}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Divider>{t('copyTradingEdit.priceRangeFilter') || '价格区间过滤'}</Divider>
|
||||
|
||||
<Form.Item
|
||||
|
||||
Reference in New Issue
Block a user