2017 © Pedro Peláez
 

library hitbtc-php-sdk

HitBTC SDK for PHP

image

hitbtc-com/hitbtc-php-sdk

HitBTC SDK for PHP

  • Monday, October 30, 2017
  • by hitbtc-com
  • Repository
  • 5 Watchers
  • 20 Stars
  • 547 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 23 Forks
  • 7 Open issues
  • 4 Versions
  • 9 % Grown

The README.md

Hitbtc SDK for PHP

The HitBTC SDK for PHP enables PHP developers to use HitBTC rest trading API in their PHP code, and build robust applications and software., (*1)

Features

  • Get trading and main balances
  • Place new order
  • Cancel order
  • Return list of orders and trades
  • Transfers funds between main and trading accounts
  • Returns the last created or create new one incoming cryptocurrency address that can be used to deposit cryptocurrency to your account.
  • Withdraws money and creates an outgoing crypotocurrency transaction
  • Returns a list of payment transactions

Installing via Composer

The recommended way to install hitbtc-php-sdk is through Composer., (*2)

# Install Composer
curl -sS https://getcomposer.org/installer | php

Next, update your project's composer.json file to include hitbtc-php-sdk:, (*3)

{
    "require": {
        "hitbtc-com/hitbtc-php-sdk": "~1.0"
    }
}

Getting Started

Go to https://hitbtc.com/settings and create your api keys, (*4)

Quick Examples

New order:, (*5)

$client = new \Hitbtc\ProtectedClient('API key', 'API secret', $demo = false);

$newOrder = new \Hitbtc\Model\NewOrder();
$newOrder->setSide($newOrder::SIDE_SELL);
$newOrder->setSymbol('BTCUSD');
$newOrder->setTimeInForce($newOrder::TIME_IN_FORCE_GTC);
$newOrder->setType($newOrder::TYPE_LIMIT);
$newOrder->setQuantity(10);
$newOrder->setPrice(800);

try {
    $order = $client->newOrder($newOrder);
    var_dump($order->getOrderId());
    var_dump($order->getStatus()); // new
} catch (\Hitbtc\Exception\RejectException $e) {
    echo $e; // if creating order will rejected
} catch (\Hitbtc\Exception\InvalidRequestException $e) {
    echo $e->getMessage(); // error in request
} catch (\Exception $e) {
    echo $e->getMessage(); // other error like network issue
}

Cancel order:, (*6)

try {
    $order = $client->cancelOrder($order);
    var_dump($order->getStatus()); // canceled
} catch (\Hitbtc\Exception\RejectException $e) {
    echo $e; // if creating order will rejected
} catch (\Hitbtc\Exception\InvalidRequestException $e) {
    echo $e->getMessage(); // error in request
} catch (\Exception $e) {
    echo $e->getMessage(); // other error like network issue
}

Get trading balance:, (*7)

try {
    foreach ($client->getBalanceTrading() as $balance) {
        echo $balance->getCurrency() . ' ' . $balance->getAvailable() . ' reserved:' . $balance->getReserved() . "\n";
    }
} catch (\Hitbtc\Exception\InvalidRequestException $e) {
    echo $e;
} catch (\Exception $e) {
    echo $e;
}
//BTC 18.314848971 reserved:0.7004
//DOGE 1122543 reserved:0

Get incoming cryptocurrency address that can be used to deposit cryptocurrency to your account:, (*8)

try {
    $address = $client->getPaymentAddress('BTC');
} catch (\Hitbtc\Exception\InvalidRequestException $e) {
    echo $e;
} catch (\Exception $e) {
    echo $e;
}

Transfers funds between main and trading accounts:, (*9)

try {
    $tnxId = $client->transferToMain('BTC', 1.5);
} catch (\Hitbtc\Exception\InvalidRequestException $e) {
    echo $e;
} catch (\Exception $e) {
    echo $e;
}

Documentation

See the https://hitbtc.com/api for more detail., (*10)

License

hitbtc-php-sdk is licensed under the MIT License, (*11)

The Versions

30/10 2017

dev-master

9999999-dev

HitBTC SDK for PHP

  Sources   Download

MIT

The Requires

 

by HitBTC

04/09 2017

1.1.0

1.1.0.0

HitBTC SDK for PHP

  Sources   Download

MIT

The Requires

 

by HitBTC

20/10 2014

1.0.1

1.0.1.0

HitBTC SDK for PHP

  Sources   Download

MIT

The Requires

 

by HitBTC

20/10 2014

1.0.0

1.0.0.0

HitBTC SDK for PHP

  Sources   Download

MIT

The Requires

 

by HitBTC