abe27/bitkub-service
最新稳定版本:v0.0.1.5
Composer 安装命令:
composer require abe27/bitkub-service
包简介
A Laravel package for integrating with the Bitkub Cryptocurrency Exchange API
README 文档
README
A Laravel package for integrating with the Bitkub Cryptocurrency Exchange API.
Installation
You can install the package via composer:
composer require abe27/bitkub-service
Publish Configuration
After installing the package, publish the configuration file:
php artisan vendor:publish --tag=bitkub-config
This will create a config/bitkub.php configuration file in your project.
Configuration
Add your Bitkub API credentials to your .env file:
BITKUB_API_KEY=your-api-key
BITKUB_API_SECRET=your-api-secret
BITKUB_ENDPOINT=https://api.bitkub.com
Usage
Basic Usage
// Get market status $status = Bitkub::status(); // Get server time $serverTime = Bitkub::serverTime(); // Get market symbols $symbols = Bitkub::symbols(); // Get ticker information for all symbols $ticker = Bitkub::ticker(); // Get ticker information for a specific symbol $btcTicker = Bitkub::ticker('BTC');
Authentication Required API
For endpoints that require authentication, you need to set up your API key and secret in the configuration file.
// Get user balances $balances = Bitkub::balances(); // Create a buy order $buyOrder = Bitkub::createBuyOrder('BTC', 0.001, 500000, 'limit'); // Create a sell order $sellOrder = Bitkub::createSellOrder('BTC', 0.001, 550000, 'limit'); // Cancel an order $cancelOrder = Bitkub::cancelOrder('BTC', 12345, 'buy');
Available Methods
Public API Endpoints
status()- Get server statusserverTime()- Get server timesymbols()- Get market symbolsticker($symbol = null)- Get ticker information
Private API Endpoints
balances()- Get user balancescreateBuyOrder($symbol, $amount, $rate, $type = 'limit')- Create a buy ordercreateSellOrder($symbol, $amount, $rate, $type = 'limit')- Create a sell ordercancelOrder($symbol, $id, $side)- Cancel an order
Error Handling
All API errors will throw a BitkubException which can be caught and handled appropriately:
use Abe27\Bitkub\Exceptions\BitkubException; try { $balances = Bitkub::balances(); } catch (BitkubException $e) { // Handle Bitkub API error $message = $e->getMessage(); $errorCode = $e->getErrorCode(); // Log or handle the error }
License
This package is open-sourced software licensed under the MIT license.
统计信息
- 总下载量: 27
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-07