Skip to content
All library documents

Passing a Numeric Variable in a BitMEX Order Request

Article FMZ forum · Author: sunsjk

Summary

This brief troubleshooting post shows a BitMEX limit-order request that succeeds when the price is written as a literal number but fails when the request uses a variable. The logged variable evaluates to a numeric price, yet the API responds that the price field must be numeric. The example points to a request-formatting problem: placing a variable name inside a quoted form-encoded string sends the text “num” rather than the variable’s value.

The practical lesson is to construct the request so the evaluated number is inserted into the parameter value in the format the endpoint expects, then inspect the final request payload when debugging type errors. The post does not show a corrected request or confirm a resolution, and it provides no broader discussion of order execution, validation, or trading results. Its value is limited to illustrating a common distinction between a variable’s runtime type and the literal text transmitted in an API request.

Key ideas

  • A variable can hold a valid numeric price while a request string still transmits its name as text.
  • The BitMEX endpoint rejects a price parameter that arrives as a nonnumeric value.
  • Inspect the constructed request payload to distinguish serialization errors from variable-evaluation errors.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.