hellovoid/gdax
Composer 安装命令:
composer require hellovoid/gdax
包简介
GDAX API library
README 文档
README
GDAX PHP API Client Library
This is the unofficial client library for the GDAX API. Inspired by Coinbase PHP Library.
Installation
Install the library using Composer. Please read the Composer Documentation if you are unfamiliar with Composer or dependency managers in general.
composer require hellovoid/gdax
Authentication
Use an API key, secret and passphrase to access your own GDAX account.
use Hellovoid\Gdax\Configuration; use Hellovoid\Gdax\Client; $configuration = Configuration::apiKey($apiKey, $apiSecret, $apiPassphrase); $client = Client::create($configuration);
Response
Every successful method request returns decoded json array.
Pagination #ref
Your requests should use these cursor values when making requests for pages after the initial request.
| Parameter | Description |
|---|---|
| $before | Request page before (newer) this pagination id. (default null) |
| $after | Request page after (older) this pagination id. (default null) |
| $limit | Number of results per request. Maximum 100. (default 100) |
use \Hellovoid\Gdax\Pagination; $pagination = Pagination::create($before, null, $limit); $client->setPagination($pagination); $pagination->setEndingBefore(null); $pagination->setStartingAfter($after);
Accounts #ref
List Accounts
$client->getAccounts();
Account details
$client->getAccount($accountId);
Account history
$client->getAccountHistory($accountId);
Account holds
$client->getAccountHolds($accountId);
Orders #ref
Place new order
$order = $client->placeOrder([ 'size' => 0.1, 'price' => 0.1, 'side' => 'buy', 'product_id' => 'BTC-USD' ]);
Cancel an order
try { $response = $client->orderCancel($orderId); } catch (HttpException $e) { // Order could not be canceled $e->getMessage(); }
Cancel all orders
$response = $client->ordersCancel();
Cancel all orders for a specific product:
$response = $client->ordersCancel([ 'product_id' => $productId ]);
List orders
$response = $client->getOrders();
Get order details
$response = $client->getOrder($orderId);
Fills #ref
List fills
$response = $client->getFills([ 'order_id' => 'all', 'product_id' => 'all' ]);
Funding #ref
List fundings
Get fundings with status "settled".
$response = $client->getFundings([ 'status' => 'settled', // outstanding, settled, or rejected ]);
Repay
$response = $client->fundingRepay([ 'amount' => 1.00, 'currency' => 'EUR', ]);
Margin Transfer #ref
$response = $client->marginTransfer([ 'margin_profile_id' => '45fa9e3b-00ba-4631-b907-8a98cbdf21be', 'type' => 'deposit', 'currency' => 'USD', 'amount' => 2, ]);
Position #ref
Get overview of your profile
$response = $client->position();
Close
$response = $client->positionClose([ 'repay_only' => true ]);
Deposits #ref
Payment method
$response = $client->depositPaymentMethod([ 'amount' => 2.00, 'currency' => 'USD', 'payment_method_id' => 'bc677162-d934-5f1a-968c-a496b1c1270b' ]);
Coinbase
Deposit funds from a coinbase account.
$response = $client->depositCoinbase([ 'amount' => 2.00, 'currency' => 'BTC', 'coinbase_account_id' => 'c13cd0fc-72ca-55e9-843b-b84ef628c198' ]);
Withdrawals #ref
Payment method
$response = $client->withdrawalPaymentMethod([ 'amount' => 2.00, 'currency' => 'USD', 'payment_method_id' => 'bc677162-d934-5f1a-968c-a496b1c1270b' ]);
Coinbase
Withdrawal funds to a coinbase account.
$response = $client->withdrawalCoinbase([ 'amount' => 2.00, 'currency' => 'BTC', 'coinbase_account_id' => 'c13cd0fc-72ca-55e9-843b-b84ef628c198' ]);
Crypto
Withdrawal funds to a crypto address.
$response = $client->withdrawalCoinbase([ 'amount' => 0.01, 'currency' => 'BTC', 'crypto_address' => '0x5ad5769cd04681FeD900BCE3DDc877B50E83d469' ]);
Payment methods #ref
Get a list of your payment methods.
$response = $client->getPaymentMethods();
Coinbase accounts #ref
Get a list of your coinbase accounts.
$response = $client->getCoinbaseAccounts();
Reports #ref
Create a new report
$response = $client->createReport([ 'type' => 'fills', 'start_date' => '2014-11-01T00:00:00.000Z', 'end_date' => '2014-11-30T23:59:59.000Z' ]);
Get report status
$response = $client->getReportStatus($reportId);
Products #ref
Get products
$response = $client->getProducts();
Get Product Order Book
$response = $client->getProductOrderBook($productId);
Get Product Ticker
$response = $client->getProductTicker($productId);
Get Product Trades
$response = $client->getProductTrades($productId);
Get Historic Rates
$response = $client->getProductHistoricRates($productId);
Get 24hr Stats
$response = $client->getProductLast24HrStats($productId);
Currencies #ref
$response = $client->getCurrencies();
Get Time #ref
$response = $client->getTime();
hellovoid/gdax 适用场景与选型建议
hellovoid/gdax 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.22k 次下载、GitHub Stars 达 16, 最近一次更新时间为 2017 年 11 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「bitcoin」 「coinbase」 「gdax」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hellovoid/gdax 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hellovoid/gdax 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hellovoid/gdax 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The BlockTrail PHP SDK, for integration of Bitcoin functionality through the BlockTrail API
Coinbase Commerce API library
Coinbase API library
CoinDesk Bitcoin Price Index API for Laravel
Coinbase Commerce Bundle for Symfony
Coinbase driver for the Omnipay payment processing library
统计信息
- 总下载量: 9.22k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 17
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-11-06