zhouaini528 / exchanges-php

This is a virtual currency SDK that brings together multiple exchanges
MIT License
245 stars 66 forks source link

How to extend binance user class for example with sub-account api calls? #21

Open deltarix opened 3 years ago

deltarix commented 3 years ago

How do this work with Exchanges class? have you a little code snip for request "GET /sapi/v1/sub-account/list (HMAC SHA256)" for me?

my code until now:

`use Lin\Exchange\Exchanges;

try {

$tmp_arr = array();
if (isset($cfg_main_arr['msa_api']['binance']['key_ro'])) {
    $tmp_arr = $cfg_main_arr['msa_api']['binance']['key_ro'];
}
if (empty($tmp_arr)) {
    die('config.json error: binance api key "key_ro" not exists!');
}

$ex_binance = new Exchanges('binance', $tmp_arr['APIKEY'], $tmp_arr['APISECRET']);

$result = $ex_binance->getPlatform('spot')
    ->user()
    ->getAccount();

print_r($result);

} catch (Exception $e) { // error mail senden!!! echo $e; }`

zhouaini528 commented 3 years ago

https://github.com/zhouaini528/binance-php/blob/master/tests/spot/user.php#L51

The exchange is not perfect, you use the lowest level method to obtain.

deltarix commented 3 years ago

have you a little example? w/o changing your code?