Fix Bybit linear open orders query
This commit is contained in:
28
tests/test_bybit_gateway.py
Normal file
28
tests/test_bybit_gateway.py
Normal 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"},
|
||||
]
|
||||
Reference in New Issue
Block a user