2017 © Pedro Peláez
 

library campbx

REST API Client for CampBX Bitcoin exchange using Guzzle library

image

matmar10/campbx

REST API Client for CampBX Bitcoin exchange using Guzzle library

  • Sunday, July 13, 2014
  • by matmar10
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

campbx

A REST API Client for CampBX Bitcoin exchange using Guzzle library and sophisticated integer math under the hood, (*1)

Installation

This library uses composer and psr-0 autloading standard., (*2)

Add the following to your composer.json file:, (*3)

{
    "require": {
        "matmar10/campbox": "dev-master"
    }
}

Reload your dependencies using php composer.phar update, (*4)

Be sure to include the generated autoloader in your implementation:, (*5)


include __DIR__.'/vendor/autoload.php';

General Usage

REST Client

Include the Client object to create and execute commands., (*6)

Use the factory method to create a new client instance:, (*7)


use Matmar10\CampBX\CampBXClient; $client = CampBXClient::factory();

API methods requiring authentication must use the auth client which requires username and password as required arguments:, (*8)


use Matmar10\CampBX\CampBXAuthClient; $client = CampBXAuthClient::factory(array( 'username' => 'your username', 'password' => 'your password' ));

Commands

This library uses Guzzle PHP, which implements the command pattern., (*9)

Available commands are described in src/Matmar10/CampBX/client-service-description.json, (*10)

When a response is returned, root level properties of the response can be retrieved via the ->get() method:, (*11)


$command = $client->getCommand('GetTicker'); $response = $client->execute($command); // returns an instance of Matmar10\Money\Entity\CurrencyPair $askPrice = $response->get('ask');

Available parameters of the response object are described in the models section of the client-service-description.json file. For example:, (*12)


... { // ... "models": { "GetTicker": { "type": "object":, "properties": { "lastTrade": { "location": "json", "sentAs": "Last Trade", "type": "object", "filters": [{ "method": "Matmar10\\CampBX\\Filter\\Response::asCurrencyPairFromFloat", "args": [ "@value", "BTC", 8, 8, "USD", 2, 2, "B⃦", "$"] }] }, "bid": { "location": "json", "sentAs": "Best Bid", "type": "object", "filters": [{ "method": "Matmar10\\CampBX\\Filter\\Response::asCurrencyPairFromFloat", "args": [ "@value", "BTC", 8, 8, "USD", 2, 2, "B⃦", "$"] }] }, "ask": { "location": "json", "sentAs": "Best Ask", "type": "object", "filters": [{ "method": "Matmar10\\CampBX\\Filter\\Response::asCurrencyPairFromFloat", "args": [ "@value", "BTC", 8, 8, "USD", 2, 2, "B⃦", "$"] }] } } } } // ...

Market Data

Market Depth

See examples/market-data/market-depth.php for a more complete example., (*13)


$command = $client->getCommand('GetMarketDepth'); $response = $client->execute($command); foreach($response->get('ask') as $marketDepthPrice) { echo $marketDepthPrice->getPrice()->getamountDisplay() . ": "; echo $marketDepthPrice->getAmount()->getamountDisplay() . "\n"; }

Ticker

See examples/market-data/ticker.php for a more complete example., (*14)


$command = $client->getCommand('GetTicker'); $response = $client->execute($command); echo "BUY: " . $response->get('bid')->getMultiplier() . "\n"; echo "SELL: " . $response->get('ask')->getMultiplier() . "\n";

Account Data

Get Account Balances

  • Requires Authentication *

See also: examples/account-data/balance.php, (*15)


$client = CampBXAuthClient::factory(array( 'username' => 'your-campbx-username', 'password' => 'changeme', )); $command = $client->getCommand('GetAccountBalances'); $response = $client->execute($command); echo "Total BTC: " . $response->get('totalBTC')->getAmountFloat() . "\n"; echo "Total USD: " . $response->get('totalUSD')->getAmountFloat() . "\n";

The Versions

13/07 2014

dev-master

9999999-dev

REST API Client for CampBX Bitcoin exchange using Guzzle library

  Sources   Download

Apache License Version 2.0

The Requires

 

13/07 2014

0.0.2

0.0.2.0

REST API Client for CampBX Bitcoin exchange using Guzzle library

  Sources   Download

Apache License Version 2.0

The Requires

 

02/11 2013

0.0.1

0.0.1.0

REST API Client for CampBX Bitcoin exchange using Guzzle library

  Sources   Download

Apache License Version 2.0

The Requires

 

13/10 2013

dev-dev-exchange-rate-entity-name

dev-dev-exchange-rate-entity-name

REST API Client for CampBX Bitcoin exchange using Guzzle library

  Sources   Download

Apache License Version 2.0

The Requires