dev-master
9999999-devCobinhood Client API
MIT
The Requires
by dalvin1991
api client package cryptocurrency cobinhood
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
Client $client = new CobinhoodClientAPI("API-KEY");
, (*4)
$client->getTime();
, (*5)
$client->getInfo();
, (*6)
$client->getCurrencies();
, (*7)
$client->getTradingPairs();
, (*8)
$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)
$client->getStats();
, (*10)
$client->getTickers($tradingPairID);
$tradingPairID (string) : you may use the value return by Get Trading Pairs, (*11)
$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)
$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)
$client->getOrder($orderID);
$orderID (string) : order id for the order, (*14)
$client->getOrderTrades($orderID);
$orderID (string) : order id for the order, (*15)
$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)
$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)
$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)
$client->cancelOrder($orderID);
$orderID (string) : order id for the order, (*19)
$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)
$client->getTrade($tradeID);
$tradeID (string) : trade id for the trade, (*21)
$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)
$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)
$client->getDepositAddresses($currency);
$currency (string) : you may use the value return by Get Currencies (Optional parameter), (*24)
$client->getWithdrawalAddresses($currency);
$currency (string) : you may use the value return by Get Currencies (Optional parameter), (*25)
$client->getWithdrawal($withdrawalID);
$withdrawalID (string) : withdrawal ID, (*26)
$client->getWithdrawals();
, (*27)
$client->getDeposit($depositID);
$depositID (string) : depositID ID, (*28)
$client->getDeposits();
, (*29)
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)
$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)
$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)
$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)
$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)
$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)
Cobinhood Client API
MIT
api client package cryptocurrency cobinhood