Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I got "amount is invalid" error when i try to withdraw #6550

Closed
Nicour opened this issue Mar 2, 2020 · 3 comments
Closed

I got "amount is invalid" error when i try to withdraw #6550

Nicour opened this issue Mar 2, 2020 · 3 comments
Assignees
Labels

Comments

@Nicour
Copy link

Nicour commented Mar 2, 2020

  • OS: Mac OS Catalina
  • Programming Language version: Node.js
  • CCXT version: 1.23.1
  • Exchange: Bitmex
  • Method: withdraw

This is my route:

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))

});

And this is what i am trying to post:

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

When i execute this route, i get this error:
BadRequest: bitmex {"error":{"message":"amount is invalid","name":"HTTPError"}}

The key and the secret are OK. The otpToken too. I can fetch everything.
I´m new on this, and i can´t figure it out where is the error on my code.

Thank you!!

@kroitor kroitor self-assigned this Mar 2, 2020
@kroitor
Copy link
Member

kroitor commented Mar 2, 2020

Hi!

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.

Let me know if that does not help.

@kroitor
Copy link
Member

kroitor commented Mar 2, 2020

Closing this for now, feel free to reopen it or just ask further questions if any. We will be happy if you report back whether the issue is resolved on your side or not. Thx!

@kroitor kroitor closed this as completed Mar 2, 2020
@Nicour
Copy link
Author

Nicour commented Mar 3, 2020

Hello.
Thank you very much for your help.
I've just try with the amount in satoshis an it works.

Thank you again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants