2017 © Pedro Peláez
 

project cobinhood_client_api

Cobinhood Client API

image

dalvin1991/cobinhood_client_api

Cobinhood Client API

  • Wednesday, February 14, 2018
  • by dalvin1991
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Cobinhood Client API

Cobinhood Client API, (*1)

Refer Cobinhood Public API https://cobinhood.github.io/api-public, (*2)

Composer Command, (*3)

composer create-project dalvin1991/cobinhood_client_api

Initialize

Initialize

Client $client = new CobinhoodClientAPI("API-KEY");, (*4)

System Section

Get System Time

$client->getTime();, (*5)

Get System Info

$client->getInfo();, (*6)

Market Section

Get Currencies

$client->getCurrencies();, (*7)

Get Trading Pairs

$client->getTradingPairs();, (*8)

Get Order Books

$client->getOrderBooks($tradingPairID,$limit);
$tradingPairID (string) : you may use the value return by Get Trading Pairs
$limit (int) : number of records return (Optional parameter), (*9)

Get Trading Statistics

$client->getStats();, (*10)

Get Tickers

$client->getTickers($tradingPairID);
$tradingPairID (string) : you may use the value return by Get Trading Pairs, (*11)

Get Recent Trades

$client->getRecentTrades($tradingPairID,$limit);
$tradingPairID (string) : you may use the value return by Get Trading Pairs
$limit (int) : number of records return (Optional parameter), (*12)

Chart Section

Get Candles

$client->getCandles($tradingPairID,$timeframe,$startTime,$endTime);
$tradingPairID (string) : you may use the value return by Get Trading Pairs
$timeframe (string) : candles timeframe ("1m", "5m", "15m", "30m", "1h", "3h", "6h", "12h", "1D", "7D", "14D", "1M")
$startTime (int) : the unix timestamp for the first of candles (Optional parameter)
$endTime (int) : the unix timestamp for the last of candles (Optional parameter), (*13)

Trading Section

Get Order

$client->getOrder($orderID);
$orderID (string) : order id for the order, (*14)

Get Order's Trades

$client->getOrderTrades($orderID);
$orderID (string) : order id for the order, (*15)

Get All Orders

$client->getOrders($tradingPairID,$limit);
$tradingPairID (string) : you may use the value return by Get Trading Pairs (Optional parameter)
$limit (int) : number of records return (Optional parameter), (*16)

Place Order

$client->placeOrder($tradingPairID, $side, $type, $price, $size);
$tradingPairID (string) : you may use the value return by Get Trading Pairs
$side (string) : the order side ("bid", "ask")
$type (string) : the order type ("market", "limit", "stop", "stop_limit")
$price (string) : price for the order
$size (string) : size for the order, (*17)

Modify Order

$client->modifyOrder($orderID,$price,$size);
$orderID (string) : order id for the order
$price (string) : price for the order
$size (string) : size for the order, (*18)

Cancel Order

$client->cancelOrder($orderID);
$orderID (string) : order id for the order, (*19)

Get Order History

$client->getOrderHistory($tradingPairID, $limit);
$tradingPairID (string) : you may use the value return by Get Trading Pairs (Optional parameter)
$limit (int) : number of records return (Optional parameter), (*20)

Get Trade

$client->getTrade($tradeID);
$tradeID (string) : trade id for the trade, (*21)

Get Trades History

$client->getTrades($tradingPairID, $limit);
$tradingPairID (string) : you may use the value return by Get Trading Pairs (Optional parameter)
$limit (int) : number of records return (Optional parameter), (*22)

Wallet Section

Get Ledger Entries

$client->getLedger($currency,$limit);
$currency (string) : you may use the value return by Get Currencies (Optional parameter)
$limit (int) : number of records return (Optional parameter), (*23)

Get Deposit Addresses

$client->getDepositAddresses($currency);
$currency (string) : you may use the value return by Get Currencies (Optional parameter), (*24)

Get Withdrawal Addresses

$client->getWithdrawalAddresses($currency);
$currency (string) : you may use the value return by Get Currencies (Optional parameter), (*25)

Get Withdrawal

$client->getWithdrawal($withdrawalID);
$withdrawalID (string) : withdrawal ID, (*26)

Get All Withdrawal

$client->getWithdrawals();, (*27)

Get Deposit

$client->getDeposit($depositID);
$depositID (string) : depositID ID, (*28)

Get All Deposit

$client->getDeposits();, (*29)

Websocket Section

In websocket, I have implemented the ping message to be sent every 5 sec to maintain the socket stay open after each socket function has called., (*30)

You may refer my index.php example, for each websocket function you may put in your callback function, when receive any message. $class will be your class, then $functionName is the class function name to be call., (*31)

Order
$client->startOrderWS($keepAlive,$timeout,$class,$functionName);

$keepAlive (bool) : keep the socket alive until the timeout (Optional parameter)
$timeout (int) : the socket timeout time with seconds (Optional parameter)
$class (class) : the callback Class (Optional parameter)
$functionName (string) : the callback Class's function (Optional parameter), (*32)

Trades
$client->startTradesWS($tradingPairID,$keepAlive,$timeout,$class,$functionName);

$tradingPairID (string or array) : it can be string for single trading pair or array for multiple trading pair subscribe
$keepAlive (bool) : keep the socket alive until the timeout (Optional parameter)
$timeout (int) : the socket timeout time with seconds (Optional parameter)
$class (class) : the callback Class (Optional parameter)
$functionName (string) : the callback Class's function (Optional parameter), (*33)

Order Book
$client->startOrderBookWS($tradingPairsForOrderBookWS,$keepAlive,$timeout,$class,$functionName);

$tradingPairsForOrderBookWS (array) : you may refer the structure like this, (*34)

$tradingPairsForOrderBookWS=[
    ["tradingPairID"=>"BAT-BTC","precision"=>"1E-8"],
    ["tradingPairID"=>"COB-BTC","precision"=>"1E-8"],
    ["tradingPairID"=>"ETH-BTC","precision"=>"1E-8"]
];

$keepAlive (bool) : keep the socket alive until the timeout (Optional parameter)
$timeout (int) : the socket timeout time with seconds (Optional parameter)
$class (class) : the callback Class (Optional parameter)
$functionName (string) : the callback Class's function (Optional parameter), (*35)

Tinker
$client->startTinkerWS($tradingPairID,$keepAlive,$timeout,$class,$functionName);

$tradingPairID (string or array) : it can be string for single trading pair or array for multiple trading pair subscribe
$keepAlive (bool) : keep the socket alive until the timeout (Optional parameter)
$timeout (int) : the socket timeout time with seconds (Optional parameter)
$class (class) : the callback Class (Optional parameter)
$functionName (string) : the callback Class's function (Optional parameter), (*36)

Candles
$client->startCandlesWS($tradingPairsForCandlesWS,$keepAlive,$timeout,$class,$functionName);

$tradingPairsForOrderBookWS (array) : you may refer the structure like this, (*37)

$tradingPairsForCandlesWS=[
    ["tradingPairID"=>"BAT-BTC","timeframe"=>"30m"],
    ["tradingPairID"=>"COB-BTC","timeframe"=>"30m"],
    ["tradingPairID"=>"ETH-BTC","timeframe"=>"30m"]
];

$keepAlive (bool) : keep the socket alive until the timeout (Optional parameter)
$timeout (int) : the socket timeout time with seconds (Optional parameter)
$class (class) : the callback Class (Optional parameter)
$functionName (string) : the callback Class's function (Optional parameter), (*38)

The Versions

14/02 2018

dev-master

9999999-dev

Cobinhood Client API

  Sources   Download

MIT

The Requires

 

by Avatar dalvin1991

api client package cryptocurrency cobinhood