MFX Hub
Concepts

Idempotency and results

Every write takes an idempotency_key and none defaults it. Retrying with the same key returns the original answer. Execution methods never raise: a transport fault, a timeout and a broker rejection are all results with a reason you can read.

result = await client.execution.place_order(
    terminal.id, symbol="EURUSD", side="buy", volume="0.10",
    sl="1.0820", tp="1.0950", idempotency_key="order-0001",
)
if not result.ok:
    print(result.reason, result.mt5_retcode, result.retcode_text, result.comment_raw)

The result carries whether MFX Hub accepted the command, what the broker did with it, both latencies, and, when it went wrong, a reason from a granular vocabulary rather than a bucket. A reason the platform adds later arrives as its own string, never folded into “failed”.