guilhermecfviana/mercadobitcoin

用于 mercadobitcoin trade-api 的非官方 PHP 客户端

1.4 2019-12-26 19:57 UTC

This package is auto-updated.

Last update: 2024-09-27 06:47:36 UTC


README

MarketBitcoin Trade-API 的 PHP 客户端 (Composer)

如何使用?

使用 composer 安装

composer require guilhermecfviana/mercadobitcoin

创建您的账户并按照 https://www.mercadobitcoin.com.br/trade-api/ 中的步骤操作

使用示例

$options = [
    'identificador' => 'seu_identificador',
    'segredo' => 'seu_segredo',
];

$test = new \GuilhermeViana\MercadoBitcoin\TradeApi($options['identificador'], $options['segredo']);
echo $test->getAccountInfo();

所有方法均可使用,但并非所有方法都经过测试

  • getAccountInfo()
  • getOrder($coinPair, $orderId)
  • listOrders($coinPair, $orderType = null, $statusList = null, $hasFills = null, $fromId = null, $toId = null, $fromTimestamp = null, $toTimestamp = null)
  • listOrderBook($coinPair, $full = null)
  • placeBuyOrder($coinPair, $quantity, $limitPrice)
  • placeSellOrder($coinPair, $quantity, $limitPrice)
  • placeMarketBuyOrder($coinPair, $cost)
  • placeMarketSellOrder($coinPair, $quantity)
  • cancelOrder($coinPair, $orderId)
  • getWithdrawal($coin, $withdrawalId)
  • withdrawCoin($coin, $description = null)

有两种方法来处理手册中指定的 nonce

  • 手册:在构造函数中指定当前的 nonce(最后使用的 + 1)
  • 时间戳:通过当前时间戳生成 nonce - 不适用于每秒超过一个请求。

要求

PHP >= 7.0

Docker

您可以使用 Docker 来创建开发环境,只需在项目根目录下执行即可

    ~/workspace/PHP/mercadobitcoin$ docker-compose up

欢迎贡献。