Modernized fork of the official Bitfinex API Node.js library with updated dependencies, Node.js 20+ support, and enhanced development experience.
- Node.js 20+ minimum requirement
- All 47 dependencies updated to latest versions
- Enhanced npm scripts for better development experience
- Comprehensive .env configuration system
- Complete technical documentation and improvement roadmap
- Fixed critical ws v8+ compatibility issue
- Improved WebSocket message handling
- Better error handling and debugging
- Zero linting errors with updated standards
- 228 tests passing with enhanced validation
TECHNICAL-REVIEW.md
- Complete code analysisIMPROVEMENT-PROPOSALS.md
- Future enhancement roadmapENV-SETUP.md
- Configuration guideMODERNIZATION.md
- Detailed changelog
# Configure npm to use GitHub Package Registry for @jcbit scope
echo "@jcbit:registry=https://npm.pkg.github.com" >> ~/.npmrc
# Install the package
npm install @jcbit/bitfinex-api-node
- Node.js: β₯20.0.0
- npm: β₯10.0.0
const { BFX } = require("@jcbit/bitfinex-api-node");
// REST API
const bfx = new BFX({
apiKey: process.env.API_KEY,
apiSecret: process.env.API_SECRET,
transform: true,
});
const rest = bfx.rest(2);
// Get ticker
rest.ticker("tBTCUSD").then((ticker) => {
console.log("BTC/USD:", ticker);
});
// WebSocket API
const ws = bfx.ws(2);
ws.on("open", () => {
console.log("Connected to Bitfinex WebSocket");
ws.subscribeTicker("tBTCUSD");
});
ws.onTicker({ symbol: "tBTCUSD" }, (ticker) => {
console.log("Ticker update:", ticker);
});
ws.open();
Create a .env
file in your project root:
# Copy the example configuration
cp node_modules/@jcbit/bitfinex-api-node/.env.example .env
# Edit with your credentials
API_KEY=your_api_key_here
API_SECRET=your_api_secret_here
See ENV-SETUP.md
for complete configuration options.
This is a modernized fork of the official bitfinex-api-node
with:
Feature | Original | This Fork |
---|---|---|
Node.js | β₯16.0.0 | β₯20.0.0 |
Dependencies | Outdated | All updated (47 deps) |
ws Library | v7 (broken) | v8+ (fixed) |
Configuration | Manual | .env + guide |
Documentation | Basic | Comprehensive |
Development | Limited | Enhanced scripts |
Testing | Basic | Validated + examples |
# Development
npm run dev # Start with nodemon
npm run test:watch # Run tests in watch mode
# Testing
npm test # Run linter + tests
npm run unit # Run unit tests only
npm run lint # Run linter
npm run lint:fix # Fix linting issues
# Documentation
npm run docs # Generate JSDoc documentation
npm run docs:serve # Serve docs on localhost:8080
# Maintenance
npm run clean # Clean node_modules
npm run fresh-install # Clean install
This package maintains 100% compatibility with the original Bitfinex API. All methods, events, and functionality work exactly the same.
- Account management (wallets, positions, orders)
- Market data (tickers, trades, order books)
- Trading operations (submit, cancel, modify orders)
- Funding (loans, credits, offers)
- Real-time market data
- Account updates
- Order management
- Custom calculations
For detailed API documentation, see the official Bitfinex docs.
All functionality has been thoroughly tested:
- β 228 unit tests passing
- β All REST endpoints verified
- β WebSocket connections validated
- β Public examples tested
- β Authenticated examples verified with real API keys
- β Zero linting errors
See IMPROVEMENT-PROPOSALS.md
for detailed enhancement plans:
- TypeScript migration for better DX
- Smart reconnection with exponential backoff
- Enhanced error handling with typed errors
- Connection pooling for REST optimization
- Debug dashboard for real-time monitoring
- CLI tools for development and testing
This is a personal fork focused on modernization. For issues with the core API functionality, please refer to the official repository.
For modernization-specific issues or suggestions:
- Check existing issues
- Create a new issue with detailed description
- PRs welcome for bug fixes and improvements
MIT License - see LICENSE.md
- Original Library: Bitfinex Team
- Modernization: JC
- All Contributors: See package.json contributors list
π Links: