GithubHelp home page GithubHelp logo

bfx-api-node-util's Introduction

Bitfinex API Utilities for Node.JS

Build Status

This repo contains minor utilities shared by the Bitfinex Node.JS API libraries.

Features

  • prepareAmount and preparePrice for making values API-compatible
  • nonce generator function
  • padCandles for handling gaps in candle data returned by the Bitfinex APIs

Installation

npm i --save bfx-api-node-util

Quickstart

const { nonce } = require('bfx-api-node-util')
const n = nonce()

// n is ready to be passed to API requests, or used as order CIDs, etc

Docs

Refer to docs/func_docs.md for JSDoc-generated API documentation

Example: Padding Candles

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

const candles = await rest.candles({
  symbol: 'tBTCUSD',
  timeframe: '1m',
})

const paddedCandles = padCandles(candles, 60 * 1000)

// paddedCandles are ready to be used for processing where 0-volume candles are required

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

bfx-api-node-util's People

Contributors

avsek477 avatar ezewer avatar f3rno avatar gabrielcolson avatar prdn avatar robertkowalski avatar tarcisiozf avatar vigan-abd avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

bfx-api-node-util's Issues

Lodash is used without being added to the dependencies

Issue type

  • bug
  • missing functionality
  • performance
  • feature request

Brief description

Lodash is imported without being added to the dependencies. This behavior is unsafe and yarn's Plug’n’Play feature doesn’t allow it.

Steps to reproduce

// test.js
require('bfx-api-node-util');
npm install -g yarn
yarn init -y
yarn set version berry
yarn add bfx-api-node-util
yarn node test.js
Additional Notes:

Lodash is used at only one place and there is a native alternative. A better solution than adding lodash to the dependencies would be to use Array.reverse() instead.

Invalid 'main' field in package.json' of './dist/index.js'.

Issue type

  • bug
  • missing functionality
  • performance
  • feature request

Brief description

Entry main in package.json points to nonexistent file ./dist/index.js.

node.js 16.0 issues warning:
[DEP0128] DeprecationWarning: Invalid 'main' field in 'node_modules\bfx-api-node-util\package.json' of './dist/index.js'.

Steps to reproduce

Check package.json
To see the warning, use the module in node.js 16.0.

Additional Notes:

Cannot find module 'bfx-api-node-models' in v1.0.4

Issue type

  • [ X ] bug

Brief description

Use package "bfx-api-node-models" in lib/res_notification_info.js which is located in devDependencies.

It will be broken when you use it in production (will not install devDependencies XD).

NPM issue

I'm having problems deploying an app to google cloud functions which contains Bitfinex NPM dependencies. I just noticed this error in my build and think it's related (but don't know enough about NPM to track it down - sorry!).

warning Pattern ["bfx-api-node-util@git+http://github.com/bitfinexcom/bfx-api-node-util.git#semver:^1.0.4"] is trying to unpack in the same destination "/Users/.../Library/Caches/Yarn/v4/npm-bfx-api-node-util-1.0.4-e1eeda2da78ac0bfa43d7d5d9598e1973e286b58/node_modules/bfx-api-node-util" as pattern ["bfx-api-node-util@git+http://github.com/bitfinexcom/bfx-api-node-util.git#semver:^1.0.2"]. This could result in non-deterministic behavior, skipping.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.