Node Cobinhood API
Node Cobinhood API is a simple to use Node.js library for Cobinhood The World's First ZERO Trading Fees Cryptocurrency Exchange.
NOTE: COBINHOOD IS CURRENTLY UNDER HEAVY DEVELOPMENT, APIs ARE SUBJECT TO CHANGE WITHOUT PRIOR NOTICE
Table of contents
Getting started
Installation
npm install node-cobinhood-api
Main setup
const cobinhood = ; cobinhoodoptions 'apiKey': '<api key>' 'verbose': true;
Public API
Get the latest price of a symbol
cobinhood;
Get depth of a symbol
let limit = 10; // Optional. Defaults to 50 if not specified, if limit is 0, it means to fetch the whole order book. cobinhood;
Response
sequence: 0 // A sequence number that is updated on each orderbook state change bids: price: '0.00001615' orders: '1' quantity: '2000' price: '0.00001611' orders: '2' quantity: '1643.07076472' price: '0.0000161' orders: '2' quantity: '2137.4987851' price: '0.00001602' orders: '3' quantity: '4051.77902621' price: '0.00001601' orders: '3' quantity: '54500' price: '0.000016' orders: '1' quantity: '200' price: '0.00001599' orders: '1' quantity: '200' price: '0.00001598' orders: '1' quantity: '200' price: '0.00001597' orders: '1' quantity: '200' price: '0.00001596' orders: '1' quantity: '200' asks: price: '0.0000166' orders: '1' quantity: '427.29060805' price: '0.00001688' orders: '1' quantity: '600' price: '0.00001691' orders: '2' quantity: '5136.79420461' price: '0.0000173' orders: '1' quantity: '2000' price: '0.00001731' orders: '1' quantity: '8656.09357823' price: '0.00001733' orders: '1' quantity: '572' price: '0.00001734' orders: '1' quantity: '690.98028617' price: '0.00001735' orders: '2' quantity: '1909.65293563' price: '0.0000174' orders: '1' quantity: '623.56476684' price: '0.00001741' orders: '1' quantity: '500'
Get all currencies
Returns info for all currencies available for trade
cobinhood;
Response
currency: 'BTC' name: 'Bitcoin' min_unit: '0.00000001' deposit_fee: '0' withdrawal_fee: '0.001' currency: 'COB' name: 'Cobinhood Token' min_unit: '0.00000001' deposit_fee: '0' withdrawal_fee: '43.39' ...
Get info for all trading pairs
cobinhood;
Response
id: 'COB-BTC' base_currency_id: 'COB' quote_currency_id: 'BTC' base_max_size: '5165662.806' base_min_size: '154.969' quote_increment: '0.00000001' id: 'COB-ETH' base_currency_id: 'COB' quote_currency_id: 'ETH' base_max_size: '5165662.806' base_min_size: '154.969' quote_increment: '0.0000001' ...
Get trading statistics
cobinhood;
Response
'COB-BTC': id: 'COB-BTC' last_price: '0.00001611' lowest_ask: '0.0000161' highest_bid: '0.00001779' base_volume: '320442.45023293' quote_volume: '5.4801039201211806' is_frozen: false high_24hr: '0.00001894' low_24hr: '0.0000161' percent_changed_24hr: '-0.070398153491056' 'COB-ETH': id: 'COB-ETH' last_price: '0.0002008' lowest_ask: '0.0002007' highest_bid: '0.0002202' base_volume: '822814.89034178' quote_volume: '174.865914947356928' is_frozen: false high_24hr: '0.0002243' low_24hr: '0.0002004' percent_changed_24hr: '-0.0664807066480707' ...
Get ticker of a symbol
cobinhood;
Response
trading_pair_id: 'COB-BTC' timestamp: 1519307340000 '24h_high': '0.00001894' '24h_low': '0.0000161' '24h_open': '0.00001734' '24h_volume': '321346.24401148' last_trade_price: '0.00001611' highest_bid: '0.00001612' lowest_ask: '0.0000163'
Get tickers of all symbols
cobinhood;
Response
trading_pair_id: 'MANA-ETH' timestamp: 1520115000000 '24h_high': '0.0001278' '24h_low': '0.0001106' '24h_open': '0.0001106' '24h_volume': '3224.93485295' last_trade_price: '0.000125' highest_bid: '0.0001133' lowest_ask: '0.0001365' trading_pair_id: 'SPHTX-USDT' timestamp: 1520115000000 '24h_high': '0' '24h_low': '0' '24h_open': '0' '24h_volume': '0' last_trade_price: '0' highest_bid: '0.0578' lowest_ask: '3.9956' trading_pair_id: 'BDG-USDT' timestamp: 1520115000000 '24h_high': '0.149' '24h_low': '0.149' '24h_open': '0.149' '24h_volume': '0' last_trade_price: '0.149' highest_bid: '0.01173' lowest_ask: '0.14599' ...
Get recent trades of a symbol
let limit = 2; // Optional. Defaults to 20 if not specified, max 50. cobinhood;
Response
id: 'ff41c738-4ee3-4c43-84c0-d448adb4344b' maker_side: 'ask' timestamp: 1519295760515 price: '0.0000171' size: '435.97269025' id: '3d30dd75-a70e-46db-955b-3dd5b9334a9e' maker_side: 'bid' timestamp: 1519295474495 price: '0.0000171' size: '159.25555556'
Get candles of a symbol
let timeframe = '5m'; // Timeframes: 1m, 5m, 15m, 30m, 1h, 3h, 6h, 12h, 1D, 7D, 14D, 1Mlet startTime = 1519307723000; // Optional. Unix timestamp in milliseconds. Defaults to 0 if not specified. You can set it to false.let endTime = 1519308723000; // Optional. Unix timestamp in milliseconds. Defaults to current server time if not specified. You can set it to false. cobinhood;
Response
timeframe: '5m' trading_pair_id: 'COB-BTC' timestamp: 1519307700000 volume: '0' open: '0.0000162' close: '0.0000162' high: '0.0000162' low: '0.0000162' timeframe: '5m' trading_pair_id: 'COB-BTC' timestamp: 1519308000000 volume: '0' open: '0.0000162' close: '0.0000162' high: '0.0000162' low: '0.0000162' timeframe: '5m' trading_pair_id: 'COB-BTC' timestamp: 1519308300000 volume: '814.81238504' open: '0.0000163' close: '0.00001631' high: '0.00001631' low: '0.0000163' timeframe: '5m' trading_pair_id: 'COB-BTC' timestamp: 1519308600000 volume: '0' open: '0.00001631' close: '0.00001631' high: '0.00001631' low: '0.00001631'
Get server time
Returns server Unix timestamp in milliseconds
cobinhood;
Get server information
cobinhood;
Response
phase: 'production' revision: 'aa77d8'
Trading API
Place a LIMIT BUY order
let price = 0000017;let quantity = 1000; cobinhood;
Response
id: '37f550a2-2aa6-20f4-a3fe-e120f420637c' trading_pair: 'COB-BTC' side: 'bid' type: 'limit' price: '0.000017' size: '1000' filled: '0' state: 'queued' timestamp: 1519314758661 eq_price: '0' completed_at: null
Place a LIMIT SELL order
let price = 0000017;let quantity = 1000; cobinhood;
Response
id: '37f550a2-2aa6-20f4-a3fe-e120f420637c' trading_pair: 'COB-BTC' side: 'ask' type: 'limit' price: '0.000017' size: '1000' filled: '0' state: 'queued' timestamp: 1519314758661 eq_price: '0' completed_at: null
Place a MARKET BUY order
let quantity = 1000; cobinhood;
Response
id: '37f550a2-2aa6-20f4-a3fe-e120f420637c' trading_pair: 'COB-BTC' side: 'bid' type: 'market' price: '0' size: '1000' filled: '0' state: 'queued' timestamp: 1519314758661 eq_price: '0' completed_at: null
Place a MARKET SELL order
let quantity = 1000; cobinhood;
Response
id: '37f550a2-2aa6-20f4-a3fe-e120f420637c' trading_pair: 'COB-BTC' side: 'ask' type: 'market' price: '0' size: '1000' filled: '0' state: 'queued' timestamp: 1519314758661 eq_price: '0' completed_at: null
Get an order's status
let orderId = '37f550a2-2aa6-20f4-a3fe-e120f420637c'; cobinhood;
Response
id: '37f550a2-2aa6-20f4-a3fe-e120f420637c' trading_pair: 'COB-BTC' side: 'bid' type: 'market' price: '0' size: '1000' filled: '0' state: 'rejected' timestamp: 1519314758661 eq_price: '0' completed_at: '2018-02-22T16:42:38.716476Z'
Cancel an order
let orderId = '37f550a2-2aa6-20f4-a3fe-e120f420637c'; cobinhood;
Modify an order
let orderId = '37f550a2-2aa6-20f4-a3fe-e120f420637c';let price = 0000018;let quantity = 1000; cobinhood;
Get open orders of a symbol
let limit = 2; // Optional. Defaults to 20 if not specified, max 50. cobinhood;
Response
id: 'ccb0c81c-08be-4df5-afe4-18039fd533ed' trading_pair: 'COB-ETH' side: 'bid' type: 'limit' price: '0.0001' size: '200' filled: '0' state: 'open' timestamp: 1519322294967 eq_price: '0' completed_at: null
Get all open orders
let limit = 2; // Optional. Defaults to 20 if not specified, max 50. cobinhood;
Response
id: 'a0338ca4-689f-4698-b5cb-961f515243a9' trading_pair: 'BRD-ETH' side: 'bid' type: 'limit' price: '0.0004' size: '40' filled: '0' state: 'open' timestamp: 1519322329670 eq_price: '0' completed_at: null id: 'ccb0c81c-08be-4df5-afe4-18039fd533ed' trading_pair: 'COB-ETH' side: 'bid' type: 'limit' price: '0.0001' size: '200' filled: '0' state: 'open' timestamp: 1519322294967 eq_price: '0' completed_at: null
Get order's trades
let orderId = '37f550a2-2aa6-20f4-a3fe-e120f420637c'; cobinhood;
Response
id: '09619448e48a3bd73d493a4194f9020b' price: '10.00000000' size: '0.01000000' maker_side: 'bid' timestamp: 1504459805123 id: '943829d8798d7d9s87984787d89799dd' price: '10.00000000' size: '0.05000000' maker_side: 'bid' timestamp: 1504459815765
Get order history of a symbol
let limit = 2; // Optional. Defaults to 50 if not specified. cobinhood;
Response
id: '37f550a2-2aa6-20f4-a3fe-e120f420637c' trading_pair: 'COB-BTC' side: 'ask' type: 'limit' price: '0.000017' size: '1000' filled: '0' state: 'cancelled' timestamp: 1519321076327 eq_price: '0' completed_at: '2018-02-22T17:38:25.325001Z' id: 'e120f420-2aa6-20f4-a3fe-37f550a2637c' trading_pair: 'COB-BTC' side: 'bid' type: 'limit' price: '0.000017' size: '1000' filled: '1000' state: 'filled' timestamp: 1519320455598 eq_price: '0.000017' completed_at: '2018-02-22T17:35:30.412993Z'
Get all order history
let limit = 2; // Optional. Defaults to 50 if not specified. cobinhood;
Response
id: 'fab424b8-10d0-4d0b-9407-a5262a1b2860' trading_pair: 'COB-ETH' side: 'bid' type: 'limit' price: '0.0002089' size: '200' filled: '200' state: 'filled' timestamp: 1519321698331 eq_price: '0.0002089' completed_at: '2018-02-22T17:53:16.55734Z' id: '37f550a2-2aa6-20f4-a3fe-e120f420637c' trading_pair: 'COB-BTC' side: 'ask' type: 'limit' price: '0.000017' size: '1000' filled: '0' state: 'cancelled' timestamp: 1519321076327 eq_price: '0' completed_at: '2018-02-22T17:38:25.325001Z'
Wallet API
Get wallet balances
cobinhood;
Response
currency: 'BTC' type: 'exchange' total: '0' on_order: '0' locked: false currency: 'ETH' type: 'exchange' total: '0.09849225' on_order: '0.04' locked: false currency: 'COB' type: 'exchange' total: '2000' on_order: '0' locked: false
Get balance history of a currency
let limit = 3; // Defaults to 20 if not specified, max 50. cobinhood;
Response
timestamp: '2018-02-27T03:11:45.132432Z' currency: 'ETH' type: 'exchange' action: 'withdraw' amount: '0.000543' balance: '0' trade_id: null deposit_id: null withdrawal_id: '09619448-985d-4485-835e-b69096194482' fiat_deposit_id: null fiat_withdrawal_id: null timestamp: '2018-02-26T23:14:08.435243Z' currency: 'ETH' type: 'exchange' action: 'trade' amount: '0.000543' balance: '0.050543' trade_id: '09619448-985d-4485-835e-b69096194482' deposit_id: null withdrawal_id: null fiat_deposit_id: null fiat_withdrawal_id: null timestamp: '2018-02-26T17:18:59.428914Z' currency: 'ETH' type: 'exchange' action: 'deposit' amount: '0.05' balance: '0.05' trade_id: null deposit_id: '09619448-985d-4485-835e-b69096194482' withdrawal_id: null fiat_deposit_id: null fiat_withdrawal_id: null
Get all balance history
let limit = 3; // Defaults to 20 if not specified, max 50. cobinhood;
Response
timestamp: '2018-02-27T03:11:45.132432Z' currency: 'ETH' type: 'exchange' action: 'withdraw' amount: '0.000543' balance: '0' trade_id: null deposit_id: null withdrawal_id: '09619448-985d-4485-835e-b69096194482' fiat_deposit_id: null fiat_withdrawal_id: null timestamp: '2018-02-26T23:14:08.435243Z' currency: 'COB' type: 'exchange' action: 'trade' amount: '100' balance: '2100' trade_id: '09619448-985d-4485-835e-b69096194482' deposit_id: null withdrawal_id: null fiat_deposit_id: null fiat_withdrawal_id: null timestamp: '2018-02-26T17:18:59.428914Z' currency: 'BTC' type: 'exchange' action: 'deposit' amount: '0.05' balance: '0.05' trade_id: null deposit_id: '09619448-985d-4485-835e-b69096194482' withdrawal_id: null fiat_deposit_id: null fiat_withdrawal_id: null
Get deposit addresses of a currency
cobinhood;
Response
address: '0xbcd7defe48a19f758a1c1a9706e808072391bc20' created_at: 1519234408062 currency: 'ETH' type: 'exchange'
Get all deposit addresses
cobinhood;
Response
address: '0xbcd7defe48a19f758a1c1a9706e808072391bc20' created_at: 1519234408062 currency: 'ETH' type: 'exchange' address: '0xbff7defe48a09619448e48a3bd73a4194f9020b3' created_at: 1519232304035 currency: 'BTC' type: 'exchange' ...
Get deposit's status
let depositId = '09619448-985d-4485-835e-b69096194482'; cobinhood;
Response
amount: '0.05' completed_at: 1519319949428 confirmations: 25 created_at: 1519319554624 currency: 'ETH' deposit_id: '09619448-985d-4485-835e-b69096194482' fee: '0' from_address: '0xFBb1b73C4f0BDa4f67dcA266ce6Ef42f520fBB98' required_confirmations: 25 status: 'tx_confirmed' txhash: '0x3f694510b9fca0ce645347be2525726473b541c86f5756de9ee693005d72bb23' user_id: 'efb9f645-f457-413b-b187-93cab09d8727'
Get all deposits
cobinhood;
Response
amount: '0.05' completed_at: 1519319949428 confirmations: 25 created_at: 1519319554624 currency: 'ETH' deposit_id: '09619448-985d-4485-835e-b69096194482' fee: '0' from_address: '0xFBb1b73C4f0BDa4f67dcA266ce6Ef42f520fBB98' required_confirmations: 25 status: 'tx_confirmed' txhash: '0x3f694510b9fca0ce645347be2525726473b541c86f5756de9ee693005d72bb23' user_id: 'efb9f645-f457-413b-b187-93cab09d8727' amount: '0.2' completed_at: 15193100495243 confirmations: 25 created_at: 1519319554624 currency: 'BTC' deposit_id: '74f6376d-985d-4485-835e-b69096194482' fee: '0' from_address: '0xFBb1b73C4f0BDa4f67dcA266ce6Ef42f520fBB98' required_confirmations: 25 status: 'tx_confirmed' txhash: '0x3f694510b9fca0ce645347be2525726473b541c86f5756de9ee693005d72bb23' user_id: 'efb9f645-f457-413b-b187-93cab09d8727' ...
Get withdrawal addresses of a currency
cobinhood;
Response
id: '6b01c8ac-3075-4ae5-a485-881d67Fe78fb' name: 'Seychelles' type: 'exchange' currency: 'ETH' address: '0xA6854dFD1BA0635f03a275ce9f3b310F52396673' created_at: 1519723240162
Get all withdrawal addresses
cobinhood;
Response
id: '6b01c8ac-3075-4ae5-a485-881d67Fe78fb' name: 'Seychelles' type: 'exchange' currency: 'ETH' address: '0xA6854dFD1BA0635f03a275ce9f3b310F52396673' created_at: 1519723240162 id: '6b01c8ac-3075-4ae5-a485-881d67Fe78fb' name: 'Wakanda' type: 'exchange' currency: 'BTC' address: '0xA6854dFD1BA0635f03a275ce9f3b310F52396673' created_at: 1519723240162 ...
Get withdrawal's status
let withdrawalId = '09619448-985d-4485-835e-b69096194482'; cobinhood;
Response
"withdrawal_id": "62056df2d4cf8fb9b15c7238b89a1438" "user_id": "62056df2d4cf8fb9b15c7238b89a1438" "status": "pending" "confirmations": 25 "required_confirmations": 25 "created_at": 1504459805123 "sent_at": 1504459805123 "completed_at": 1504459914233 "updated_at": 1504459914233 "to_address": "0xbcd7defe48a19f758a1c1a9706e808072391bc20" "txhash": "0xf6ca576fb446893432d55ec53e93b7dcfbbf75b548570b2eb8b1853de7aa7233" "currency": "BTC" "amount": "0.021" "fee": "0.0003"
Get all withdrawals
cobinhood;
Response
"withdrawal_id": "62056df2d4cf8fb9b15c7238b89a1438" "user_id": "62056df2d4cf8fb9b15c7238b89a1438" "status": "pending" "confirmations": 25 "required_confirmations": 25 "created_at": 1504459805123 "sent_at": 1504459805123 "completed_at": 1504459914233 "updated_at": 1504459914233 "to_address": "0xbcd7defe48a19f758a1c1a9706e808072391bc20" "txhash": "0xf6ca576fb446893432d55ec53e93b7dcfbbf75b548570b2eb8b1853de7aa7233" "currency": "BTC" "amount": "0.021" "fee": "0.0003" ...
Websockets
Get trade updates of a symbol
Returns two types of messages: "snapshot" and "update"
let channel = "type": 'trade' "trading_pair_id": 'COB-BTC';let reconnect = false; // Optional. Defaults to true if not specified. cobinhood;
Response (snapshot)
"channel_id": CHANNEL_ID "snapshot": TRADE_ID TIME_STAMP PRICE SIZE MAKER_SIDE ...
Response (update)
"channel_id": CHANNEL_ID "update": TRADE_ID TIME_STAMP PRICE SIZE MAKER_SIDE ...
Get order book updates of a symbol
Returns two types of messages: "snapshot" and "update"
let channel = "type": 'order-book' "trading_pair_id": 'COB-BTC' "precision": '1E-7' // Optional. Defaults to 1E-7 if not specified.;let reconnect = false; // Optional. Defaults to true if not specified. cobinhood;
Response (snapshot)
"channel_id": CHANNEL_ID "snapshot": "bids": PRICE SIZE COUNT ... "asks": PRICE SIZE COUNT ...
Response (update)
"channel_id": CHANNEL_ID "update": "bids": PRICE SIZE COUNT ... "asks": PRICE SIZE COUNT ...
Get ticker updates of a symbol
Returns two types of messages: "snapshot" and "update"
let channel = "type": 'ticker' "trading_pair_id": 'COB-BTC';let reconnect = false; // Optional. Defaults to true if not specified. cobinhood;
Response (snapshot)
"channel_id": CHANNEL_ID "snapshot": LAST_TRADE_ID PRICE HIGHEST_BID LOWEST_ASK 24H_VOLUME 24H_HIGH 24H_LOW 24H_OPEN TIME_STAMP
Response (update)
"channel_id": CHANNEL_ID "update": LAST_TRADE_ID PRICE HIGHEST_BID LOWEST_ASK 24H_VOLUME 24H_HIGH 24H_LOW 24H_OPEN TIME_STAMP
Get candle updates of a symbol
Returns two types of messages: "snapshot" and "update"
let channel = "type": 'candle' "trading_pair_id": 'COB-BTC' "timeframe": '5m' // Timeframes: 1m, 5m, 15m, 30m, 1h, 3h, 6h, 12h, 1D, 7D, 14D, 1M;let reconnect = false; // Optional. Defaults to true if not specified. cobinhood;
Response (snapshot)
"channel_id": CHANNEL_ID "snapshot": TIME OPEN CLOSE HIGH LOW VOL ...
Response (update)
"channel_id": CHANNEL_ID "update": TIME OPEN CLOSE HIGH LOW VOL ...
Get your's open orders updates
let channel = "type": 'order';let reconnect = false; // Optional. Defaults to true if not specified. cobinhood;
Response
"channel_id": CHANNEL_ID "update": ORDER_ID TRADING_PAIR_ID STATUS SIDE TYPE PRICE SIZE FILLED_SIZE TIME_STAMP
Subscribe to several websocket channels at once
You can subscribe to different types of channels and/or different symbols
let channels = "type": 'trade' "trading_pair_id": 'COB-BTC' "type": 'order-book' "trading_pair_id": 'COB-BTC' "precision": '1E-7' // Optional. Defaults to 1E-7 if not specified. "type": 'ticker' "trading_pair_id": 'COB-BTC' "type": 'candle' "trading_pair_id": 'COB-BTC' "timeframe": '5m' // Timeframes: 1m, 5m, 15m, 30m, 1h, 3h, 6h, 12h, 1D, 7D, 14D, 1M "type": 'order';let reconnect = false; // Optional. Defaults to true if not specified. cobinhood;
Todos
- Examples
- Logs