fix(trader): M+L 接口校验 (listing_days/NaN/输入校验/类型注数) review
M1: PaperOrder+limit+matcher 加 listing_days(创业/科创/北交所前5日不锁,0=已过) M3: is_locked_for_*_symbol cfg 注解 AccountConfig M4: matcher NaN bar 拒单 bar_missing L3: PositionLedger price/volume 正数校验 L5: PaperOrder __post_init__ volume 类型校验(拒 float/bool) M5: current_close 契约 docstring + H3 残留注释修正(transfer_fee 双向) 79 tests passed.
This commit is contained in:
@@ -50,13 +50,18 @@ def cross_order(
|
||||
symbol = order.symbol
|
||||
bar_date = str(match_bar.get("date", ""))
|
||||
|
||||
# 0. 停牌/缺 bar(NaN)拒单(review M4)
|
||||
_open = match_bar["open"]
|
||||
if _open != _open: # NaN 检测(NaN != NaN)
|
||||
return PaperReject(order.strategy_id, symbol, "bar_missing", bar_date)
|
||||
|
||||
# 1. 涨跌停封板拒单(raw)
|
||||
if order.side == OrderSide.BUY and is_locked_for_buy_symbol(
|
||||
match_bar, symbol, prev_close_raw, cfg, is_st
|
||||
match_bar, symbol, prev_close_raw, cfg, is_st, order.listing_days
|
||||
):
|
||||
return PaperReject(order.strategy_id, symbol, "limit_up_locked", bar_date)
|
||||
if order.side == OrderSide.SELL and is_locked_for_sell_symbol(
|
||||
match_bar, symbol, prev_close_raw, cfg, is_st
|
||||
match_bar, symbol, prev_close_raw, cfg, is_st, order.listing_days
|
||||
):
|
||||
return PaperReject(order.strategy_id, symbol, "limit_down_locked", bar_date)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user