Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

bfx-api-node-rest

bitfinexcom1.4kMIT6.0.0

Official Bitfinex REST v1 & v2 API interfaces

bitfinex, bitcoin, BTC

readme

Bitfinex RESTv1 & RESTv2 APIs for Node.JS

Build Status A Node.JS reference implementation of the Bitfinex REST APIs

To use, construct a new instance of either the RESTv1 or RESTv2 classes. All API methods return promises and accept a callback as the last parameter; the callback will be called with (error, response).

To minimize the data sent over the network the transmitted data is structured in arrays. In order to reconstruct key / value pairs, set opts.transform to true when creating an interface.

Features

  • Official implementation
  • REST v2 API
  • REST v1 API

Installation

  npm i --save bfx-api-node-rest

Quickstart

const { RESTv2 } = require('bfx-api-node-rest')
const rest = new RESTv2({ transform: true })

// do something with the RESTv2 instance

Docs

Documentation at https://docs.bitfinex.com/v2/reference

See docs/ for JSDoc generated documentation of available methods.

Example

const { RESTv2 } = require('bfx-api-node-rest')

const rest = new RESTv2({
  apiKey: '...',
  apiSecret: '...',
  authToken: '...', // optional, has priority over API key/secret
  url: '...',       // optional
  transform: true,  // to have full models returned by all methods
  agent: null,      // optional proxy agent
})

rest.candles({
  timeframe: '1m',
  symbol: 'tBTCUSD',
  query: {
    start: Date.now() - (24 * 60 * 60 * 1000),
    end: Date.now(),
    limit: 1000,
  }
}).then((candles) => {
  // ...
}).catch((err) => {
  console.log(err)
})

FAQ

nonce too small

I make multiple parallel request and I receive an error that the nonce is too small. What does it mean?

Nonces are used to guard against replay attacks. When multiple HTTP requests arrive at the API with the wrong nonce, e.g. because of an async timing issue, the API will reject the request.

If you need to go parallel, you have to use multiple API keys right now.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

changelog

6.0.0

  • RESTv2: remove pulse endpoints

5.6.0

  • RESTv2: updated jsdocs of v2/withdraw with latest params

5.5.0

  • RESTv2: recurring algo order list endpoint

5.4.0

  • RESTv2: recurring algo order endpoints

5.3.0

  • RESTv2: add getWeightedAverages method

5.2.0

  • RESTv2: add payCurrencyConversionList method
  • RESTv2: add payAddCurrencyConversion method
  • RESTv2: add payRemoveCurrencyConversion method
  • RESTv2: add payMerchantDailyLimit method
  • RESTv2: add payMerchantSettingsWrite method
  • RESTv2: add payMerchantSettingsWriteBatch method
  • RESTv2: add payMerchantSettingsRead method
  • RESTv2: add payMerchantSettingsList method

5.1.1

  • dep: upgraded bfx-api-node-models to 1.7.1 for compatibility

5.1.0

  • RESTv2: add movementInfo method

5.0.2

  • RESTv2: fix empty id array in movements hist

5.0.1

  • RESTv2: added address filter in movements hist
  • RESTv2: added endpoint for querying lnx invoices and payments

5.0.0

  • RESTv2: refactored methods in format (params, cb)
  • RESTv2: replaced request-promise and bluebird with native promises and node-fetch
  • RESTv2: added support for order transform on submitOrder and closePosition
  • RESTv1: replaced request with node-fetch

4.6.1

  • RESTv2: add submitRecurringAlgoOrder method
  • RESTv2: add getRecurringAlgoOrder method
  • RESTv2: add updateRecurringAlgoOrder method
  • RESTv2: add cancelRecurringAlgoOrder method
  • RESTv2: add getRecurringAlgoOrders method

4.6.0

  • RESTv2: add ability to set timeout for private requests and change value in extra option

4.5.0

  • RESTv2: add payDepositsUnlinked method
  • RESTv2: fix issue with wrong type in jsdocs for amount in transfer method

4.4.1

  • fixed dependency versions

4.4.0

  • RESTv2: add invalidateAuthToken method

4.3.1

  • RESTv2: Fix nullish (optional) parameters in requests

4.3.0

  • RESTv2: add getCoreSettings method

4.2.0

  • RESTv2: add payInvoiceComplete method

4.1.4

  • RESTv2: adjusted symbolDetails to return future pairs info, returns future pairs by default

4.1.3

  • RESTv2: fixed filtering out false writePermission in generateToken

4.1.2

  • RESTv2: fixed missing caps param in generateToken endpoint

4.1.1

  • RESTv2: adjusted jsdoc for required email field in payInvoiceCreate

4.1.0

  • RESTv2: add payInvoiceCreate method
  • RESTv2: add payInvoiceList method

4.0.0

  • RESTv2: removed RESTv1 usage inside RESTv2
  • RESTv2: removed _rest1
  • RESTv2: removed _makePublicLegacyRequest
  • RESTv2: removed _makeAuthLegacyRequest
  • RESTv2: removed accountInfo, accountSummary already exists in v2 integration
  • RESTv2: removed balances, wallets already exists in v2 integration
  • RESTv2: adjusted accountSummary to use official documented v2 endpoint, response format changed
  • RESTv2: upgraded symbolDetails to v2, response format changed
  • RESTv2: upgraded accountFees to v2, response format changed
  • RESTv2: upgraded keyPermissions to v2, response format changed
  • RESTv2: upgraded closePosition to v2, response format changed

3.1.0

  • RESTv2: add addPulseComment function
  • RESTv2: add fetchPulseComments function

3.0.19

  • RESTv2: add custip to generateToken function
  • Remove Babel

3.0.18

  • RESTv2: add walletFx to currencies function

3.0.17

  • RESTv2: marketAveragePrice test fixes

3.0.16

  • RESTv2: add marketAveragePrice function
  • RESTv2: add generateInvoice function
  • RESTv2: add keepFunding function
  • RESTv2: add cancelOrderMulti function
  • RESTv2: add orderMultiOp function
  • RESTv2: add submitOrderMulti function
  • RESTv2: add updateOrderMulti function
  • RESTv2: add cancelOrders function

3.0.15

  • RESTv2: add publicPulseHistory function
  • RESTv2: add private pulseHistory function

3.0.14

  • RESTv2: add private deletePulse function

3.0.13

  • RESTv2: add inactiveSymbols endpoint

3.0.12

  • RESTv2: add public pulse profile endpoint

3.0.11

  • RESTv2: add positionsSnaps function

3.0.10

  • RESTv2: adds changeLogs function

3.0.9

  • RESTv2: fix [cb] find/replace error to cb where appropriate

3.0.8

  • RESTv2: fixes cancelOrderWithCid function
  • RESTv2: removes cancelOrderWithDate function

3.0.7

  • meta: added JSDoc-generated HTML docs
  • meta: added husky pre-commit test hook
  • meta: standardized eslint config

3.0.6

  • RESTv2: adds cancelOrderWithCid function
  • RESTv2: adds cancelOrderWithDate function

3.0.5

  • RESTv2: adds orderHistoryWithIds function
  • RESTv2: adds activeOrdersWithIds function

3.0.4

  • RESTv2: added usesAgent() method
  • RESTv2: added getURL() method
  • RESTv2: default connection url now exposed on RESTv2.url

3.0.3

  • fix: refactor tests so they can run alongside all other HF/API library tests

3.0.2

  • RESTv2: add filters to ledgers

3.0.1

  • RESTv2: add logins

3.0.0

  • Hotfix: _takeResNotifyInfo return all notification info
  • restv2.withdraw returns notfication instead of just info

2.0.7

  • Fix: submitFundingOffer

2.0.6

  • Fix: Use correct endpoint for transfer

2.0.5

  • RESTv2: add affCode support

2.0.4

  • v2/rest/withdraw invalid url hotfix

2.0.3

  • manifest: switch to npm reg deps for bfx modules
  • readme: minor edit

2.0.2

  • hotfix circular deps error

2.0.1

  • docs: create/update

2.0.0

  • RESTv2: add submitOrder
  • RESTv2: add updateOrder
  • RESTv2: add cancelOrder
  • RESTv2: add claimPosition
  • RESTv2: add submitFundingOffer
  • RESTv2: add cancelFundingOffer
  • RESTv2: add closeFunding
  • RESTv2: add submitAutoFunding
  • RESTv2: add transfer
  • RESTv2: add getDepositAddress
  • RESTv2: add withdraw

1.1.4

  • manifest: bump deps
  • meta: add github issue/pr templates
  • meta: standardize travis config
  • meta: add example

1.1.3

  • RESTv2: add liquidations method

1.1.2

  • RESTv2: add derivsPositionCollateralSet method
  • RESTv2: add statusMessages method
  • manifest: bump deps

1.1.1

  • meta: ignore dist folder
  • RESTv1: add get/post debug logging
  • RESTv2: add get/post debug logging

1.1.0

  • bump minor due to changes in v1.0.10

1.0.10

  • RESTv2: add futures method
  • RESTv2 fix: add symbol to currencies list entries

1.0.9

  • RESTv2 refactor: add ability to fetch all funding trades to fundingTrades()

1.0.8

  • RESTv2 refactor: use v2 conf endpoint for symbols()
  • manifest: moved babel deps to dev-deps
  • meta: add .babelrc

1.0.7

  • RESTv2 fix: PositionHist model renamed to Position

1.0.6

  • RESTv2: add conf method
  • RESTv2: add generateToken method

1.0.5

  • RESTv2 fix: default req limit for tickersHistory, positionsHistory, positionsAudit
  • RESTv2 fix: typo in tickersHistory API URL generation
  • RESTv2 refactor: add currency option to walletsHistory

1.0.4

  • RESTv2: add tickersHistory method
  • RESTv2: add positionsHistory method
  • RESTv2: add positionsAudit method
  • RESTv2: add walletsHistory method

1.0.3

  • RESTv2: refactor internal callback handling

1.0.2

  • RESTv2: add orderBook method
  • manifest: add babel build for browser compatibility
  • manifest: use versioned bfx packages

1.0.1

  • RESTv2: add pool & explorer data to currencies()
  • manifest: rm bfx-api-node-core
  • meta: add jsdoc
  • meta: fill in README

1.0.0

  • Initial version