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

huobi pro issue #444

Closed
zlstt opened this issue Nov 1, 2017 · 13 comments
Closed

huobi pro issue #444

zlstt opened this issue Nov 1, 2017 · 13 comments
Assignees

Comments

@zlstt
Copy link

zlstt commented Nov 1, 2017

2 Problems:

  1. the balance fetched still is 0, in fact the knc coin count is 999.
  2. when I create an order, it returns the err message (login required):
huobipro POST https://api.huobi.pro/v1/order/orders/place 
Request:
 { 'Content-Type': 'application/json' } {"account-id":136075,"amount":"7.0000000000","symbol":"kncbtc","type":"sell-limit","price":"0.0001530000"}
huobipro POST https://api.huobi.pro/v1/order/orders/place 
Response:
{"status":"error","err-code":"login-required","err-msg":"Login required.","data":null}
 

huobipro GET https://api.huobi.pro/v1/common/symbols 
Request:
 undefined undefined
huobipro GET https://api.huobi.pro/v1/common/symbols 
Response:
{"status":"ok","data":[{"base-currency":"bcc","quote-currency":"btc","price-precision":6,"amount-precision":4},{"base-currency":"eth","quote-currency":"btc","price-precision":6,"amount-precision":4},{"base-currency":"ltc","quote-currency":"btc","price-precision":6,"amount-precision":4},{"base-currency":"etc","quote-currency":"btc","price-precision":6,"amount-precision":4},{"base-currency":"bt1","quote-currency":"btc","price-precision":6,"amount-precision":4},{"base-currency":"bt2","quote-currency":"btc","price-precision":6,"amount-precision":4},{"base-currency":"btc","quote-currency":"usdt","price-precision":2,"amount-precision":4},{"base-currency":"eth","quote-currency":"usdt","price-precision":2,"amount-precision":4},{"base-currency":"ltc","quote-currency":"usdt","price-precision":2,"amount-precision":4},{"base-currency":"etc","quote-currency":"usdt","price-precision":2,"amount-precision":4},{"base-currency":"bcc","quote-currency":"usdt","price-precision":2,"amount-precision":4},{"base-currency":"knc","quote-currency":"btc","price-precision":8,"amount-precision":0},{"base-currency":"zrx","quote-currency":"btc","price-precision":8,"amount-precision":0},{"base-currency":"ast","quote-currency":"btc","price-precision":8,"amount-precision":0}]}
huobipro GET https://api.huobi.pro/v1/account/accounts?AccessKeyId=8d5c42c9-bac6bfe1-4b7d4e77-5f8b4&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2017-11-01T17%3A52%3A35&Signature=********************** 
Request:
 undefined undefined
huobipro GET https://api.huobi.pro/v1/account/accounts?AccessKeyId=8d5c42c9-bac6bfe1-4b7d4e77-5f8b4&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2017-11-01T17%3A52%3A35&Signature=********************** 
Response:
{"status":"ok","data":[{"id":136075,"type":"spot","state":"working"}]}
huobipro GET https://api.huobi.pro/v1/account/accounts/136075/balance?AccessKeyId=8d5c42c9-bac6bfe1-4b7d4e77-5f8b4&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2017-11-01T17%3A52%3A36&Signature=************************************** **********************  
Request:
 undefined undefined
huobipro GET https://api.huobi.pro/v1/account/accounts/136075/balance?AccessKeyId=8d5c42c9-bac6bfe1-4b7d4e77-5f8b4&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2017-11-01T17%3A52%3A36&Signature=***************************** 
Response:
{"status":"ok","data":{"id":136075,"type":"spot","state":"working","list":[{"currency":"ast","type":"trade","balance":"0.000000000000000000"},{"currency":"ast","type":"frozen","balance":"0.000000000000000000"},{"currency":"bcc","type":"trade","balance":"0.003500000000000000"},{"currency":"bcc","type":"frozen","balance":"0.000000000000000000"},{"currency":"bt1","type":"trade","balance":"0.000000000000000000"},{"currency":"bt1","type":"frozen","balance":"0.000000000000000000"},{"currency":"bt2","type":"trade","balance":"0.000000000000000000"},{"currency":"bt2","type":"frozen","balance":"0.000000000000000000"},{"currency":"btc","type":"trade","balance":"0.000000000000000000"},{"currency":"btc","type":"frozen","balance":"0.000000000000000000"},{"currency":"etc","type":"trade","balance":"0.000000000000000000"},{"currency":"etc","type":"frozen","balance":"0.000000000000000000"},{"currency":"eth","type":"trade","balance":"0.000000000000000000"},{"currency":"eth","type":"frozen","balance":"0.000000000000000000"},{"currency":"knc","type":"trade","balance":"999.000000000000000000"},{"currency":"knc","type":"frozen","balance":"0.000000000000000000"},{"currency":"ltc","type":"trade","balance":"0.000000000000000000"},{"currency":"ltc","type":"frozen","balance":"0.000000000000000000"},{"currency":"usdt","type":"trade","balance":"0.000000000000000000"},{"currency":"usdt","type":"frozen","balance":"0.000000000000000000"},{"currency":"zrx","type":"trade","balance":"0.000000000000000000"},{"currency":"zrx","type":"frozen","balance":"0.000000000000000000"}]}}
{ info: 
   { status: 'ok',
     data: { id: 136075, type: 'spot', state: 'working', list: [Array] } },
  AST: { free: 0, used: 0, total: 0 },
  BCH: { free: 0, used: 0, total: 0 },
  BT1: { free: 0, used: 0, total: 0 },
  BT2: { free: 0, used: 0, total: 0 },
  BTC: { free: 0, used: 0, total: 0 },
  ETC: { free: 0, used: 0, total: 0 },
  ETH: { free: 0, used: 0, total: 0 },
  KNC: { free: 0, used: 0, total: 0 },
  LTC: { free: 0, used: 0, total: 0 },
  USDT: { free: 0, used: 0, total: 0 },
  ZRX: { free: 0, used: 0, total: 0 },
  free: 
   { AST: 0,
     BCH: 0,
     BT1: 0,
     BT2: 0,
     BTC: 0,
     ETC: 0,
     ETH: 0,
     KNC: 0,
     LTC: 0,
     USDT: 0,
     ZRX: 0 },
  used: 
   { AST: 0,
     BCH: 0,
     BT1: 0,
     BT2: 0,
     BTC: 0,
     ETC: 0,
     ETH: 0,
     KNC: 0,
     LTC: 0,
     USDT: 0,
     ZRX: 0 },
  total: 
   { AST: 0,
     BCH: 0,
     BT1: 0,
     BT2: 0,
     BTC: 0,
     ETC: 0,
     ETH: 0,
     KNC: 0,
     LTC: 0,
     USDT: 0,
     ZRX: 0 } }
@kroitor kroitor self-assigned this Nov 1, 2017
@kroitor
Copy link
Member

kroitor commented Nov 1, 2017

@zlstt I'll take a look and will fix them asap. Thx for reporting!

@kroitor kroitor closed this as completed in fd0014f Nov 1, 2017
@kroitor
Copy link
Member

kroitor commented Nov 1, 2017

@zlstt

  1. Please update to version 1.2.328+, the balance issue should be fixed.
  2. They require an account-id extra param, so you need to pass it along with other arguments to createOrder or preload your accounts. To preload your account id, await huobipro.loadAccounts() before doing other calls to huobi.

The modified call to createOrder should look like this:

await huobipro.loadAccounts() // call it before doing other calls
await huobipro.fetchBalance()
await huobipro.createOrder(...) // your params

Let us know if it helped you or not, plz.

@zlstt
Copy link
Author

zlstt commented Nov 2, 2017

Hi,
Thanks for your info. I pull the latest code

  1. balance is OK
  2. still get the error : Login required

@kroitor
Copy link
Member

kroitor commented Nov 2, 2017

@zlstt hi! Ok, I'll look into the remaining error and will get back to you as soon as I find the cause and fix it.

@kroitor
Copy link
Member

kroitor commented Nov 2, 2017

@zlstt

  1. Can you check if your keypair has a trade permission?
  2. Also, from their docs it looks like they only trade ETH/BTC, LTC/BTC, ETC/BTC, BCC/BTC with their api.huobi.pro API... Can you try one of those pairs to see if it works? We need to check all possible causes, because their docs are not very clear on that particular error.

@zlstt
Copy link
Author

zlstt commented Nov 2, 2017

Hi,
I have checked your questions, not that case.
Look into the log, seems that we didn't pass some parameters such as signature, access key ?
By the way, can you tell me where the doc of huobipro you are refering

Request:
{ 'Content-Type': 'application/json' } {"account-id":96000,"amount":"0.3000000000","symbol":"ltcbtc","type":"buy-limit","price":"0.0000014000"}
huobipro POST https://api.huobi.pro/v1/order/orders/place
Response:
{"status":"error","err-code":"login-required","err-msg":"Login required.","data":null}

@kroitor
Copy link
Member

kroitor commented Nov 2, 2017

@zlstt yeah, it's in my previous post, above, here it is again: https://github.com/huobiapi/API_Docs_en/wiki/REST_Reference#%E4%BA%A4%E6%98%93api
I'll check for params, thx...

@kroitor
Copy link
Member

kroitor commented Nov 2, 2017

@zlstt I uploaded a quickfix for it, let's wait for a new build 1.9.339 (should arrive in 5 minutes). I'll let you know.

@kroitor
Copy link
Member

kroitor commented Nov 2, 2017

Ok, it's here, can you please retry it again with 1.9.339? This is the correct new number. Thx!

@zlstt
Copy link
Author

zlstt commented Nov 2, 2017

Great! It is OK now.
Some minor errors (order price precision error):

if (type == 'limit')
order['price'] = price.toFixed (10);

@kroitor
Copy link
Member

kroitor commented Nov 2, 2017

@zlstt will parse the precision from their markets as well (soon). Thx!

kroitor added a commit that referenced this issue Nov 2, 2017
@kroitor
Copy link
Member

kroitor commented Nov 2, 2017

@zlstt ok, I fixed for precision as well in 1.9.340. Would be happy if you report back whether it now works for you normally or not. Thx!

@zlstt
Copy link
Author

zlstt commented Nov 3, 2017

It works! Thanks

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

No branches or pull requests

2 participants