normalize_scan_terminal_filters 透传 trading_region 参数以支持区域过滤
This commit is contained in:
@@ -34,7 +34,7 @@ def normalize_scan_terminal_filters(
|
||||
if high_liquidity_only:
|
||||
min_liquidity = max(min_liquidity, 5000.0)
|
||||
|
||||
return {
|
||||
result: Dict[str, Any] = {
|
||||
"scan_mode": str(raw.get("scan_mode") or "tradable").strip().lower()
|
||||
or "tradable",
|
||||
"min_price": float(min_price),
|
||||
@@ -49,6 +49,10 @@ def normalize_scan_terminal_filters(
|
||||
"limit": max(1, min(safe_int(raw.get("limit"), 25), 100)),
|
||||
"max_spread": max(0.0, _safe_float(raw.get("max_spread")) or 0.03),
|
||||
}
|
||||
trading_region = str(raw.get("trading_region") or "").strip().lower()
|
||||
if trading_region and trading_region not in ("all", ""):
|
||||
result["trading_region"] = trading_region
|
||||
return result
|
||||
|
||||
|
||||
def market_region_from_tz_offset(tz_offset_seconds: Any) -> Dict[str, object]:
|
||||
@@ -61,12 +65,12 @@ def market_region_from_tz_offset(tz_offset_seconds: Any) -> Dict[str, object]:
|
||||
return {"key": "east_asia", "label_en": "East Asia", "label_zh": "东亚", "sort_order": 1}
|
||||
if tz_hours >= 7:
|
||||
return {"key": "southeast_asia", "label_en": "Southeast Asia", "label_zh": "东南亚", "sort_order": 2}
|
||||
if tz_hours >= 5:
|
||||
if tz_hours >= 4.5:
|
||||
return {"key": "central_asia", "label_en": "Central / South Asia", "label_zh": "中亚 / 南亚", "sort_order": 3}
|
||||
if tz_hours >= 3:
|
||||
return {"key": "west_asia", "label_en": "West Asia", "label_zh": "西亚", "sort_order": 4}
|
||||
if tz_hours >= 0:
|
||||
if tz_hours >= 2:
|
||||
return {"key": "west_asia", "label_en": "West Asia / Middle East", "label_zh": "西亚 / 中东", "sort_order": 4}
|
||||
if tz_hours >= -2:
|
||||
return {"key": "europe_africa", "label_en": "Europe / Africa", "label_zh": "欧洲 / 非洲", "sort_order": 5}
|
||||
if tz_hours >= -5:
|
||||
return {"key": "south_america", "label_en": "South America", "label_zh": "南美洲", "sort_order": 6}
|
||||
return {"key": "north_america", "label_en": "North America", "label_zh": "北美洲", "sort_order": 7}
|
||||
if tz_hours >= -4:
|
||||
return {"key": "south_america", "label_en": "Latin America", "label_zh": "拉美", "sort_order": 6}
|
||||
return {"key": "north_america", "label_en": "North America", "label_zh": "北美", "sort_order": 7}
|
||||
|
||||
Reference in New Issue
Block a user