node-api-cryptocom
Non-official implementation of Crypto.com's Exchange API's. Developed for personal use.
For support on using the API's or development issues, please refer to the official API documentation. For questions regarding this package, please consult the code first.
PUBLIC API
const cryptocom=require('node-api-cryptocom');
const publicAPI=new cryptocom.publicApi();
Market Data
PRIVATE API
const cryptocom=require('node-api-cryptocom');
const auth = {
apikey: 'MY_API_KEY',
secret: 'MY_API_SECRET'
};
const privateAPI=new cryptocom.privateApi(auth);
Account Balance and Position API
Trading API
Advanced Order Management API
Order, Trade, Transaction History API
Wallet API
WEBSOCKET API
const cryptocom=require('node-api-cryptocom');
const auth = {
apikey: 'MY_API_KEY',
secret: 'MY_API_SECRET'
};
const marketAPI=new cryptocom.sockets.marketApi();
marketAPI.socket._ws.on('initialized', async () => {
// do your own initialization
});
const privateAPI=new cryptocom.sockets.privateApi(auth);
privateAPI.setHandler('user.order', (method,data,symbol,option) => { updateOrders(method,data,user,api,handler); });
privateAPI.socket._ws.on('authenticated', async () => {
const res=await privateAPI.subscribeOrders();
});
privateAPI.socket._ws.on('closed', async () => {
// do something, like clean-up and reconnect
});
function updateOrders(method,orders,user,api,handler) {
// do something
};
Websocket Market API
Socket Authentication
API | DESCRIPTION |
---|---|
login | https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-auth |
setHandler | |
setCancelOnDisconnect | https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-set-cancel-on-disconnect |
getCancelOnDisconnect | https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-cancel-on-disconnect |
Websocket User API
API | HANDLER | DESCRIPTION |
---|---|---|
subscribeOrders unsubscribeOrders | user.order | https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#user-order-instrument_name |
subscribeMyTrades unsubscribeMyTrades | user.trade | https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#user-trade-instrument_name |
subscribeSpotBalances unsubscribeSpotBalances | user.balance | https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#user-balance |
subscribePositions unsubscribePositions | user.positions | https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#user-positions |
subscribeRiskStatus unsubscribeRiskStatus | user.account_risk | https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#user-account_risk |
subscribePositionBalances unsubscribePositionBalances | user.position_balance | https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#user-position_balance |
Socket Account Balance and Position API
API | DESCRIPTION |
---|---|
getSpotBalance | https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-user-balance |
getPositions | https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-positions |
Trading API
Advanced Order Management API
Wallet API
API | DESCRIPTION |
---|---|
createWithdrawal | https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-withdrawal |
getWithdrawalHistory | https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-withdrawal-history |