New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

bitfinex-api

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitfinex-api

Node.js client for the Bitfinex cryptocurrency exchange API.

latest
Source
npmnpm
Version
0.2.3
Version published
Maintainers
1
Created
Source

bitfinex-api

Bitfinex cryptocurrency exchange API wrapper for Node.js

Installation

yarn add bitfinex-api

Usage

Clients for both the v1 REST API and v1 streaming WebSocket API are included. Private endpoints as indicated in the API docs require authentication with an API key and secret key.

Example usage:

import BitfinexAPI from 'bitfinex-api';

const restClient = new BitfinexAPI({ key, secret });
const websocketClient =
  new BitfinexAPI.WebsocketClient({ key, secret });

restClient.getOrderBook('BTCUSD', { limit_asks: 10, limit_bids: 10 })
  .then(console.log)
  .catch(console.error);

websocketClient.openSocket(() => {
  websocketClient.addMessageListener(data =>
    doSomethingCool(data)
  );
  websocketClient.subscribeToChannel({
    channel: 'trades',
    pair: 'BTCUSD',
  })
})

// The methods are bound properly, so feel free to destructure them:
const { getTicker } = restClient;
getTicker('btcusd')
  .then(data =>
    console.log(`Last trade: $${data.last} / BTC`)
  )

API

REST

  • All methods return promises.
  • getAllSymbols()
  • getAllSymbolsDetails()
  • getTicker(symbol)
  • getStats(symbol)
  • getOrderBook(symbol, params = {})
  • getFundingBook(currency, params = {})
  • getTradeHistory(symbol, params = {})
  • getLendHistory(currency, params = {})
  • getAccountInfo()
  • getSummary()
  • getDepositAddress({ method, wallet_name, ...params } = {})
  • getKeyPermissions()
  • getMarginInfo()
  • getWalletBalances()
  • transferBetweenWallets({ amount, currency, walletfrom, walletto } = {})
  • withdrawFunds(params = {})
  • newOrder(params = {})
  • multipleNewOrders(orders = [])
  • cancelOrder({ order_id } = {})
  • cancelMultipleOrders(orders = [])
  • cancelAllActiveOrders()
  • replaceOrder({ order_id, ...params } = {})
  • getMyOrderStatus({ order_id } = {})
  • getMyActiveOrders()
  • getMyActivePositions()
  • claimMyPosition({ amount, position_id })
  • getMyBalanceHistory({ currency, ...params })
  • getMyDepositWithdrawalHistory({ currency, ...params })
  • getMyPastTrades({ symbol, timestamp = beginningOfTime, ...params } = {})
  • newOffer(params = {})
  • cancelOffer({ order_id })
  • getMyOfferStatus({ order_id })
  • getMyActiveCredits()
  • getMyActiveOffers()
  • getMyTakenUsedFunds()
  • getMyTakenUnusedFunds()
  • getMyTotalTakenFunds()
  • closeFunding({ swap_id })

WebSocket

  • openSocket(onOpen)
  • addMessageListener(listener)
  • removeMessageListener(listener)
  • addListener(event, listener)
  • removeListener(event, listener)
  • subscribeToChannel({ channel, ...params })
  • unsubscribeFromChannel(chanId)

To Do

  • Tests (I've started on this)
  • Improved documentation
  • More robust error handling

Feedback and pull requests welcome!

FAQs

Package last updated on 08 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts