How to use the binance-api-node function in binance-api-node

To help you get started, we’ve selected a few binance-api-node examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github andrewmahoneyf / CryptoBot / api / binance.js View on Github external
import 'dotenv/config';
import Binance from 'binance-api-node';

/* Authenticated client, can make signed calls */
export const client = Binance({
  apiKey: process.env.API_KEY,
  apiSecret: process.env.API_SECRET,
});

/* Public REST Endpoints */

// Get the current exchange trading rules and symbol information.
export const exchangeInfo = client.exchangeInfo();
// Get the order book for a symbol.
export const book = (symbol, limit = 5) => client
  .book({ symbol, limit })
  .then(res => res)
  .catch(error => error);
// Retrieves Candlestick for a symbol. Candlesticks are uniquely identified by their open time.
export const candles = (symbol, interval = '1h', limit = 500) => client
  .candles({ symbol, interval, limit })
github tony-ho / binance-oco / src / binance-oco.ts View on Github external
throw result.error;
  }

  const { pair, cancelPrice, nonBnbFees } = options;

  let {
    amount,
    buyPrice,
    buyLimitPrice,
    stopPrice,
    stopLimitPrice,
    targetPrice,
    scaleOutAmount
  } = options;

  const binance = Binance({
    apiKey: process.env.APIKEY || "",
    apiSecret: process.env.APISECRET || ""
  });

  let isCancelling = false;

  const cancelOrderAsync = async (
    symbol: string,
    orderId: number
  ): Promise => {
    if (!isCancelling) {
      isCancelling = true;
      try {
        const response = await binance.cancelOrder({ symbol, orderId });

        debug("Cancel response: %o", response);
github cryptocontrol / algo-trading-server / src / exchanges / Binance.ts View on Github external
startListening (): void {
    const client = BinanceApi()
    client.ws.trades(['BTCUSDT'], trade => this.onPriceUpdate('BTCUSDT', Number(trade.price)))
  }

binance-api-node

A node API wrapper for Binance

MIT
Latest version published 7 months ago

Package Health Score

64 / 100
Full package analysis

Popular binance-api-node functions

Similar packages