techtailor / laravel-coindcx-api

Laravel 对 CoinDCX API 的包装。

0.1.1 2021-12-07 06:43 UTC

This package is auto-updated.

Last update: 2024-09-24 23:01:30 UTC


README

GitHub release GitHub issues Software License Total Downloads

此包提供了对CoinDCX API的 Laravel 包装,并允许您轻松与其通信。

重要提示

此包处于早期开发阶段。在发布 v1.0 之前,不建议在生产应用程序中使用它。请随意打开 PR 以贡献于此项目并帮助我完成一个生产就绪的构建。

安装

您可以通过 composer 安装此包

composer require techtailor/laravel-coindcx-api

您可以使用以下命令发布配置文件

php artisan vendor:publish --tag="coindcx-api-config"

打开您的 .env 文件并添加以下内容(用从CoinDCX收到的 API 密钥和密钥替换 YOUR_API_KEYYOUR_SECRET) -

COINDCX_KEY=YOUR_API_KEY
COINDCX_SECRET=YOUR_SECRET

或者

打开可用的发布配置文件,位于 config/coindcx-api.php,并添加您的 API 和密钥

return [
    'auth' => [
        'key'        => env('COINDCX_KEY', 'YOUR_API_KEY'),
        'secret'     => env('COINDCX_SECRET', 'YOUR_SECRET')
    ],
];

使用方法

使用此包非常简单。只需初始化 API 并调用其中一种可用方法

use TechTailor\CoinDCXApi\CoinDCXApi;

$cdx = new CoinDCXApi();

$ticker = $cdx->getTicker();

您还可以在初始化后通过传递设置用户的 API 和密钥(在需要为单个用户隔离 API 密钥时很有用)

$cdx = new CoinDCXApi();

$cdx->setApi($apiKey, $secretKey);

$accountInfo = $cdx->getAccountInfo();

可用方法

可用公共方法(安全类型:NONE[不需要 API 密钥]

- getTicker()               // returns the exchange ticker
- getMarkets()              // returns the exchange markets list
- getMarketsDetails()       // returns the exchange markets details
- getMarketTrades()         // returns the exchange markets trade history

可用私有方法(安全类型:AUTHENTICATED[需要 API 密钥]

- getAccountInfo()          // returns user account info (coindcx_id, email, etc)
- getBalances()             // returns user account balances
- getTradeHistory()         // returns user's complete spot trade history
- getActiveOrders()         // returns user's active orders list

待办事项

我们正在开发的功能或附加功能的列表(不分先后) -

- Improve exception handling.
- Add rate limiting to API Calls.
- Add response for API ban/blacklisting response.
- Improve ReadMe.

变更日志

请参阅变更日志以获取有关最近更改的更多信息。

贡献

请参阅贡献指南以获取详细信息。

安全漏洞

请参阅我们的安全策略,了解如何报告安全漏洞。

鸣谢

许可

MIT 许可证 (MIT)。有关更多信息,请参阅许可证文件