0.6.21 • Published 2 months ago

node-api-bitrue v0.6.21

Weekly downloads
-
License
ISC
Repository
github
Last release
2 months ago

node-api-bitrue

WARNING: Due to lack of funds on Bitrue, only market data is available.

Non-official implementation of Bitrue's 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.

Ping and pong messages are built-in to the API. No user action required. When required, and if not set, timestamp parameters are automatically set by the API.

PUBLIC API

  const bitrue=require('node-api-bitrue');

  const publicAPI=new bitrue.publicApi();

Market Data

APIDESCRIPTION
getSymbolsDerivative from getExchangeInfo()
getCurrenciesDerivative from getExchangeInfo()
getKlines
getOrderBook
getRecentTrades
getHistTrades
getAggregatedTrades
getTicker
getLastPrice
getBookTicker

Other

APIDESCRIPTION
getExchangeInfo
getServerTime
sendPing

PRIVATE API

  const bitrue=require('node-api-bitrue');

  const auth = {
    apikey: 'MY_API_KEY',
    secret: 'MY_API_SECRET'
  };

  const privateAPI=new bitrue.privateApi(auth);

Account

APIDESCRIPTION
getAccountInfo
getBalancesDerivative from getAccountInfo() }
getFeesDerivative from getAccountInfo() }
getETFNetValue

Orders

APIDESCRIPTION
createOrderMay or may not work. Needs funding to finalize.
getOrderMay or may not work. Needs funding to finalize.
cancelOrderMay or may not work. Needs funding to finalize.
getActiveOrdersMay or may not work. Needs funding to finalize.
getOrdersMay or may not work. Needs funding to finalize.
getAccountTradesMay or may not work. Needs funding to finalize.

Deposit & Withdraw

APIDESCRIPTION
withdrawCommitMay or may not work. Needs funding to finalize.
getWithdrawals
getDeposits

WEBSOCKET API

  const bitrue=require('node-api-bitrue');

  const auth = {
    apikey: 'MY_API_KEY',
    secret: 'MY_API_SECRET'
  };

  const marketAPI=new bitrue.sockets.marketApi();
  marketAPI.setHandler('market.simple.depth.step0', (method,data,symbol,stamp) => { snapshotOrderBook(symbol,method,data,handler); });

  marketAPI.socket._ws.on('initialized', async () => {
    // do your own initialization, e.g. subscribe to orderbook
  });

  function snapshotOrderBook(symbol,method,data,handler) {
    // do something
  };

  const streamAPI=new bitrue.sockets.streamApi(auth);
  var res=await streamAPI.createListenKey();
  const token=res.data.listenKey;

  const accountAPI=new bitrue.sockets.userApi(auth,token);
  accountAPI.setHandler('executionReport', (symbol,method,data,option) => { updateOrder(symbol,method,data); });
  accountAPI.setHandler('BALANCE', (symbol,method,data,option) => { updateBalance(symbol,method,data); });

  accountAPI.socket._ws.on('authenticated', async () => {
    // do your own initialization, e.g. subscribe to updates
  });

  accountAPI.socket._ws.on('closed', async () => {
    // do something, like clean-up and reconnect
  });

  function updateOrder(symbol,method,data) {
    // do something
  };

  function updateBalance(symbol,method,data) {
    // do something
  };
APIHANDLERDESCRIPTION
subscribeOrderBook unsubscribeOrderBookmarket.simple.depth.step0Uses marketApi
createListenKeyUses streamAPI, calls renewListenKey at 20min intervals
renewListenKeyUses streamAPI
deleteListenKeyUses streamAPI
subscribeOrderUpdates unsubscribeOrderUpdatesexecutionReportUses accountApi
subscribeBalanceUpdates unsubscribeBalanceUpdatesBALANCEUses accountApi
0.6.21

2 months ago

0.6.20

2 months ago

0.6.19

3 months ago

0.6.18

3 months ago

0.6.17

3 months ago

0.6.16

3 months ago

0.6.10

7 months ago

0.6.12

7 months ago

0.6.11

7 months ago

0.6.13

7 months ago

0.6.7

8 months ago

0.6.6

8 months ago

0.6.9

8 months ago

0.6.8

8 months ago

0.6.5

8 months ago

0.6.4

8 months ago

0.6.3

8 months ago

0.6.2

8 months ago

0.6.1

8 months ago

0.6.0

8 months ago

0.1.0

9 months ago

0.0.1

9 months ago