From e510760e35a30df245eac79b300e25e952f9960a Mon Sep 17 00:00:00 2001 From: Jon Eyrick Date: Mon, 12 Mar 2018 02:04:49 -0700 Subject: [PATCH] Add support for home directory config file (dmzoneill) --- README.md | 88 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 46 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 60e253bd..455a93db 100644 --- a/README.md +++ b/README.md @@ -39,38 +39,6 @@ require 'vendor/autoload.php'; $api = new Binance\API("",""); ``` -#### Getting started with proxy -```php -require 'vendor/autoload.php'; - -$proxyConf = [ - 'proto' => 'tcp', - 'address' => '192.168.1.1', - 'port' => '8080', - 'user' => 'dude', - 'pass' => 'd00d' -]; - -$api = new Binance\API("","", ['useServerTime'=>false], $proxyConf); -``` - -#### Config file in home directory -If you dont wish to store your API key and secret in your scripts, load it from your home directory -```bash -mkdir -vp ~/.config/jaggedsoft/ -cat > ~/.config/jaggedsoft/php-binance-api.json << EOF -{ - "api-key": "", - "api-secret": "" -} -EOF -``` - -Leave these variables blank in the constructor -```php -$api = new Binance\API("", "", ['useServerTime'=>false], $proxyConf); -``` - #### Get latest price of a symbol ```php $ticker = $api->prices(); @@ -1248,6 +1216,52 @@ $depositHistory = $api->depositHistory(); print_r($depositHistory); ``` + +### Advanced Examples + +#### Basic stats: Get api call counter +```php +$api->getRequestCount(); +``` + +#### Basic stats: Get total data transferred +```php +$api->getTransfered(); +``` + +#### Proxy configuration +```php +require 'vendor/autoload.php'; + +$proxyConf = [ + 'proto' => 'tcp', + 'address' => '192.168.1.1', + 'port' => '8080', + 'user' => 'dude', + 'pass' => 'd00d' +]; + +$api = new Binance\API("","", ['useServerTime'=>false], $proxyConf); +``` + +#### Config file in home directory +If you dont wish to store your API key and secret in your scripts, load it from your home directory +```bash +mkdir -vp ~/.config/jaggedsoft/ +cat > ~/.config/jaggedsoft/php-binance-api.json << EOF +{ + "api-key": "", + "api-secret": "" +} +EOF +``` + +Then leave these variables blank in the constructor +```php +$api = new Binance\API("", "", ['useServerTime'=>false], $proxyConf); +``` + + ### Troubleshooting If you get the following errors, please synchronize your system time. ``` @@ -1265,13 +1279,3 @@ $api = new Binance\API("", "", ['useServerTime'=>true]); //Call this before running any functions $api->useServerTime(); ``` - -#### Basic stats: Get api call counter -```php -$api->getRequestCount(); -``` - -#### Basic stats: Get total data transfered -```php -$api->getTransfered(); -```