2017 © Pedro Peláez
 

library cyger

A PHP library to get cryptocurrency price from various exchange APIs.

image

kuromoka/cyger

A PHP library to get cryptocurrency price from various exchange APIs.

  • Friday, May 4, 2018
  • by kuromoka
  • Repository
  • 0 Watchers
  • 2 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Cyger

Build Status Coverage Status, (*1)

Cyger is a PHP library to get cryptocurrency price from various exchange APIs. - It is possible to resolve different specifications for each api as soon as possible. - It can get last price, bid price, ask price and volume. - Supporting exchanges, (*2)

Install

$ composer require kuromoka/cyger

Requirement

Usage

The first example code below shows getting last price of BTC_ETH from Poloniex., (*3)

require 'vendor/autoload.php';

use Cyger\Client;

$client = new Client();
$result = $client->setExchange('Poloniex')->setPair('BTC_ETH')->getLastPrice();
echo $result['Poloniex']['BTC_ETH'];    // 0.04549105

The secound example code below shows getting last price of BTC_ETH from all supporting exchanges. It is possible not to set exchange, but it is necessary to set pairs.
if exchanges don't support pairs, returning NULL., (*4)

$client = new Client();
$result = $client->setPair('BTC_ETH')->getLastPrice();
echo $result['Poloniex']['BTC_ETH'];     // 0.04549105
echo $result['Bittrex']['BTC_ETH'];      // 0.04577
echo $result['Coincheck']['BTC_ETH'];    // NULL (Coincheck doesn't support BTC_ETH pair.)

Also, you can use various style of exchange name and pair name. You don't have to think each api specifications basically.
The example below shows OK and NG name., (*5)

$client->setExchange('poloniex')    // OK
$client->setExchange('POLONIEX')    // OK
$client->setExchange('POLONIE')     // NG

$client->setPair('BTC_ETH');        // OK
$client->setPair('btc-eth');        // OK
$client->setPair('ETH/BTC');        // OK
$client->setPair('BTC:ETH');        // NG

Key name of results array is setting from your style., (*6)

$client = new Client();
$result = $client->setExchange('POLONIEX')->setPair('ETH/BTC')->getLastPrice();
echo $result['POLONIEX']['ETH/BTC'];    // 0.04549105

When you want to get other than last price, please replace getLastPrice() to methods below., (*7)

  • getBidPrice()
  • getAskPrice()
  • getVolume()

Supporting exchanges

I am going to add more exchanges in the future. - Binance - bitFlyer - Bittrex - Coincheck - Poloniex - Zaif, (*8)

Author

The Versions

04/05 2018

dev-master

9999999-dev

A PHP library to get cryptocurrency price from various exchange APIs.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar kuromoka

04/05 2018

v2.0.0

2.0.0.0

A PHP library to get cryptocurrency price from various exchange APIs.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar kuromoka

19/12 2017

v1.0.0

1.0.0.0

A PHP library to get cryptocurrency price from various exchange APIs.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar kuromoka