fix: remove stale_push_wlin hardcoded 0.87 fallback — imports mo_models directly, no shadow functions
This commit is contained in:
@@ -20,25 +20,9 @@ import threading
|
|||||||
import time
|
import time
|
||||||
from datetime import datetime, time
|
from datetime import datetime, time
|
||||||
|
|
||||||
# ── MoFin unified model import ──────────────────────────────────────
|
# ── MoFin unified model ──────────────────────────────────────────────
|
||||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
try:
|
from mo_models import is_hk_stock, get_hk_rate, to_cny, calc_total_assets
|
||||||
from mo_models import is_hk_stock, get_hk_rate, to_cny, calc_total_assets
|
|
||||||
_USE_MO_MODELS = True
|
|
||||||
except ImportError:
|
|
||||||
_USE_MO_MODELS = False
|
|
||||||
def is_hk_stock(code):
|
|
||||||
code = str(code or '').strip().upper()
|
|
||||||
return len(code) == 5 and code.isdigit() and code[0] in ('0', '1')
|
|
||||||
def get_hk_rate():
|
|
||||||
return 0.87
|
|
||||||
def to_cny(price, code):
|
|
||||||
if price is None: return price
|
|
||||||
if is_hk_stock(code): return round(float(price) * get_hk_rate(), 2)
|
|
||||||
return price
|
|
||||||
def calc_total_assets(pf):
|
|
||||||
total_mv = sum((h.get('shares',0) or 0) * (h.get('price',0) or 0) for h in pf.get('holdings',[]))
|
|
||||||
return round(total_mv + (pf.get('cash',0) or 0) + (pf.get('frozen_cash',0) or 0), 2)
|
|
||||||
|
|
||||||
# 市场时段检查
|
# 市场时段检查
|
||||||
_MARKET_HOURS = {
|
_MARKET_HOURS = {
|
||||||
|
|||||||
Reference in New Issue
Block a user