移除跟单最大仓位数量(maxPositionCount)配置
- 数据库:创建迁移文件 V26 删除 max_position_count 字段 - 后端:移除实体类、DTO、服务中的 maxPositionCount 相关代码 - 后端:移除 FilterResult 中的 FAILED_MAX_POSITION_COUNT 状态 - 后端:移除 CopyTradingFilterService 中的最大仓位数量检查逻辑 - 前端:移除类型定义、表单字段和国际化翻译 - 前端:移除过滤订单列表中的 MAX_POSITION_COUNT 类型 - 前端:修复编译错误(Spin 导入、Table fixed 类型、size 类型)
This commit is contained in:
@@ -36,7 +36,6 @@ data class CopyTradingCreateRequest(
|
||||
val maxPrice: String? = null, // 最高价格(可选),NULL表示不限制最高价
|
||||
// 最大仓位配置
|
||||
val maxPositionValue: String? = null, // 最大仓位金额(USDC),NULL表示不启用
|
||||
val maxPositionCount: Int? = null, // 最大仓位数量,NULL表示不启用
|
||||
// 关键字过滤配置
|
||||
val keywordFilterMode: String? = null, // 关键字过滤模式:DISABLED(不启用)、WHITELIST(白名单)、BLACKLIST(黑名单)
|
||||
val keywords: List<String>? = null, // 关键字列表,当keywordFilterMode为DISABLED时为null
|
||||
@@ -75,7 +74,6 @@ data class CopyTradingUpdateRequest(
|
||||
val maxPrice: String? = null, // 最高价格(可选),NULL表示不限制最高价
|
||||
// 最大仓位配置
|
||||
val maxPositionValue: String? = null, // 最大仓位金额(USDC),NULL表示不启用
|
||||
val maxPositionCount: Int? = null, // 最大仓位数量,NULL表示不启用
|
||||
// 关键字过滤配置
|
||||
val keywordFilterMode: String? = null, // 关键字过滤模式:DISABLED(不启用)、WHITELIST(白名单)、BLACKLIST(黑名单)
|
||||
val keywords: List<String>? = null, // 关键字列表,当keywordFilterMode为DISABLED时为null
|
||||
@@ -151,7 +149,6 @@ data class CopyTradingDto(
|
||||
val maxPrice: String?, // 最高价格(可选),NULL表示不限制最高价
|
||||
// 最大仓位配置
|
||||
val maxPositionValue: String? = null, // 最大仓位金额(USDC),NULL表示不启用
|
||||
val maxPositionCount: Int? = null, // 最大仓位数量,NULL表示不启用
|
||||
// 关键字过滤配置
|
||||
val keywordFilterMode: String? = null, // 关键字过滤模式:DISABLED(不启用)、WHITELIST(白名单)、BLACKLIST(黑名单)
|
||||
val keywords: List<String>? = null, // 关键字列表,当keywordFilterMode为DISABLED时为null
|
||||
|
||||
@@ -83,9 +83,6 @@ data class CopyTrading(
|
||||
@Column(name = "max_position_value", precision = 20, scale = 8)
|
||||
val maxPositionValue: BigDecimal? = null, // 最大仓位金额(USDC),NULL表示不启用
|
||||
|
||||
@Column(name = "max_position_count")
|
||||
val maxPositionCount: Int? = null, // 最大仓位数量,NULL表示不启用
|
||||
|
||||
// 关键字过滤配置
|
||||
@Column(name = "keyword_filter_mode", nullable = false, length = 20)
|
||||
val keywordFilterMode: String = "DISABLED", // 关键字过滤模式:DISABLED(不启用)、WHITELIST(白名单)、BLACKLIST(黑名单)
|
||||
|
||||
+1
-34
@@ -315,7 +315,7 @@ class CopyTradingFilterService(
|
||||
outcomeIndex: Int?
|
||||
): FilterResult {
|
||||
// 如果未配置仓位限制,直接通过
|
||||
if (copyTrading.maxPositionValue == null && copyTrading.maxPositionCount == null) {
|
||||
if (copyTrading.maxPositionValue == null) {
|
||||
return FilterResult.passed()
|
||||
}
|
||||
|
||||
@@ -369,39 +369,6 @@ class CopyTradingFilterService(
|
||||
}
|
||||
}
|
||||
|
||||
// 检查最大仓位数量(如果配置了)
|
||||
if (copyTrading.maxPositionCount != null) {
|
||||
// 使用数据库中的订单记录计算活跃仓位数量(解决延迟问题)
|
||||
val dbCount = copyOrderTrackingRepository.countActivePositions(copyTrading.id!!)
|
||||
|
||||
// 计算外部持仓中的唯一市场数量(防止遗漏非本项目创建的仓位)
|
||||
val extCount = positions.currentPositions
|
||||
.filter { it.accountId == copyTrading.accountId }
|
||||
.map { it.marketId }
|
||||
.distinct()
|
||||
.size
|
||||
|
||||
val currentPositionCount = maxOf(dbCount, extCount)
|
||||
|
||||
// 检查:如果当前没有该市场该方向的活跃仓位,且总仓位数量已达到限制,则不允许开新仓
|
||||
// 判断当前市场该方向是否已有活跃仓位(数据库)
|
||||
val hasDbPosition = if (outcomeIndex != null) {
|
||||
copyOrderTrackingRepository.findUnmatchedBuyOrdersByOutcomeIndex(
|
||||
copyTrading.id, marketId, outcomeIndex
|
||||
).isNotEmpty()
|
||||
} else {
|
||||
false
|
||||
}
|
||||
val hasExtPosition = marketPositions.isNotEmpty()
|
||||
val hasCurrentMarketPosition = hasDbPosition || hasExtPosition
|
||||
|
||||
if (!hasCurrentMarketPosition && currentPositionCount >= copyTrading.maxPositionCount) {
|
||||
return FilterResult.maxPositionCountFailed(
|
||||
"超过最大仓位数量限制: 当前活跃仓位总数(取最大值)=${currentPositionCount} (DB=${dbCount}, Ext=${extCount}) >= 最大限制=${copyTrading.maxPositionCount}"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return FilterResult.passed()
|
||||
} catch (e: Exception) {
|
||||
logger.error("仓位检查异常: accountId=${copyTrading.accountId}, marketId=$marketId, outcomeIndex=$outcomeIndex, error=${e.message}", e)
|
||||
|
||||
-15
@@ -100,7 +100,6 @@ class CopyTradingService(
|
||||
minPrice = request.minPrice?.toSafeBigDecimal() ?: template.minPrice,
|
||||
maxPrice = request.maxPrice?.toSafeBigDecimal() ?: template.maxPrice,
|
||||
maxPositionValue = request.maxPositionValue?.toSafeBigDecimal(),
|
||||
maxPositionCount = request.maxPositionCount,
|
||||
keywordFilterMode = request.keywordFilterMode ?: "DISABLED",
|
||||
keywords = convertKeywordsToJson(request.keywords),
|
||||
maxMarketEndDate = request.maxMarketEndDate,
|
||||
@@ -132,7 +131,6 @@ class CopyTradingService(
|
||||
minPrice = request.minPrice?.toSafeBigDecimal(),
|
||||
maxPrice = request.maxPrice?.toSafeBigDecimal(),
|
||||
maxPositionValue = request.maxPositionValue?.toSafeBigDecimal(),
|
||||
maxPositionCount = request.maxPositionCount,
|
||||
keywordFilterMode = request.keywordFilterMode ?: "DISABLED",
|
||||
keywords = convertKeywordsToJson(request.keywords),
|
||||
maxMarketEndDate = request.maxMarketEndDate,
|
||||
@@ -164,7 +162,6 @@ class CopyTradingService(
|
||||
minPrice = config.minPrice,
|
||||
maxPrice = config.maxPrice,
|
||||
maxPositionValue = config.maxPositionValue,
|
||||
maxPositionCount = config.maxPositionCount,
|
||||
keywordFilterMode = config.keywordFilterMode,
|
||||
keywords = config.keywords,
|
||||
configName = configName,
|
||||
@@ -282,16 +279,6 @@ class CopyTradingService(
|
||||
} else {
|
||||
copyTrading.maxPositionValue
|
||||
},
|
||||
// 处理 maxPositionCount:-1 表示要清空(设置为 null),null 表示不更新
|
||||
maxPositionCount = if (request.maxPositionCount != null) {
|
||||
if (request.maxPositionCount == -1) {
|
||||
null
|
||||
} else {
|
||||
request.maxPositionCount
|
||||
}
|
||||
} else {
|
||||
copyTrading.maxPositionCount
|
||||
},
|
||||
keywordFilterMode = request.keywordFilterMode ?: copyTrading.keywordFilterMode,
|
||||
keywords = if (request.keywords != null) {
|
||||
convertKeywordsToJson(request.keywords)
|
||||
@@ -520,7 +507,6 @@ class CopyTradingService(
|
||||
minPrice = copyTrading.minPrice?.toPlainString(),
|
||||
maxPrice = copyTrading.maxPrice?.toPlainString(),
|
||||
maxPositionValue = copyTrading.maxPositionValue?.toPlainString(),
|
||||
maxPositionCount = copyTrading.maxPositionCount,
|
||||
keywordFilterMode = copyTrading.keywordFilterMode,
|
||||
keywords = convertJsonToKeywords(copyTrading.keywords),
|
||||
configName = copyTrading.configName,
|
||||
@@ -585,7 +571,6 @@ class CopyTradingService(
|
||||
val minPrice: BigDecimal?,
|
||||
val maxPrice: BigDecimal?,
|
||||
val maxPositionValue: BigDecimal?,
|
||||
val maxPositionCount: Int?,
|
||||
val keywordFilterMode: String,
|
||||
val keywords: String?, // JSON 字符串
|
||||
val maxMarketEndDate: Long?, // 市场截止时间限制(毫秒时间戳)
|
||||
|
||||
-8
@@ -20,8 +20,6 @@ enum class FilterStatus {
|
||||
FAILED_ORDER_DEPTH,
|
||||
/** 失败:超过最大仓位金额 */
|
||||
FAILED_MAX_POSITION_VALUE,
|
||||
/** 失败:超过最大仓位数量 */
|
||||
FAILED_MAX_POSITION_COUNT,
|
||||
/** 失败:关键字过滤 */
|
||||
FAILED_KEYWORD_FILTER,
|
||||
/** 失败:市场截止时间超出限制 */
|
||||
@@ -87,12 +85,6 @@ data class FilterResult(
|
||||
status = FilterStatus.FAILED_MAX_POSITION_VALUE,
|
||||
reason = reason
|
||||
)
|
||||
|
||||
/** 超过最大仓位数量 */
|
||||
fun maxPositionCountFailed(reason: String) = FilterResult(
|
||||
status = FilterStatus.FAILED_MAX_POSITION_COUNT,
|
||||
reason = reason
|
||||
)
|
||||
|
||||
/** 关键字过滤失败 */
|
||||
fun keywordFilterFailed(reason: String) = FilterResult(
|
||||
|
||||
-1
@@ -1430,7 +1430,6 @@ open class CopyOrderTrackingService(
|
||||
FilterStatus.FAILED_SPREAD -> "SPREAD"
|
||||
FilterStatus.FAILED_ORDER_DEPTH -> "ORDER_DEPTH"
|
||||
FilterStatus.FAILED_MAX_POSITION_VALUE -> "MAX_POSITION_VALUE"
|
||||
FilterStatus.FAILED_MAX_POSITION_COUNT -> "MAX_POSITION_COUNT"
|
||||
FilterStatus.FAILED_KEYWORD_FILTER -> "KEYWORD_FILTER"
|
||||
FilterStatus.FAILED_MARKET_END_DATE -> "MARKET_END_DATE"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
-- ============================================
|
||||
-- V26: 移除最大仓位数量配置字段
|
||||
-- 从 copy_trading 表中删除 max_position_count 字段
|
||||
-- ============================================
|
||||
|
||||
ALTER TABLE copy_trading
|
||||
DROP COLUMN max_position_count;
|
||||
|
||||
@@ -718,9 +718,6 @@
|
||||
"maxPositionValue": "Max Position Value (USDC)",
|
||||
"maxPositionValueTooltip": "Limit the maximum position value for a single market. If the current position value + copy order amount exceeds this limit, the order will not be placed. Leave empty to disable",
|
||||
"maxPositionValuePlaceholder": "For example: 100 (optional, leave empty to disable)",
|
||||
"maxPositionCount": "Max Position Count",
|
||||
"maxPositionCountTooltip": "Limit the maximum position count for a single market. If the current position count reaches or exceeds this limit, the order will not be placed. Leave empty to disable",
|
||||
"maxPositionCountPlaceholder": "For example: 10 (optional, leave empty to disable)",
|
||||
"supportSell": "Support Sell",
|
||||
"supportSellTooltip": "Whether to copy Leader's sell orders. Enabled: copy both Leader's buy and sell orders; Disabled: only copy Leader's buy orders, ignore sell orders.",
|
||||
"pushFilteredOrders": "Push Filtered Orders",
|
||||
@@ -792,9 +789,6 @@
|
||||
"maxPositionValue": "Max Position Value (USDC)",
|
||||
"maxPositionValueTooltip": "Limit the maximum position value for a single market. If the current position value + copy order amount exceeds this limit, the order will not be placed. Leave empty to disable",
|
||||
"maxPositionValuePlaceholder": "For example: 100 (optional, leave empty to disable)",
|
||||
"maxPositionCount": "Max Position Count",
|
||||
"maxPositionCountTooltip": "Limit the maximum position count for a single market. If the current position count reaches or exceeds this limit, the order will not be placed. Leave empty to disable",
|
||||
"maxPositionCountPlaceholder": "For example: 10 (optional, leave empty to disable)",
|
||||
"keywordFilter": "Keyword Filter",
|
||||
"keywordFilterMode": "Filter Mode",
|
||||
"keywordFilterModeTooltip": "Select keyword filter mode. Whitelist: only copy markets containing keywords; Blacklist: do not copy markets containing keywords; Disabled: no keyword filtering. Keyword matching is case-insensitive.",
|
||||
@@ -905,9 +899,6 @@
|
||||
"maxPositionValue": "Max Position Value (USDC)",
|
||||
"maxPositionValueTooltip": "Limit the maximum position value for a single market. If the current position value + copy order amount exceeds this limit, the order will not be placed. Leave empty to disable",
|
||||
"maxPositionValuePlaceholder": "For example: 100 (optional, leave empty to disable)",
|
||||
"maxPositionCount": "Max Position Count",
|
||||
"maxPositionCountTooltip": "Limit the maximum position count for a single market. If the current position count reaches or exceeds this limit, the order will not be placed. Leave empty to disable",
|
||||
"maxPositionCountPlaceholder": "For example: 10 (optional, leave empty to disable)",
|
||||
"keywordFilter": "Keyword Filter",
|
||||
"keywordFilterMode": "Filter Mode",
|
||||
"keywordFilterModeTooltip": "Select keyword filter mode. Whitelist: only copy markets containing keywords; Blacklist: do not copy markets containing keywords; Disabled: no keyword filtering. Keyword matching is case-insensitive.",
|
||||
@@ -972,7 +963,6 @@
|
||||
"orderbookEmpty": "Orderbook Empty",
|
||||
"priceRange": "Price Range Mismatch",
|
||||
"maxPositionValue": "Exceeds Max Position Value",
|
||||
"maxPositionCount": "Exceeds Max Position Count",
|
||||
"marketEndDate": "Market End Date Exceeds Limit",
|
||||
"unknown": "Unknown Reason"
|
||||
},
|
||||
|
||||
@@ -718,9 +718,6 @@
|
||||
"maxPositionValue": "最大仓位金额 (USDC)",
|
||||
"maxPositionValueTooltip": "限制单个市场的最大仓位金额。如果该市场的当前仓位金额 + 跟单金额超过此限制,则不会下单。不填写则不启用此限制",
|
||||
"maxPositionValuePlaceholder": "例如:100(可选,不填写表示不启用)",
|
||||
"maxPositionCount": "最大仓位数量",
|
||||
"maxPositionCountTooltip": "限制单个市场的最大仓位数量。如果该市场的当前仓位数量达到或超过此限制,则不会下单。不填写则不启用此限制",
|
||||
"maxPositionCountPlaceholder": "例如:10(可选,不填写表示不启用)",
|
||||
"supportSell": "跟单卖出",
|
||||
"supportSellTooltip": "是否跟单 Leader 的卖出订单。开启:跟单 Leader 的买入和卖出订单;关闭:只跟单 Leader 的买入订单,忽略卖出订单。",
|
||||
"pushFilteredOrders": "推送已过滤订单",
|
||||
@@ -806,9 +803,6 @@
|
||||
"maxPositionValue": "最大仓位金额 (USDC)",
|
||||
"maxPositionValueTooltip": "限制单个市场的最大仓位金额。如果该市场的当前仓位金额 + 跟单金额超过此限制,则不会下单。不填写则不启用此限制",
|
||||
"maxPositionValuePlaceholder": "例如:100(可选,不填写表示不启用)",
|
||||
"maxPositionCount": "最大仓位数量",
|
||||
"maxPositionCountTooltip": "限制单个市场的最大仓位数量。如果该市场的当前仓位数量达到或超过此限制,则不会下单。不填写则不启用此限制",
|
||||
"maxPositionCountPlaceholder": "例如:10(可选,不填写表示不启用)",
|
||||
"keywordFilter": "关键字过滤",
|
||||
"keywordFilterMode": "过滤模式",
|
||||
"keywordFilterModeTooltip": "选择关键字过滤模式。白名单:只跟单包含关键字的市场;黑名单:不跟单包含关键字的市场;不启用:不进行关键字过滤。关键字匹配不区分大小写。",
|
||||
@@ -919,9 +913,6 @@
|
||||
"maxPositionValue": "最大仓位金额 (USDC)",
|
||||
"maxPositionValueTooltip": "限制单个市场的最大仓位金额。如果该市场的当前仓位金额 + 跟单金额超过此限制,则不会下单。不填写则不启用此限制",
|
||||
"maxPositionValuePlaceholder": "例如:100(可选,不填写表示不启用)",
|
||||
"maxPositionCount": "最大仓位数量",
|
||||
"maxPositionCountTooltip": "限制单个市场的最大仓位数量。如果该市场的当前仓位数量达到或超过此限制,则不会下单。不填写则不启用此限制",
|
||||
"maxPositionCountPlaceholder": "例如:10(可选,不填写表示不启用)",
|
||||
"keywordFilter": "关键字过滤",
|
||||
"keywordFilterMode": "过滤模式",
|
||||
"keywordFilterModeTooltip": "选择关键字过滤模式。白名单:只跟单包含关键字的市场;黑名单:不跟单包含关键字的市场;不启用:不进行关键字过滤。关键字匹配不区分大小写。",
|
||||
@@ -972,7 +963,6 @@
|
||||
"orderbookEmpty": "订单簿为空",
|
||||
"priceRange": "价格区间不符",
|
||||
"maxPositionValue": "超过最大仓位金额",
|
||||
"maxPositionCount": "超过最大仓位数量",
|
||||
"marketEndDate": "市场截止时间超出限制",
|
||||
"unknown": "未知原因"
|
||||
},
|
||||
|
||||
@@ -718,9 +718,6 @@
|
||||
"maxPositionValue": "最大倉位金額 (USDC)",
|
||||
"maxPositionValueTooltip": "限制單個市場的最大倉位金額。如果該市場的當前倉位金額 + 跟單金額超過此限制,則不會下單。不填寫則不啟用此限制",
|
||||
"maxPositionValuePlaceholder": "例如:100(可選,不填寫表示不啟用)",
|
||||
"maxPositionCount": "最大倉位數量",
|
||||
"maxPositionCountTooltip": "限制單個市場的最大倉位數量。如果該市場的當前倉位數量達到或超過此限制,則不會下單。不填寫則不啟用此限制",
|
||||
"maxPositionCountPlaceholder": "例如:10(可選,不填寫表示不啟用)",
|
||||
"supportSell": "跟單賣出",
|
||||
"supportSellTooltip": "是否跟單 Leader 的賣出訂單。開啟:跟單 Leader 的買入和賣出訂單;關閉:只跟單 Leader 的買入訂單,忽略賣出訂單。",
|
||||
"pushFilteredOrders": "推送已過濾訂單",
|
||||
@@ -792,9 +789,6 @@
|
||||
"maxPositionValue": "最大倉位金額 (USDC)",
|
||||
"maxPositionValueTooltip": "限制單個市場的最大倉位金額。如果該市場的當前倉位金額 + 跟單金額超過此限制,則不會下單。不填寫則不啟用此限制",
|
||||
"maxPositionValuePlaceholder": "例如:100(可選,不填寫表示不啟用)",
|
||||
"maxPositionCount": "最大倉位數量",
|
||||
"maxPositionCountTooltip": "限制單個市場的最大倉位數量。如果該市場的當前倉位數量達到或超過此限制,則不會下單。不填寫則不啟用此限制",
|
||||
"maxPositionCountPlaceholder": "例如:10(可選,不填寫表示不啟用)",
|
||||
"keywordFilter": "關鍵字過濾",
|
||||
"keywordFilterMode": "過濾模式",
|
||||
"keywordFilterModeTooltip": "選擇關鍵字過濾模式。白名單:只跟單包含關鍵字的市場;黑名單:不跟單包含關鍵字的市場;不啟用:不進行關鍵字過濾。關鍵字匹配不區分大小寫。",
|
||||
@@ -905,9 +899,6 @@
|
||||
"maxPositionValue": "最大倉位金額 (USDC)",
|
||||
"maxPositionValueTooltip": "限制單個市場的最大倉位金額。如果該市場的當前倉位金額 + 跟單金額超過此限制,則不會下單。不填寫則不啟用此限制",
|
||||
"maxPositionValuePlaceholder": "例如:100(可選,不填寫表示不啟用)",
|
||||
"maxPositionCount": "最大倉位數量",
|
||||
"maxPositionCountTooltip": "限制單個市場的最大倉位數量。如果該市場的當前倉位數量達到或超過此限制,則不會下單。不填寫則不啟用此限制",
|
||||
"maxPositionCountPlaceholder": "例如:10(可選,不填寫表示不啟用)",
|
||||
"keywordFilter": "關鍵字過濾",
|
||||
"keywordFilterMode": "過濾模式",
|
||||
"keywordFilterModeTooltip": "選擇關鍵字過濾模式。白名單:只跟單包含關鍵字的市場;黑名單:不跟單包含關鍵字的市場;不啟用:不進行關鍵字過濾。關鍵字匹配不區分大小寫。",
|
||||
@@ -972,7 +963,6 @@
|
||||
"orderbookEmpty": "訂單簿為空",
|
||||
"priceRange": "價格區間不符",
|
||||
"maxPositionValue": "超過最大倉位金額",
|
||||
"maxPositionCount": "超過最大倉位數量",
|
||||
"marketEndDate": "市場截止時間超出限制",
|
||||
"unknown": "未知原因"
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useState, useRef } from 'react'
|
||||
import { Modal, Form, Button, Switch, message, Space, Radio, InputNumber, Table, Select, Divider, Input, Tag, InputRef, Card, Row, Col, Statistic } from 'antd'
|
||||
import { Modal, Form, Button, Switch, message, Space, Radio, InputNumber, Table, Select, Divider, Input, Tag, InputRef, Card, Row, Col, Statistic, Spin } from 'antd'
|
||||
import { SaveOutlined, FileTextOutlined, PlusOutlined } from '@ant-design/icons'
|
||||
import { apiService } from '../../services/api'
|
||||
import { useAccountStore } from '../../store/accountStore'
|
||||
@@ -122,7 +122,6 @@ const AddModal: React.FC<AddModalProps> = ({
|
||||
minPrice: template.minPrice ? parseFloat(template.minPrice) : undefined,
|
||||
maxPrice: template.maxPrice ? parseFloat(template.maxPrice) : undefined,
|
||||
maxPositionValue: (template as any).maxPositionValue ? parseFloat((template as any).maxPositionValue) : undefined,
|
||||
maxPositionCount: (template as any).maxPositionCount,
|
||||
pushFilteredOrders: template.pushFilteredOrders ?? false
|
||||
})
|
||||
setCopyMode(template.copyMode)
|
||||
@@ -277,7 +276,6 @@ const AddModal: React.FC<AddModalProps> = ({
|
||||
minPrice: values.minPrice?.toString(),
|
||||
maxPrice: values.maxPrice?.toString(),
|
||||
maxPositionValue: values.maxPositionValue?.toString(),
|
||||
maxPositionCount: values.maxPositionCount,
|
||||
keywordFilterMode: values.keywordFilterMode || 'DISABLED',
|
||||
keywords: (values.keywordFilterMode === 'WHITELIST' || values.keywordFilterMode === 'BLACKLIST')
|
||||
? keywords
|
||||
@@ -800,19 +798,6 @@ const AddModal: React.FC<AddModalProps> = ({
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
label={t('copyTradingAdd.maxPositionCount') || '最大仓位数量'}
|
||||
name="maxPositionCount"
|
||||
tooltip={t('copyTradingAdd.maxPositionCountTooltip') || '限制单个市场的最大仓位数量。如果该市场的当前仓位数量达到或超过此限制,则不会下单。不填写则不启用此限制'}
|
||||
>
|
||||
<InputNumber
|
||||
min={1}
|
||||
step={1}
|
||||
style={{ width: '100%' }}
|
||||
placeholder={t('copyTradingAdd.maxPositionCountPlaceholder') || '例如:10(可选,不填写表示不启用)'}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Divider>{t('copyTradingAdd.keywordFilter') || '关键字过滤'}</Divider>
|
||||
|
||||
<Form.Item
|
||||
|
||||
@@ -91,7 +91,6 @@ const EditModal: React.FC<EditModalProps> = ({
|
||||
minPrice: found.minPrice ? parseFloat(found.minPrice) : undefined,
|
||||
maxPrice: found.maxPrice ? parseFloat(found.maxPrice) : undefined,
|
||||
maxPositionValue: found.maxPositionValue ? parseFloat(found.maxPositionValue) : undefined,
|
||||
maxPositionCount: found.maxPositionCount,
|
||||
keywordFilterMode: found.keywordFilterMode || 'DISABLED',
|
||||
configName: found.configName || '',
|
||||
pushFailedOrders: found.pushFailedOrders ?? false,
|
||||
@@ -237,8 +236,6 @@ const EditModal: React.FC<EditModalProps> = ({
|
||||
minPrice: values.minPrice != null ? values.minPrice.toString() : '',
|
||||
maxPrice: values.maxPrice != null ? values.maxPrice.toString() : '',
|
||||
maxPositionValue: values.maxPositionValue != null ? values.maxPositionValue.toString() : '',
|
||||
// 对于 maxPositionCount,如果值为 null/undefined,传 -1 表示要清空(后端会识别并设置为 null)
|
||||
maxPositionCount: values.maxPositionCount != null ? values.maxPositionCount : -1,
|
||||
keywordFilterMode: values.keywordFilterMode || 'DISABLED',
|
||||
keywords: (values.keywordFilterMode === 'WHITELIST' || values.keywordFilterMode === 'BLACKLIST')
|
||||
? keywords
|
||||
@@ -722,19 +719,6 @@ const EditModal: React.FC<EditModalProps> = ({
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
label={t('copyTradingEdit.maxPositionCount') || '最大仓位数量'}
|
||||
name="maxPositionCount"
|
||||
tooltip={t('copyTradingEdit.maxPositionCountTooltip') || '限制单个市场的最大仓位数量。如果该市场的当前仓位数量达到或超过此限制,则不会下单。不填写则不启用此限制'}
|
||||
>
|
||||
<InputNumber
|
||||
min={1}
|
||||
step={1}
|
||||
style={{ width: '100%' }}
|
||||
placeholder={t('copyTradingEdit.maxPositionCountPlaceholder') || '例如:10(可选,不填写表示不启用)'}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
{/* 关键字过滤 */}
|
||||
<Divider>{t('copyTradingEdit.keywordFilter') || t('copyTradingAdd.keywordFilter') || '关键字过滤'}</Divider>
|
||||
|
||||
|
||||
@@ -69,7 +69,6 @@ const FilteredOrdersModal: React.FC<FilteredOrdersModalProps> = ({
|
||||
ORDERBOOK_EMPTY: { color: 'default', text: t('filteredOrdersList.filterTypes.orderbookEmpty') || '订单簿为空' },
|
||||
PRICE_RANGE: { color: 'purple', text: t('filteredOrdersList.filterTypes.priceRange') || '价格区间不符' },
|
||||
MAX_POSITION_VALUE: { color: 'volcano', text: t('filteredOrdersList.filterTypes.maxPositionValue') || '超过最大仓位金额' },
|
||||
MAX_POSITION_COUNT: { color: 'volcano', text: t('filteredOrdersList.filterTypes.maxPositionCount') || '超过最大仓位数量' },
|
||||
MARKET_END_DATE: { color: 'cyan', text: t('filteredOrdersList.filterTypes.marketEndDate') || '市场截止时间超出限制' },
|
||||
KEYWORD_FILTER: { color: 'geekblue', text: t('filteredOrdersList.filterTypes.keywordFilter') || '关键字过滤' }
|
||||
}
|
||||
|
||||
@@ -66,7 +66,6 @@ const FilteredOrdersList: React.FC = () => {
|
||||
'ORDERBOOK_EMPTY': { color: 'default', label: t('filteredOrdersList.filterTypes.orderbookEmpty') || '订单簿为空' },
|
||||
'PRICE_RANGE': { color: 'purple', label: t('filteredOrdersList.filterTypes.priceRange') || '价格区间不符' },
|
||||
'MAX_POSITION_VALUE': { color: 'volcano', label: t('filteredOrdersList.filterTypes.maxPositionValue') || '超过最大仓位金额' },
|
||||
'MAX_POSITION_COUNT': { color: 'volcano', label: t('filteredOrdersList.filterTypes.maxPositionCount') || '超过最大仓位数量' },
|
||||
'MARKET_END_DATE': { color: 'cyan', label: t('filteredOrdersList.filterTypes.marketEndDate') || '市场截止时间超出限制' },
|
||||
'KEYWORD_FILTER': { color: 'geekblue', label: t('filteredOrdersList.filterTypes.keywordFilter') || '关键字过滤' },
|
||||
'UNKNOWN': { color: 'default', label: t('filteredOrdersList.filterTypes.unknown') || '未知原因' }
|
||||
|
||||
@@ -266,7 +266,7 @@ const LeaderList: React.FC = () => {
|
||||
title: t('common.actions'),
|
||||
key: 'action',
|
||||
width: isMobile ? 180 : 250,
|
||||
fixed: 'right',
|
||||
fixed: 'right' as const,
|
||||
render: (_: any, record: Leader) => (
|
||||
<Space size="small" wrap>
|
||||
<Button type="link" size="small" icon={<EyeOutlined />} onClick={() => handleShowDetail(record)}>
|
||||
@@ -530,7 +530,7 @@ const LeaderList: React.FC = () => {
|
||||
rowKey={(record, index) => `${record.title}-${record.side}-${index}`}
|
||||
pagination={{ pageSize: 10, showSizeChanger: !isMobile }}
|
||||
scroll={{ x: isMobile ? 800 : 'auto' }}
|
||||
size={isMobile ? 'small' : 'default'}
|
||||
size={isMobile ? 'small' : 'middle'}
|
||||
/>
|
||||
) : (
|
||||
<Empty description={t('leaderDetail.noPositions')} />
|
||||
|
||||
@@ -257,7 +257,6 @@ export interface CopyTrading {
|
||||
maxPrice?: string // 最高价格(可选),NULL表示不限制最高价
|
||||
// 最大仓位配置
|
||||
maxPositionValue?: string // 最大仓位金额(USDC),NULL表示不启用
|
||||
maxPositionCount?: number // 最大仓位数量,NULL表示不启用
|
||||
// 关键字过滤配置
|
||||
keywordFilterMode?: 'DISABLED' | 'WHITELIST' | 'BLACKLIST' // 关键字过滤模式
|
||||
keywords?: string[] // 关键字列表,当keywordFilterMode为DISABLED时为null
|
||||
@@ -307,7 +306,6 @@ export interface CopyTradingCreateRequest {
|
||||
maxPrice?: string // 最高价格(可选),NULL表示不限制最高价
|
||||
// 最大仓位配置
|
||||
maxPositionValue?: string // 最大仓位金额(USDC),NULL表示不启用
|
||||
maxPositionCount?: number // 最大仓位数量,NULL表示不启用
|
||||
// 关键字过滤配置
|
||||
keywordFilterMode?: 'DISABLED' | 'WHITELIST' | 'BLACKLIST' // 关键字过滤模式
|
||||
keywords?: string[] // 关键字列表,当keywordFilterMode为DISABLED时为null
|
||||
@@ -346,7 +344,6 @@ export interface CopyTradingUpdateRequest {
|
||||
maxPrice?: string // 最高价格(可选),NULL表示不限制最高价
|
||||
// 最大仓位配置
|
||||
maxPositionValue?: string // 最大仓位金额(USDC),NULL表示不启用
|
||||
maxPositionCount?: number // 最大仓位数量,NULL表示不启用
|
||||
// 关键字过滤配置
|
||||
keywordFilterMode?: 'DISABLED' | 'WHITELIST' | 'BLACKLIST' // 关键字过滤模式
|
||||
keywords?: string[] // 关键字列表,当keywordFilterMode为DISABLED时为null
|
||||
|
||||
Reference in New Issue
Block a user