larislackers/php-binance

Can't seem to get this working?

Amarog opened this issue · 1 comments

How, do I make this work?
I get a bit lost in this. I've got several php API's working for other exchanges but this one gives me a headache.

The documentation in the 'docs' maps is not helping me either.

As a starter, I've downloaded the php-binance. But then? What should I include in my getbalance.php page? It talks of install 'composer require larislackers/php-binance' why should I use this?

You give an example:

// Get all orders for a symbol (BNB/BTC pair).
$bac = new BinanceApiContainer('<your_key>', '<your_secret>');
$orders = $bac->getOrderBook(['symbol' => 'BNBBTC']);
var_dump($orders->getBody()->getContents());

That I can follow. So I should include the BinanceApiContainer.php file? Like this:
include_once 'BinanceApiContainer.php';
$bac = new BinanceApiContainer('qdfqsfqsf', 'qdfqsfqsf');
$orders = $bac->getOrderBook(['symbol' => 'BNBBTC']);
var_dump($orders->getBody()->getContents());

Is that correct?

That would give me the orderbook for that pair?
Can't seem to find how I get my balance from binance either... I'm using this just to check what I've got on Binance.

For instance I have 3 ETC, 1ETH & 4 BTC on Binance.
How would the php code look like if I want to show this?

Sorry for al those n00b questions but I really really get lost in the 'explanation' ...

Any help would be very very very kind!!

Thanks

I've got several php API's working for other exchanges but this one gives me a headache.

The fact that your github profile is empty and repo-less suggests that you are not that familiar with using opensource 3rd party libraries.

As a starter, I've downloaded the php-binance. But then? What should I include in my getbalance.php page? It talks of install 'composer require larislackers/php-binance' why should I use this?

If you don't know what Composer is, or how to use it, please read it's documentation ASAP; I can't help you beyond that. You should really join 2018 in terms of modern development.

So I should include the BinanceApiContainer.php file? Like this: include_once BinanceApiContainer.php';

No, DEFINITELY NO. Use namespaces. That's an advantage of using composer for your projects.

That would give me the orderbook for that pair?

Yes.

Can't seem to find how I get my balance from binance either [...] How would the php code look like if I want to show this?

If you check at the official Binance API Documentation you will see that the endpoint you need is the /api/v3/account which is the getAccount() function.

Sorry for al those n00b questions but I really really get lost in the 'explanation' ... Any help would be very very very kind!!

Help yourself by using namespaces, auto-loading and other methods for your projects. Ditch the archaic way of requiring numerous of files in a single file.

EDIT

If you still can't get this library to work for you, you should try the "official" library chosen by Binance (back from the API competition) found here. Be warned that this library also uses composer as an installation method.