Simple Kraken Futures API Wrapper, written in PHP. Includes some basic methods to work with the API and assumes you know your way around. Check out the Kraken Futures API Documentation for more information about the available endpoints. Will throw an exception when errors are encountered.
- Does NOT include mechanism to intercept rate limit.
- Comes without any support.
- Use at your own risk.
composer require mvaessen/binance-api
require 'vendor/autoload.php';
$api = new Mvaessen\KrakenFutureApi\Client('<api key>','<secret>');
$result = $api->queryPublic('<method>', '<endpoint>', '<request>');
$result = $api->queryPrivate('<method>', '<endpoint>', '<request>');
Make sure to populate the .env file, run composer install
and set your testing API keys in the .env
file, in the root of the project. Afterwards run ./vendor/bin/phpunit tests/BasicApiTest.php
to test your API keys. The test runs against the https://conformance.cryptofacilities.com/derivatives
environment.
You can choose to overwrite the processErrorCode
and processException
methods to report the errors to your favorite bugreporting software.
<?php
namespace App;
use Mvaessen\KrakenFutureApi\KrakenFutureApiException;
use Mvaessen\KrakenFutureApi\Client;
class KrakenFutureApi extends Client
{
public function accounts()
{
return $this->api->queryPrivate('get', 'accounts');
}
protected function processErrorCode($response, $method, $url, $request)
{
//todo report to bugtracking software
throw new KrakenFutureApiException($response['msg']);
}
protected function processException($e, $method, $url, $request)
{
//todo report to bugtracking software
throw new KrakenFutureApiException($e->getMessage());
}
}