1.1.1 • Published 6 years ago

zarb-apis-tmp v1.1.1

Weekly downloads
1
License
MIT
Repository
gitlab
Last release
6 years ago

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
1.1.1

6 years ago

1.1.0

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.1.0

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago