Fix Bybit linear open orders query

This commit is contained in:
Azimkin
2026-09-22 11:57:04 +02:00
parent 599dbb0455
commit 0a06834ed5
2 changed files with 32 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
from __future__ import annotations
from typing import Any
from llm_trade_bot.bybit_gateway import BybitGateway
from llm_trade_bot.config import BybitConfig, ScannerConfig
class FakeBybitHTTP:
def __init__(self) -> None:
self.open_order_requests: list[dict[str, Any]] = []
def get_open_orders(self, **parameters: Any) -> dict[str, Any]:
self.open_order_requests.append(parameters)
return {"retCode": 0, "result": {"list": []}}
async def test_open_orders_scopes_linear_requests_by_settle_coin() -> None:
gateway = BybitGateway(BybitConfig("key", "secret", "USDC"), ScannerConfig())
http = FakeBybitHTTP()
gateway._http = http # type: ignore[assignment]
await gateway.open_orders()
assert http.open_order_requests == [
{"category": "spot", "limit": 50},
{"category": "linear", "limit": 50, "settleCoin": "USDC"},
]