zarb-apis-tmp

1.1.1 • Public • Published

zarb-apis

Standardised project that deals with multiple crypto-apis.

Usage

const exchanges = require('XXX').exchanges;
const exchange = new exchanges[KEY]();

new Exchange({ apiKey: String; apiSecret: String })

Public Methods

apiKey and apiSecret are optional for these methods

exhange.depth(options, callback)

Returns a full orderBook every n ms
Will keep an internal diff orderbook if neccesary

  • options {Object}
    • pairs { String[] } Format 'ETH/BTC'
    • [depth = 5] { Number } Depth of orderbook
  • callback {(err, data) => void}
    • data - {
      pair: String;
      ts: Number; // unix timestamp in ms
      bids: { p: String; q: String; }[],
      asks: { p: String; q: string; }[],
      }
  • returns { stop: () => void }

exchange.tick(options, callback)

Todo

exchange.trades(options, callback)

Todo

exchange.exchangeInfo(options) => Promise

Info for minQuantites and precision. Fees can't be included here since it sometimes depends on user account

  • options { Object }
  • returns - {
    pairs: { [pair: String]: { minQuantity: Number, precision: Number }
    } }

Private Methods

apiKey and secretKey are needed for these methods

exchange.balance(options) => Promise

  • options { Object }
  • returns - { [coin: String]: {trade: Number; freeze: Number} }

exchange.addOrder(options) => Promise

  • options { Object }
    • type { String } - market/limit
    • side { String } - BUY/SELL
    • pair { String }
    • quantity { String | Number }
    • [price] { String | Number } - Required for type 'limit'
  • returns { Number }

exchange.cancelOrder(options) => Promise

  • options { Object }
    • id { String }
  • returns { void }

exchange.fees(options) => Promise

  • options { Object }
  • returns { [pair: String]: {maker: Number; taker: Number] }

exchange.getOpenOrders(options) => Promise

  • options { Object }
    • page { { size: Number; number: Number } }
  • returns {{
    pair: String;
    orderId: String;
    price: String;
    quantity: String;
    quantityFilled: String;
    type: String; // MARKET | LIMIT
    side: String; // BUY | SELL
    time: Number; // ms unix timestamp
    status: String; // OPEN | CLOSED
    }[]};

exchange.getClosedOrders(options) => Promise

  • options { Object }
    • page { { size: Number; number: Number } }
  • returns { Object[] } - see getOpenOrders

exchange.getOrder(id, options) => Promise

  • id { String }
  • options { Object } - Exchange specific options
  • returns { Object } - see getOpenOrders, only difference is that this will not return an array

exchange.getOrders(ids, options) => Promise

This may not be implemented for all exchanges.

  • ids { String[] }
  • options { Object } - Exchange specific options
  • returns { Object[] } - see getOpenOrders

Readme

Keywords

Package Sidebar

Install

npm i zarb-apis-tmp

Weekly Downloads

21

Version

1.1.1

License

MIT

Unpacked Size

93 kB

Total Files

39

Last publish

Collaborators

  • argelius