linwj / kraken
Kraken API Like the official document interface, Support for arbitrary extension.
Installs: 3 897
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 7
Open Issues: 0
Requires
- php: >=7.0
- guzzlehttp/guzzle: *
This package is auto-updated.
Last update: 2024-10-19 09:24:33 UTC
README
It is recommended that you read the official document first
kraken docs https://www.kraken.live/api
All interface methods are initialized the same as those provided by kraken. See details src/api
Most of the interface is now complete, and the user can continue to extend it based on my design, working with me to improve it.
Other exchanges API
Exchanges It includes all of the following exchanges and is highly recommended.
Installation
composer require linwj/kraken
Support for more request Settings
$kraken=new kraken(); //You can set special needs $kraken->setOptions([ //Set the request timeout to 60 seconds by default 'timeout'=>10, //If you are developing locally and need an agent, you can set this //'proxy'=>true, //More flexible Settings /* 'proxy'=>[ 'http' => 'http://127.0.0.1:12333', 'https' => 'http://127.0.0.1:12333', 'no' => ['.cn'] ], */ //Close the certificate //'verify'=>false, ]);
Spot Trade API
Market related API More
$kraken=new Kraken(); try { $result=$kraken->market()->time(); print_r($result); }catch (\Exception $e){ print_r($e->getMessage()); } try { $result=$kraken->market()->assets(); print_r($result); }catch (\Exception $e){ print_r($e->getMessage()); } try { $result=$kraken->market()->assetPairs(); print_r($result); }catch (\Exception $e){ print_r($e->getMessage()); } try { $result=$kraken->market()->depth([ 'pair'=>'XXBTZUSD', 'count'=>10, ]); print_r($result); }catch (\Exception $e){ print_r($e->getMessage()); }
Order related API More
$kraken=new Kraken($key,$secret); //bargaining transaction try { $result=$kraken->userTrade()->addOrder([ //'userref'=>'xxxxx' //Custom ID 'pair' => 'XXBTZUSD', 'type' => 'buy', 'ordertype' => 'limit', 'price' => '7000', 'volume' => '1.123' ]); print_r($result); }catch (\Exception $e){ print_r($e->getMessage()); } //track the order try { $result=$kraken->user()->queryOrders([ //'userref'=>'xxxxx' //Custom ID 'txid'=>'xxxxxx,xxxxxxx,xxxxxxx', ]); print_r($result); }catch (\Exception $e){ print_r($e->getMessage()); } //cancellation of order try { $result=$kraken->userTrade()->cancelOrder([ //'userref'=>'xxxxx' //Custom ID 'txid'=>'xxxxxx,xxxxxxx,xxxxxxx', ]); print_r($result); }catch (\Exception $e){ print_r($e->getMessage()); }
Accounts related API More
$kraken=new Kraken($key,$secret); try { $result=$kraken->user()->balance(); print_r($result); }catch (\Exception $e){ print_r($e->getMessage()); } try { $result=$kraken->user()->tradeBalance(); print_r($result); }catch (\Exception $e){ print_r($e->getMessage()); } try { $result=$kraken->user()->openOrders(); print_r($result); }catch (\Exception $e){ print_r($e->getMessage()); } try { $result=$kraken->user()->queryOrders(); print_r($result); }catch (\Exception $e){ print_r($e->getMessage()); }