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.
const cryptocom=require('node-api-cryptocom');
const publicAPI=new cryptocom.publicApi(); const cryptocom=require('node-api-cryptocom');
const auth = {
apikey: 'MY_API_KEY',
secret: 'MY_API_SECRET'
};
const privateAPI=new cryptocom.privateApi(auth); 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
};| 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 |
| 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 |
| 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 |
| 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 |