Closed 0xfuckcode closed 11 months ago
Totally agree this should be a string type. Unfortunately the JSON returned by binance's API is using a number type for this property.
There's no simple fix for the order ID value without pre-processing the JSON response before attempting to parse it into an object: https://binance-docs.github.io/apidocs/futures/en/#new-order-trade
The suggested workaround commonly used by others, is to instead use a custom order ID before sending the order, and using that for tracking instead - take a look at this thread: https://github.com/tiagosiebler/binance/issues/208#issuecomment-1128681717
Using custom order ID can be a compromise solution. Thank you very much.
The returned orderId should be a number like 8389765612825190229, but the current returned orderId has its last three digits rounded, resulting in 8389765612825190000. The orderId for some trading pairs may exceed the maximum integer value that JavaScript's built-in Number type can accurately represent. It is necessary to use the string type or BigInt instead of the Number type.
https://github.com/tiagosiebler/binance/blob/6476fcf365f9c00325d2c070e71efe8a14703241/src/types/futures.ts#L407C19-L407C19