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 Account ID #18

Open
blahblah1980 opened this issue Sep 20, 2021 · 1 comment
Open

Huobi Account ID #18

blahblah1980 opened this issue Sep 20, 2021 · 1 comment

Comments

@blahblah1980
Copy link

Hi! Thank you for the great work. When trying to post a sample trade with Huobi I get an error. I first get the Account ID using the $result=$huobi->account()->get(); method. I set this ID in the key_secret.php and then require the key_secret.php in my script.

use Lin\Exchange\Exchanges;
require 'exchanges/vendor/linwj/exchanges/tests/key_secret.php';

$key=$keysecret['huobi']['key'];
$secret=$keysecret['huobi']['secret'];
$host=$keysecret['huobi']['host'];
$account_id=$keysecret['huobi']['account_id'];

$exchanges=new Exchanges('huobi',$key,$secret,$account_id,$host);

I then get the following error:

"Array ( [_error] => Array ( [status] => error [err-code] => account-frozen-account-inexistent-error [err-msg] => account for id 1#,###,##6 and user id 1#,###,#9 does not exist [data] => [_method] => POST [_url] => https://api.huobi.pro/v1/order/orders/place [_httpcode] => 200 ) ) "

  1. For some reason it uses commas in the error code. My ID is an int without commas.
  2. what is user ID? I do not set this anywhere. All I have set is key, secret and ID.

Thank you for the help.

@zhouaini528
Copy link
Owner

zhouaini528 commented Sep 22, 2021

Exchange-PHP is an SDK abstracted and encapsulated by the underlying exchange again. You can instantiate the underlying exchange to obtain the ID first. Even you directly instantiate the underlying SDK。

https://github.com/zhouaini528/huobi-php/blob/master/tests/spot/account.php

use Lin\Huobi\HuobiSpot;

$huobi=new HuobiSpot($key,$secret);

//get the status of an account
try {
    $result=$huobi->account()->get();
    print_r($result);
}catch (\Exception $e){
    print_r(json_decode($e->getMessage(),true));
}

Exchange-PHP itself is not very complete, it is recommended to use it https://github.com/zhouaini528/huobi-php

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