zhouaini528 / binance-php

Binance API Like the official document interface, Support for arbitrary extension.
MIT License
107 stars 43 forks source link

GetAllOrders or GetAllOpenOrders doesn't works #10

Open valderind4 opened 3 years ago

valderind4 commented 3 years ago

Hello,

I am trying to use this api and when I try to call GetAllOrders or GetAllOpenOrders It always returns an Empty value even having some orders open.

zhouaini528 commented 3 years ago

Hi,I didn't find the document GetAllOpenOrders API. Spot didn't find. Future DELETE /fapi/v1/allOpenOrders

You try this

Spot

use Lin\Binance\Binance;
$binance=new Binance($key,$secret);

try {
    $result=$binance->user()->getAllOrders([
        'symbol'=>'BCHABCUSDT',
        'limit'=>'20',
        //'orderId'=>'',
        //'startTime'=>'',
        //'endTime'=>'',
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r(json_decode($e->getMessage(),true));
}

Future

use Lin\Binance\BinanceFuture;
$binance=new BinanceFuture($key,$secret);

try {
    $result=$binance->user()->getAllOrders([
        'symbol'=>'BTCUSDT',
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}
valderind4 commented 3 years ago

Sorry,

I was taking about this code:

//Query Open OCO (USER_DATA)
try {
    $result=$binance->user()->getOpenOrderList();
    print_r($result);
}catch (\Exception $e){
    print_r(json_decode($e->getMessage(),true));
}

But now, I think It is only for OCO orders, correct?

Aditionally, Is there any way to get all my balance, in USD, for example, without have to get all the currencies quantity (using $binance->user()->getAccount()) and after have to get the current price for all the cryptocurrencies that I have, and finally calculate the total amount of them?