feat: isolate strategy-owned KIS balances
This commit is contained in:
@@ -110,3 +110,20 @@ def test_get_balance_sanitizes_token_issuance_failure(monkeypatch):
|
||||
b.get_balance()
|
||||
assert raised.value.code == "token_issuance_failed"
|
||||
assert "secret" not in str(raised.value)
|
||||
|
||||
|
||||
def test_get_available_cash_uses_cash_only_amount(monkeypatch):
|
||||
b = KISBroker("12345678-01", app_key="k", app_secret="s", base_url=_MOCK_URL)
|
||||
monkeypatch.setattr(b, "_headers", lambda _tr: {})
|
||||
monkeypatch.setattr(b, "get_current_price", lambda _symbol: None)
|
||||
|
||||
class Response:
|
||||
def raise_for_status(self): pass
|
||||
def json(self):
|
||||
return {
|
||||
"rt_cd": "0",
|
||||
"output": {"nrcvb_buy_amt": "695591", "max_buy_amt": "999999"},
|
||||
}
|
||||
|
||||
monkeypatch.setattr("trex_core.adapters.broker.kis.httpx.get", lambda *a, **kw: Response())
|
||||
assert b.get_available_cash() == 695_591
|
||||
|
||||
Reference in New Issue
Block a user