0.1.14 • Published 5 months ago
node-api-coinbase v0.1.14
node-api-coinbase
WARNING: This package is still early beta! Expect breaking changes until this sees a major release.
Non-official implementation of Coinbase's Advanced Trade 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
Nothing here
PRIVATE API
const coinbase=require('node-api-coinbase');
const auth = {
apikey: 'MY_API_KEY',
secret: 'MY_API_SECRET'
};
const privateAPI=new coinbase.privateApi(auth);
Accounts
Orders
Products
Fees
API | DESCRIPTION |
---|---|
getTransactions | https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_gettransactionsummary |
Convert
WEBSOCKET API
const coinbase=require('node-api-coinbase');
const auth = {
apikey: 'MY_API_KEY',
secret: 'MY_API_SECRET'
};
const tradingAPI=new coinbase.sockets.tradingApi(auth);
tradingAPI.setHandler('user.snapshot', (method,data,symbol,option) => { updateOrder(method,data.orders,user,api,handler); });
tradingAPI.setHandler('user.update', (method,data,symbol,option) => { updateOrder(method,data.orders,user,api,handler); });
tradingAPI.socket._ws.on('authenticated', async () => {
await tradingAPI.subscribeUser(['ETH-BTC','BTC-USDT']);
});
tradingAPI.socket._ws.on('closed', async () => {
// do something, like clean-up and reconnect
});
function updateOrder(symbol,method,data) {
// do something
};