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

Package detail

bfx-api-mock-srv

bitfinexcom11Apache-2.01.6.0

Bitfinex API server mock library

bitfinex, bitcoin, BTC

readme

Bitfinex API Mock Server

This repo hosts mock servers for the WSv2 and RESTv2 Bitfinex APIs, and is intended for testing the Bitfinex API libraries.

Features

  • Provides realistic API responses for WSv2
  • Provides configurable responses for RESTv2
  • Allows for basic testing of API libraries without a live API connection

Installation

npm i --save bfx-api-mock-srv

Quickstart & Example

const assert = require('assert')
const debug = require('debug')('bfx:api:mock-srv:examples:endpoint-test')
const { MockRESTv2Server } = require('bfx-api-mock-srv')
const { RESTv2 } = require('bfx-api-node-rest')

debug('spawning mock server...')

const srv = new MockRESTv2Server({ listen: true })
const rest = new RESTv2({
  apiKey: 'dummy',
  apiSecret: 'dummy',
  url: 'http://localhost:9999',
})

const fundingOffer = [
  41215275, 'fUSD', 1524784806000, 1524784806000, 1000, 1000, 'FRRDELTAVAR',
  null, null, 0, 'ACTIVE', null, null, null, 0, 30, 0, 0, null, 0, 0.00207328
]

srv.setResponse('f_offers.fUSD', [fundingOffer])

debug('requesting preset response...')

rest.fundingOffers('fUSD').then(([incomingFundingOffer]) => {
  assert.deepStrictEqual(incomingFundingOffer, fundingOffer)

  debug('correct response received')
  srv.close()
}).catch((e) => {
  debug(`error: ${e.message}`)
})

Docs

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

1.6.0

  • feature: add weighted averages endpoint

1.5.0

  • feature: add invoice/currency/detailed endpoint for merchant

1.4.0

  • feature: add settings/convert/list endpoint for merchant
  • feature: add settings/convert/create endpoint for merchant
  • feature: add settings/convert/remove endpoint for merchant
  • feature: add settings/daily/limit endpoint for merchant
  • feature: add settings/set endpoint for merchant
  • feature: add settings/set/batch endpoint for merchant
  • feature: add settings/get endpoint for merchant
  • feature: add settings/list endpoint for merchant
  • feature: add invoice/refund endpoint for merchant
  • feature: add invoice/mark/refunded endpoint for merchant
  • feature: add invoice/events endpoint for merchant
  • feature: add currency/detailed endpoint for merchant
  • feature: add currency/list endpoint for merchant
  • feature: add invoice/update endpoint for merchant
  • feature: add invoice/create/pos endpoint for merchant
  • feature: add invoices/paginated endpoint for merchant
  • feature: add invoice/expire endpoint for merchant
  • feature: add deposits endpoint for merchant

1.3.0

  • feature: add movement info endpoint

1.2.0

  • feature: add delete token endpoint
  • feature: add unlinked deposits for merchant endpoint

1.1.6

  • feature: add core settings endpoint

1.1.5

  • feature: add complete invoice for merchant endpoint

1.1.4

  • feature: auth middleware

1.1.3

  • feature: add create invoice for merchant endpoint
  • feature: add list invoices for merchant endpoint

1.1.2

  • feature: add fx calc endpoint

1.1.1

  • feature: add order submit endpoint
  • feature: add auth permissions endpoint
  • feature: add pair info endpoint
  • feature: add currency tx fee endpoint
  • fix: fix account summary endpoint

1.1.0

  • feature: dynamic responses

1.0.17

  • feature: add map symbols endpoint
  • feature: add inactive currencies endpoint

1.0.16

  • feature: add generate token endpoint

1.0.15

  • feature: add set user settings endpoint
  • feature: add get user settings endpoint

1.0.14

  • meta: bump minimum node version to 7.6.0
  • meta: update all deps
  • meta: standardize eslint config
  • meta: replace istanbul w/ nyc
  • feature: improve JSDoc doclets
  • refactor: export MockServer

1.0.13

  • feature: add inactive symbols endpoint

1.0.12

  • feature: /v2/calc/trade/avg endpoint mock
  • feature: /v2/auth/w/deposit/invoice endpoint mock
  • feature: /v2/auth/w/funding/keep endpoint mock
  • feature: /v2/auth/w/order/cancel/multi endpoint mock
  • feature: /v2/auth/w/order/multi endpoint mock

1.0.11

  • feature: add margin symbols endpoint

1.0.10

  • feature: public pulse history rest2 endpoint
  • feature: private pulse history rest2 endpoint

1.0.9

  • feature: private delete pulse rest2 endpoint

1.0.8

  • feature: private add pulse rest2 endpoint

1.0.7

  • feature: add public pulse profile endpoint

1.0.6

  • feature: add positions snap endpoint

1.0.5

  • feature: add change logs endpoint

1.0.4

  • feature: add isOpen() to WSv2 mock server

1.0.3

  • feature: add account summary endpoint

1.0.2

  • feature: add logins endpoint

1.0.1

  • docs: create/update

1.0.0

  • manifest: bump version to move out of 0.x
  • manifest: set Bitfinex as author
  • manifest: populate contributors
  • add changelog
  • add readme
  • add issue/PR templates
  • add travis config
  • add temporary blank test so npm test passes

0.0.3

  • feature: add support for historical liqudidations endpoint
  • feature: add status message endpoint
  • fix: support dynamic keys on symbols/currencies/futures endpoints

0.0.2

  • feature: add derivative collateral set endpoint
  • feature: support sort arg on auth trades endpoint
  • feature: add symbols endpoint
  • feature: add futures symbols endpoint
  • feature: add ledgers endpoints
  • feature: add movements endpoints
  • feature: add orders history endpoint
  • feature: add trades history endpoint
  • feature: add user info endpoint
  • feature: add funding trades endpoint
  • feature: add offers history endpoint
  • feature: add loans history endpoint
  • feature: add credits history endpoint
  • feature: add currencies endpoint
  • feature: add public trades endpoint
  • feature: add wallets history endpoint
  • feature: add positions endpoint
  • feature: add positions audit endpoint
  • feature: add historical tickers endpoint
  • fix: rm /r/ from calc endpoint URL
  • fix: re-order paths by specificity

0.0.1

  • Initial version