binance-api-node icon indicating copy to clipboard operation
binance-api-node copied to clipboard

Get Order Future is not returning the right order id

Open camel113 opened this issue 3 years ago • 2 comments

binanceClient.futuresGetOrder is not returning the right id Some orders have big integer as id like 4676302302390926857 for HNTUSDT When executing

const order = await binanceClient.futuresGetOrder({
  symbol:"HNTUSDT",
  orderId: 4676302302390926857,
});

api is returning me the correct order but with the wrong id

{
  orderId: 4676302302390927000,
  symbol: 'HNTUSDT',
  status: 'FILLED',
  ...
}

Looks like it is not handling big integer. Had someone already have this issue?

camel113 avatar Apr 05 '22 11:04 camel113

@camel113 perhaps binance is not able to manage that orderId number? Because javascript MAX_VALUE integer is 1.7976931348623157e+308 (Number.MAX_VALUE), So I expected that, on binance-node-api, it works.

Do you test it out directly to binance?

JonathanLoscalzo avatar Apr 11 '22 16:04 JonathanLoscalzo

Problem is in encodeURIComponent. If i test in Chrome console:

encodeURIComponent(4676302302390926857)
'4676302302390927000'

The same result is if i use parseInt() function. Some overflow happens or something. I think that orderId should be string type to avoid these problems:

encodeURIComponent("4676302302390926857")
'4676302302390926857'

ljudbane avatar Jun 20 '22 19:06 ljudbane