Download the PHP package butschster/kraken-api-client without Composer
On this page you can find all versions of the php package butschster/kraken-api-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
All versions of kraken-api-client with dependencies
Informations about the package kraken-api-client
The most powerful and extendable REST API / Websocket client for Kraken.com. Built on PHP8.0
This is an unofficial Kraken.com PHP8.0 package, which should help users very quickly connect to API from their Laravel or other php project. Of course, the primary feature of this package is the ability to interact with Kraken REST API, but also it allows connecting to Kraken Websocket server.
- REST API client
- Websocket client
- Well documented
- Well tested
- Laravel 8.x or other framework
- PHP 8.0 and above
Require this package with composer using the following command:
composer require butschster/kraken-api-client
If you're using Laravel 8.0 or above, the package will automatically register the KrakenServiceProvider.
Other PHP frameworks
REST API client
You can update your .env file with the following:
REST API methods
API client usage
By using dependency injection
This package uses jms/serializer for converting API responses to object, so you have to pass class, that will use for deserializing.
Note: For non exists API methods you have to create response classes by your self.
If request return an error, will be thrown an exception
Get Server Time
Get the server's time.
Get System Status
Get the current system status or trading mode.
Get Asset Info
Get information about the assets that are available for deposit, withdrawal, trading and staking.
Get Tradable Asset Pairs
Get tradable asset pairs
Get Ticker Information
Note: Today's prices start at midnight UTC
Get Order Book
Get Account Balance
Retrieve all cash balances, net of pending withdrawals.
Get Trade Balance
Retrieve a summary of collateral balances, margin position valuations, equity and margin level.
Get Open Orders
Retrieve information about currently open orders.
Get Closed Orders
Retrieve information about orders that have been closed (filled or cancelled). 50 results are returned at a time, the most recent by default. Note: If an order's tx ID is given for start or end time, the order's opening time (opentm) is used
Query Orders Info
Retrieve information about specific orders.
Place a new order. Note: See the AssetPairs endpoint for details on the available trading pairs, their price and quantity precisions, order minimums, available leverage, etc.
Cancel a particular open order (or set of open orders) by txid or userref
Cancel All Orders
Cancel all open orders
Cancel All Orders After X
CancelAllOrdersAfter provides a "Dead Man's Switch" mechanism to protect the client from network malfunction, extreme latency or unexpected matching engine downtime. The client can send a request with a timeout (in seconds), that will start a countdown timer which will cancel all client orders when the timer expires. The client has to keep sending new requests to push back the trigger time, or deactivate the mechanism by specifying a timeout of 0. If the timer expires, all orders are cancelled and then the timer remains disabled until the client provides a new (non-zero) timeout.
The recommended use is to make a call every 15 to 30 seconds, providing a timeout of 60 seconds. This allows the client to keep the orders in place in case of a brief disconnection or transient delay, while keeping them safe in case of a network breakdown. It is also recommended to disable the timer ahead of regularly scheduled trading engine maintenance (if the timer is enabled, all orders will be cancelled when the trading engine comes back from downtime - planned or otherwise).
Get Deposit Methods
Retrieve methods available for depositing a particular asset.
Get Deposit Addresses
Retrieve (or generate a new) deposit addresses for a particular asset and method.
Get Withdrawal Information
Retrieve fee information about potential withdrawals for a particular asset, key and amount.
Get Websockets Token
An authentication token must be requested via this REST API endpoint in order to connect to and authenticate with our Websockets API. The token should be used within 15 minutes of creation, but it does not expire once a successful Websockets connection and private subscription has been made and is maintained.
Websocket client usage
By using dependency injection
Client can ping server to determine whether connection is alive, server responds with pong. This is an application level ping as opposed to default ping in websockets standard which is server initiated
Server heartbeat sent if no subscription traffic within 1 second (approximately)
Subscribe to an event
Subscribe to a topic on a single or multiple currency pairs.
You can create you own events