This commit is contained in:
薇薇安 2026-02-14 12:14:54 +08:00
parent d7f4f43d7f
commit 4a69b42392
2 changed files with 48 additions and 10 deletions

39
BINANCE_IP_BAN_1003.md Normal file
View File

@ -0,0 +1,39 @@
# 币安 API -1003 限频/封禁说明
## 错误含义
- **APIError(code=-1003)**: `Way too many requests; IP ... banned until 1771041059726`
- 表示当前 IP 请求过于频繁,被**临时封禁**,直到指定时间戳(毫秒)后自动解除。
## 如何查看「还要等多久」
时间戳 `1771041059726` 是**毫秒**,表示封禁**解除时间**Unix 时间戳,毫秒)。
在项目根目录执行:
```bash
python3 -c "
from datetime import datetime, timezone
ts_ms = 1771041059726 # 替换成你日志里的时间戳
utc = datetime.fromtimestamp(ts_ms/1000, tz=timezone.utc)
now = datetime.now(timezone.utc)
delta = utc - now
print('解封时间(UTC):', utc.strftime('%Y-%m-%d %H:%M:%S'))
print('当前时间(UTC):', now.strftime('%Y-%m-%d %H:%M:%S'))
if delta.total_seconds() > 0:
print('还需等待:', delta.days, '天', delta.seconds//3600, '小时', (delta.seconds%3600)//60, '分钟')
else:
print('已过解封时间,可重试;若仍报错可等几分钟或换网络。')
"
```
把上面脚本里的 `1771041059726` 换成你实际日志中的 `banned until` 后面的数字即可。
## 如何减少再次被限/封禁
1. **拉大扫描间隔**:全局配置里把 `SCAN_INTERVAL` 调大(如 900 → 1200 或 1800降低整体请求频率。
2. **缩小扫描范围**:适当减小 `MAX_SCAN_SYMBOLS`、`TOP_N_SYMBOLS`,减少单次扫描的 API 调用量。
3. **并发已做限制**`market_scanner` 已用信号量限制并发(如 3避免同时打爆若仍触限可再减小并发或增加批次间延迟。
4. **错误提示**日志里「分析超时10秒」多是因为当时已被限频/封禁导致请求挂起或失败,解封后一般会恢复。
解封后若仍偶发 -1003可先等 12 分钟再跑,或临时增大 `SCAN_INTERVAL` 再观察。

View File

@ -896,11 +896,10 @@ const GlobalConfig = () => {
// account
const isGlobalStrategyAccount = isAdmin
// render 使 useMemo
// 0.65 *100
let currentPreset = null
if (configs && Object.keys(configs).length > 0 && presets) {
try {
//
for (const [presetKey, preset] of Object.entries(presets)) {
let match = true
for (const [key, expectedValue] of Object.entries(preset.configs)) {
@ -909,20 +908,20 @@ const GlobalConfig = () => {
match = false
break
}
let currentValue = currentConfig.value
let cur = currentConfig.value
let exp = expectedValue
// 0.65 MAX_CHANGE_PERCENT_FOR_LONG 25 25%
if (key.includes('PERCENT') || key.includes('PCT')) {
if (PCT_LIKE_KEYS.has(key)) {
currentValue = currentValue <= 0.05 ? currentValue * 100 : currentValue
} else {
currentValue = currentValue * 100
if (typeof exp === 'number' && exp > 1) {
exp = exp / 100
}
}
if (typeof expectedValue === 'number' && typeof currentValue === 'number') {
if (Math.abs(currentValue - expectedValue) > 0.01) {
if (typeof exp === 'number' && typeof cur === 'number') {
if (Math.abs(cur - exp) > 0.01) {
match = false
break
}
} else if (currentValue !== expectedValue) {
} else if (cur !== exp) {
match = false
break
}