Summary
Python's _hosted_build_order_request validates two price constraints that TypeScript's _hostedBuildOrderBody does not: (1) that price is provided for limit orders, and (2) that price > 0.
Python (sdks/python/pmxt/client.py, lines 747–750)
def _hosted_build_order_request(self, ..., price: Optional[float], ...):
...
if order_type == "limit" and price is None:
raise InvalidOrder("price is required for limit orders")
if price is not None and price <= 0:
raise InvalidOrder("price must be positive")
TypeScript (sdks/typescript/pmxt/client.ts, lines 2490–2519)
private _hostedBuildOrderBody(params): Record<string, unknown> {
...
// No check: price required for limit orders
// No check: price > 0
if (!(Number(params.amount) > 0)) {
throw new InvalidOrder("amount must be positive"); // only amount is validated
}
...
if (params.price !== undefined) body["price"] = params.price;
...
}
Impact
- A TypeScript caller sending a limit order with
price: undefined or price: 0 or price: -0.1 will not receive a local InvalidOrder — the malformed request is forwarded to the server, which may return a less informative error.
- A Python caller with the same inputs gets an immediate, descriptive
InvalidOrder before any network round-trip.
- The asymmetry means price validation errors surface at different layers in the two SDKs, making cross-SDK documentation and error-handling examples inconsistent.
Summary
Python's
_hosted_build_order_requestvalidates two price constraints that TypeScript's_hostedBuildOrderBodydoes not: (1) thatpriceis provided for limit orders, and (2) thatprice > 0.Python (
sdks/python/pmxt/client.py, lines 747–750)TypeScript (
sdks/typescript/pmxt/client.ts, lines 2490–2519)Impact
price: undefinedorprice: 0orprice: -0.1will not receive a localInvalidOrder— the malformed request is forwarded to the server, which may return a less informative error.InvalidOrderbefore any network round-trip.