fix: converge broker failures without retry
This commit is contained in:
@@ -253,6 +253,33 @@ class TestOrderResultLogging:
|
||||
assert all(r.levelno == logging.ERROR for r in rejects)
|
||||
assert "호가단위" in rejects[0].getMessage()
|
||||
|
||||
def test_sell_reject_returns_to_holding_without_new_attempt(self):
|
||||
broker = _RecordingBroker()
|
||||
repo, _, intents, execution = _wire(broker)
|
||||
slot_id = _buy_to_pending(intents)
|
||||
assert slot_id is not None
|
||||
execution.run_once()
|
||||
holding = repo.fetch_slot(slot_id)
|
||||
assert holding is not None and holding.status is SlotState.HOLDING
|
||||
|
||||
intents.submit_sell(SellIntent(intent_id="s1", slot_id=slot_id))
|
||||
broker.submit_order = lambda req: (
|
||||
broker.orders.append(req)
|
||||
or OrderAck(accepted=False, reason="broker_rejected", venue=req.venue)
|
||||
)
|
||||
|
||||
result = execution.run_once()
|
||||
recovered = repo.fetch_slot(slot_id)
|
||||
assert recovered is not None
|
||||
assert recovered.status is SlotState.HOLDING
|
||||
assert recovered.qty == 10
|
||||
assert recovered.broker_order_id is None
|
||||
assert result.rolled_back == 1
|
||||
assert len([order for order in broker.orders if order.side == "sell"]) == 1
|
||||
|
||||
execution.run_once()
|
||||
assert len([order for order in broker.orders if order.side == "sell"]) == 1
|
||||
|
||||
def test_normal_fill_emits_no_error(self, caplog):
|
||||
broker = _RecordingBroker()
|
||||
repo, svc, intents, execution = _wire(broker)
|
||||
|
||||
Reference in New Issue
Block a user