Skip to content

TPSL MARKET price type blocked by NotImplementedError despite API support #88

@fedarrdi

Description

@fedarrdi

Summary

create_order_object in order_object.py raises NotImplementedError("TPSL 'MARKET' price type is not supported yet") when OrderPriceType.MARKET is used for TP/SL triggers. However, the API documentation explicitly lists MARKET as a supported value for the priceType field on both takeProfit and stopLoss triggers.

Location

x10/perpetual/order_object.py, inside the nested create_tpsl_trigger_model function within __create_order_object:

if trigger_param.price_type == OrderPriceType.MARKET:
    raise NotImplementedError("TPSL `MARKET` price type is not supported yet")

This guard is present in all versions up to and including 1.3.0.

Why this matters

Stop-loss orders placed as LIMIT may not fill during fast price moves / gaps. Market-type SL execution is critical for risk management — the API supports it, but the SDK prevents users from using it.

Expected behavior

OrderPriceType.MARKET should be accepted and serialized as "priceType": "MARKET" in the API payload, the same way LIMIT is handled. The rest of the SDK (serialization, settlement signing) already handles MARKET correctly — only this guard needs to be removed.

Suggested fix

Remove the two-line guard:

- if trigger_param.price_type == OrderPriceType.MARKET:
-     raise NotImplementedError("TPSL `MARKET` price type is not supported yet")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions