3s3s / opentrade

OpenTrade - Open Source Cryptocurrency Exchange
MIT License
396 stars 401 forks source link

api function does not work on /account/getbalance #313

Open bihonglu opened 5 years ago

bihonglu commented 5 years ago

I have been testing opentrade api function recently. It works well for all the public api as documented. However, I never got the apikey/secret pair required functions working using my own opentrade real account as testing case.
The https://trade.multicoins.org/API page Node.js example code, replace with real apikey/apisecrete, then run the code for node.js in Ubuntu 18, I got below output: prompt $ nodejs opentradetest.js (node:14926) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. []

Essentially above output is empty output.

bihonglu commented 5 years ago

Update: now I worked on this issue with some testing and found that the getopenorders with apikey funs worked. The example php or node.js code has issues, the url path was wrong. Other than that, the apikey functions in general worked, false alarm initially. The real buggy code is the api function /account/getbalance, which will generate blank results no matter what.
I myself actually find a fix solution for this: comment out the line # 508 at v1.js file: // return onSuccess(req, res, {Currency: message.coin.ticker, Balance: utils.roundDown(balance+awaiting+hold), Available: balance.toFixed(8)1, Pending: awaiting.toFixed(8)1});