diff --git a/tests/clients/test_stream_client.py b/tests/clients/test_stream_client.py index f16ae8f..f7ee178 100644 --- a/tests/clients/test_stream_client.py +++ b/tests/clients/test_stream_client.py @@ -35,6 +35,7 @@ async def test_orderbook_stream(create_orderbook_message): "type": "SNAPSHOT", "data": { "m": message_model.data.market, + "t": None, "b": [{"q": "0.008", "p": "43547.00"}, {"q": "0.007000", "p": "43548.00"}], "a": [{"q": "0.008", "p": "43546.00"}], }, diff --git a/x10/clients/rest/rest_api_client.py b/x10/clients/rest/rest_api_client.py index ce66297..e4b42e4 100644 --- a/x10/clients/rest/rest_api_client.py +++ b/x10/clients/rest/rest_api_client.py @@ -18,6 +18,7 @@ PlacedOrderModel, SelfTradeProtectionLevel, TimeInForce, + OrderType ) from x10.signing.order_object import OrderTpslTriggerParam, create_order_object from x10.utils.date import utc_now @@ -51,6 +52,7 @@ async def place_order( price: Decimal, side: OrderSide, taker_fee: Decimal, + order_type: OrderType = OrderType.LIMIT, post_only: bool = False, previous_order_id=None, expire_time: Optional[datetime] = None, @@ -85,6 +87,7 @@ async def place_order( amount_of_synthetic=amount_of_synthetic, price=price, side=side, + order_type=order_type, post_only=post_only, previous_order_external_id=previous_order_id, expire_time=expire_time, diff --git a/x10/clients/stream/stream_client.py b/x10/clients/stream/stream_client.py index 839df51..66a49d5 100644 --- a/x10/clients/stream/stream_client.py +++ b/x10/clients/stream/stream_client.py @@ -34,6 +34,14 @@ def subscribe_to_orderbooks(self, market_name: Optional[str] = None, depth: int url = self.__get_url("/orderbooks/", market=market_name, query={"depth": depth}) return self.__connect(url, WrappedStreamResponseModel[OrderbookUpdateModel]) + def subscribe_to_rfq_orderbooks(self, market_name: Optional[str] = None): + """ + Subscribe to the RFQ orderbook stream. + """ + + url = self.__get_url("/orderbooks/rfq/", market=market_name) + return self.__connect(url, WrappedStreamResponseModel[OrderbookUpdateModel]) + def subscribe_to_public_trades(self, market_name: Optional[str] = None): """ https://api.docs.extended.exchange/#trades-stream diff --git a/x10/models/orderbook.py b/x10/models/orderbook.py index faead82..d4277b5 100644 --- a/x10/models/orderbook.py +++ b/x10/models/orderbook.py @@ -1,9 +1,10 @@ from decimal import Decimal -from typing import List +from typing import List, Optional from pydantic import AliasChoices, Field from x10.models.base import X10BaseModel +from x10.models.http import StreamDataType class OrderbookQuantityModel(X10BaseModel): @@ -13,5 +14,8 @@ class OrderbookQuantityModel(X10BaseModel): class OrderbookUpdateModel(X10BaseModel): market: str = Field(validation_alias=AliasChoices("market", "m"), serialization_alias="m") + type: Optional[StreamDataType] = Field( + default=None, validation_alias=AliasChoices("type", "t"), serialization_alias="t" + ) bid: List[OrderbookQuantityModel] = Field(validation_alias=AliasChoices("bid", "b"), serialization_alias="b") ask: List[OrderbookQuantityModel] = Field(validation_alias=AliasChoices("ask", "a"), serialization_alias="a")