doublebit/okcoin
A simple Laravel 5 wrapper for OKCoin API., (*1)
This package is not ready for use in production!, (*2)
Installation
Install with composer:, (*3)
composer require doublebit/okcoin, (*4)
Then add the provider to config/app.php, (*5)
DoubleBit\OKCoin\OkcoinServiceProvider::class,, (*6)
and optionally add the facade to aliases, (*7)
'OKCoin' => DoubleBit\OKCoin\Facade::class,, (*8)
Then run php artisan vendor:publish --provider="Doublebit\Okcoin\OkcoinServiceProvider, (*9)
Usage
echo json_encode(\OKCoin::getTicker()), (*10)
The package has no built-in API calls, you can make a call to any endpoint from the OKCoin API., (*11)
If the OKCoin API adds new endpoints you can make calls to those without updating the package., (*12)
The methods are constructed as follows: first all lowercase word is the method (get/post).
Then starting with an uppercase letter is the name of the endpoint from OKCoin API.
In the name of the endpoint remove all the underscores (_) and start each word after an underscore
with an uppercase. Example: POST /api/v1/batch_trade becomes OKCoin::postBatchTrade(), (*13)
The methods support up to 4 arguments, as follows:
* If the first argument is not a string, it MUST BE an array of parameters for the query (according to the API docs)
* If the first argument is string, it's considered API_KEY and the second argument MUST BE SECRET_KEY and the array
of parameters are moved to the third argument
* Last argument is always the callback. The callback receives the following 3 arguments: $endpoint, $params, $result.
The $endpoint is the API endpoint, not the method name. The $params is an array of params (sent to the method).
The $result is the json received from the server or false in case of error., (*14)
OkcoinException
// @todo, (*15)
Issues
Report any issues on github, (*16)
License
See LICENSE file, (*17)