Using Nodejs Library
Connect with CAYC Exchange using Hollaex kit Nodejs Library
Requirements
Knowledge of basic usage of nodejs and npm
Nodejs version >= 12
Install hollaex-node-lib by running
npm i hollaex-node-lib
oryarn add hollaex-node-lib
in your project
Usage
Connecting with any Hollaex Kit Enabled Exchange is pretty much same, with minor modifications you can connect to all the exchanges that uses similar Hollaex Kit backends.
Import Library
Put Api Key for <MY_API_KEY>
& Api Secret for <MY_API_SECRET>
in above code that you can get from the guide.
Request structure
Available methods
Optional parameters are all contained within an object parameter called
opts
getKit
Get exchange information e.g. name, valid languages, description, etc.
getConstants
Tick size, min price, max price, min size and max size of each symbol pair and coin
getTicker
symbol
Last, high, low, open and close price and volume within the last 24 hours
getTickers
Last, high, low, open and close price and volume within the last 24 hours for all symbols
getOrderbook
symbol
Orderbook containing list of bids and asks
getOrderbooks
Orderbook containing list of bids and asks for all symbols
getTrade
symbol (optional)
List of last trades
getUser
User’s personal information
getBalance
User’s wallet balance
getDeposits
currency (optional), limit (optional, default=50
, max=100
), page (optional, default=1
), orderBy (optional, default=id
), order (optional, default=asc
, asc
or desc
), startDate (optional, default=0
, format=ISO8601
), endDate (optional, default=NOW
, format=ISO8601
)
User’s list of all deposits
getWithdrawals
currency (optional), limit (optional, default=50
, max=100
), page (optional, default=1
), orderBy (optional, default=id
), order (optional, default=asc
, asc
or desc
), startDate (optional, default=0
, format=ISO8601
), endDate (optional, default=NOW
, format=ISO8601
)
User’s list of all withdrawals
requestWithdrawal
currency, amount, address (receipient’s)
Create a new withdrawal request. Disable Two-Factor Authentication to be able to use this function. Must confirm within 5 minutes via email to complete withdrawal
getUserTrades
symbol (optional), limit (optional, default=50
, max=100
), page (optional, default=1
), orderBy (optional, default=id
), order (optional, default=desc
, asc
or desc
), startDate (optional, default=0
, format=ISO8601
), endDate (optional, default=NOW
, format=ISO8601
)
User’s list of all trades
getOrder
orderId
Get specific information about a certain order
getOrders
symbol (optional), limit (optional, default=50
, max=100
), page (optional, default=1
), orderBy (optional, default=id
), order (optional, default=desc
, enum=asc
, desc
), startDate (optional, default=0
, format=ISO8601
), endDate (optional, default=NOW
, format=ISO8601
)
Get the list of all user orders. It can be filter by passing the symbol
createOrder
symbol, side (buy
or sell
), size, type (market
or limit
), price, stop (optional), meta (optional, object with optional properties e.g. post_only
)
Create a new order
cancelOrder
orderId
Cancel a specific order with its ID
cancelAllOrders
symbol (optional)
Cancel all open order. It can be filter by passing the symbol
CAYC Exchange is based on the Hollaex Kit Enabled Exchange so you can read about more for API usage, instructions & examples from Github Repo
Websocket client
To create custom websocket client, Please visit the guide, This guide uses
hollaex-node-lib
and assumes that you have already configured your code to assignclient
variable/constant (as shown above) before trying this.
To make a connection:
To disconnect it:
Channel subscriptions
You can subscribe to following channels
orderbook
trades
order (Only available with authentication. Receive order updates)
wallet (Only available with authentication. Receive balance updates)
Listen to events
After connection, You can listen for these events from the server by using on method, e.g.
message
open
close
error
unexpected-response etc.
Example
Resources
Node Library Usage instructions: https://github.com/bitholla/hollaex-node-lib/tree/2.0#usage
Using Websockets from node library to connect: https://github.com/bitholla/hollaex-node-lib/tree/2.0#websocket
Create custom websocket client: https://github.com/bitholla/hollaex-kit/tree/documentation/server#usage
Last updated