Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "x10-python-trading-starknet"
version = "2.4.0"
version = "2.4.1"
description = "Python client for X10 API"
authors = ["X10 <tech@ex10.org>"]
repository = "https://github.com/x10xchange/python_sdk"
Expand Down
1 change: 1 addition & 0 deletions tests/clients/test_rest_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ async def test_get_markets(aiohttp_server, create_btc_usd_market):
"active": True,
"isRfq": False,
"isOffHours": False,
"tradingHours": "CONTINUOUS",
"marketStats": {
"dailyVolume": "2410800.768021",
"dailyVolumeBase": "37.94502",
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/market.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def get_btc_usd_market_json_data():
"active": true,
"isRfq": false,
"isOffHours": false,
"tradingHours": "CONTINUOUS",
"marketStats": {
"dailyVolume": "2410800.768021",
"dailyVolumeBase": "37.94502",
Expand Down
3 changes: 3 additions & 0 deletions x10/clients/blocking/blocking_trading_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ async def create_and_place_order(
order_type: OrderType = OrderType.LIMIT,
) -> TimedOpenOrderModel:
market = (await self.get_markets()).get(market_name)

if not market:
raise ValidationError(f"Market '{market_name}' not found.")

Expand Down Expand Up @@ -239,8 +240,10 @@ async def create_and_place_order(
)
placed_order_task = asyncio.create_task(place_order)
order_waiter = self.__order_waiters[order.id]

if order_waiter.open_order:
return order_waiter.open_order

async with order_waiter.condition:
await asyncio.gather(
placed_order_task,
Expand Down
2 changes: 2 additions & 0 deletions x10/clients/rest/rest_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ async def place_order(
take_profit=take_profit,
stop_loss=stop_loss,
)

if market.is_rfq:
return await self.__order_management_module.place_rfq_order(order)

return await self.__order_management_module.place_order(order)

async def close(self):
Expand Down
7 changes: 7 additions & 0 deletions x10/models/market.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ class MarketType(StrEnum):
PERPETUAL = "PERPETUAL"


class MarketTradingHours(StrEnum):
CONTINUOUS = "CONTINUOUS"
WEEKDAYS = "WEEKDAYS"
REGULAR = "REGULAR"


class MarketModel(X10BaseModel):
name: str
type: MarketType
Expand All @@ -110,6 +116,7 @@ class MarketModel(X10BaseModel):
active: bool
is_rfq: bool
is_off_hours: bool
trading_hours: MarketTradingHours
market_stats: MarketStatsModel
trading_config: TradingConfigModel
l2_config: L2ConfigModel
Expand Down
5 changes: 4 additions & 1 deletion x10/tools/mcp/place_order_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,5 +213,8 @@ async def place_order(
else None,
)

result = await client.orders.place_order(order=order)
result = await (
client.orders.place_rfq_order(order=order) if market.is_rfq else client.orders.place_order(order=order)
)

return serialize_tool_result(result.data)
Loading