mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-12 23:36:55 +08:00
Enforce minimum scan interval of three minutes
This commit is contained in:
@@ -343,8 +343,8 @@ func (s *Server) handleCreateTrader(c *gin.Context) {
|
|||||||
|
|
||||||
// 设置扫描间隔默认值
|
// 设置扫描间隔默认值
|
||||||
scanIntervalMinutes := req.ScanIntervalMinutes
|
scanIntervalMinutes := req.ScanIntervalMinutes
|
||||||
if scanIntervalMinutes <= 0 {
|
if scanIntervalMinutes < 3 {
|
||||||
scanIntervalMinutes = 3 // 默认3分钟
|
scanIntervalMinutes = 3 // 默认3分钟,且不允许小于3
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建交易员配置(数据库实体)
|
// 创建交易员配置(数据库实体)
|
||||||
@@ -458,6 +458,8 @@ func (s *Server) handleUpdateTrader(c *gin.Context) {
|
|||||||
scanIntervalMinutes := req.ScanIntervalMinutes
|
scanIntervalMinutes := req.ScanIntervalMinutes
|
||||||
if scanIntervalMinutes <= 0 {
|
if scanIntervalMinutes <= 0 {
|
||||||
scanIntervalMinutes = existingTrader.ScanIntervalMinutes // 保持原值
|
scanIntervalMinutes = existingTrader.ScanIntervalMinutes // 保持原值
|
||||||
|
} else if scanIntervalMinutes < 3 {
|
||||||
|
scanIntervalMinutes = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新交易员配置
|
// 更新交易员配置
|
||||||
@@ -1733,4 +1735,3 @@ func (s *Server) handleGetPublicTraderConfig(c *gin.Context) {
|
|||||||
|
|
||||||
c.JSON(http.StatusOK, result)
|
c.JSON(http.StatusOK, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
1
web/package-lock.json
generated
1
web/package-lock.json
generated
@@ -7177,7 +7177,6 @@
|
|||||||
"integrity": "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==",
|
"integrity": "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"yaml": "bin.mjs"
|
"yaml": "bin.mjs"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -374,14 +374,15 @@ export function TraderConfigModal({
|
|||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
value={formData.scan_interval_minutes}
|
value={formData.scan_interval_minutes}
|
||||||
onChange={(e) =>
|
onChange={(e) => {
|
||||||
handleInputChange(
|
const parsedValue = Number(e.target.value)
|
||||||
'scan_interval_minutes',
|
const safeValue = Number.isFinite(parsedValue)
|
||||||
Number(e.target.value)
|
? Math.max(3, parsedValue)
|
||||||
)
|
: 3
|
||||||
}
|
handleInputChange('scan_interval_minutes', safeValue)
|
||||||
|
}}
|
||||||
className="w-full px-3 py-2 bg-[#0B0E11] border border-[#2B3139] rounded text-[#EAECEF] focus:border-[#F0B90B] focus:outline-none"
|
className="w-full px-3 py-2 bg-[#0B0E11] border border-[#2B3139] rounded text-[#EAECEF] focus:border-[#F0B90B] focus:outline-none"
|
||||||
min="1"
|
min="3"
|
||||||
max="60"
|
max="60"
|
||||||
step="1"
|
step="1"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user