"amount is invalid" 当我尝试在 Bitmex (ccxt) 中取款时出错

"amount is invalid" error when i try to withdraw in Bitmex (ccxt)

这是我的路线:

router.post('/withdraw', async (req, res, next) => {
  const {code, address, amount, otpToken, currency } = req.body;

  const exchange = await new ccxt.bitmex();
  exchange.apiKey = "MY - KEY";
  exchange.secret = "MY - SECRET";

  await exchange.withdraw (code, amount, address, tag = undefined, params = {}, otpToken)
  .then((response) => console.log(res))
  .catch(ex => console.log(ex))

});

这就是我正在尝试的 post:

{
"address": "THE ADRESS",
"amount": 0.0022,
"code": "BTC",
"otpToken": "MY TOKEN"
}

当我执行这条路线时,我得到这个错误:

BadRequest: bitmex {"error":{"message":"amount is invalid","name":"HTTPError"}}

密钥和秘密都可以。 otpToken 也是。我什么都能拿 我是这方面的新手,我无法弄清楚我的代码错误在哪里。

谢谢!!

ccxt 团队回答我的问题。这是对我有用的答案:

I think BitMEX requires the amount in satoshis (an integer, not a floating point decimal). So, instead of "amount": 0.0022 it should be "amount": 220000.

BitMEX 要求取款金额以聪为单位(整数值 220000 而不是浮点值 0.0022)。

这个问题在 GitHub 的以下问题中得到了回答: