npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bitbay-api-node

v1.0.3

Published

BitBay module for connecting to REST API.

Downloads

8

Readme

BitBay REST API for Node.js

Build Status Greenkeeper badge

See full description at https://docs.bitbay.net/v3.2.0/reference

Installation

  npm i bitbay-api-node

Usage

The BBA constructor receive public and private key using to authentication.

const BBA = require('bitbay-api-node');

const api = new BBA('22345f6f-1b1d-1234-a973-a10b1bdba1a1', '78539fe0-e9b0-4e4e-8c86-70b36aa93d4f');

You can also execute constructor without parameters and feel free to get public endpoints.

const BBA = require('bitbay-api-node');

const api = new BBA();
api.ticker();

Public endpoints

const BBA = require('bitbay-api-node');

const api = new BBA();

// Get ticker from BTC-EUR market
api.ticker('BTC-EUR');

// Get orderbook from LSK-PLN market
api.orderbook('LSK-PLN');

// Get last 10 transactions on BTC-USD market from last 3 minutes
api.transactions('BTC-USD', { limit: 10, fromTime: 1531407461 } );

// Get 30 minutes candles from last 4 hours
api.candles('BTC-PLN', 1800, { fromTime: 1544158620, toTime: 1544173061 } );

Private endpoints

Trading

const BBA = require('bitbay-api-node');

const api = new BBA('22345f6f-1b1d-1234-a973-a10b1bdba1a1', '78539fe0-e9b0-4e4e-8c86-70b36aa93d4f');

// We want to buy 1 Bitcoin for 4000$ on BTC-USD market and offer will be hidden
api.newOffer('BTC-USD', { amount: 1, rate: 1, offerType: 'buy', mode: 'limit', hidden: true } );

// Let's get active offers from every market
api.getOffers();

// Remove an offer
api.cancelOffer('BTC-USD', '82ca35da-6eeb-4f30-91bb-165fdcf4d8b2', 'buy', 4000);

// Get our trading fees on BTC-PLN market (default)
api.getConfig();

// Change default wallets to trade on BTC-USD
api.changeConfig('BTC-USD', { first: '455b3f25-8d3a-409f-9fe6-8cc40f1ce533', second: '455b3f25-8d3a-509f-9fe6-8cc40f1ce542' } );

Deposit and withdrawal

// Get our address to deposit cryptocurrency on specified wallet
api.getCryptoAddress('455b3f25-8d3a-409f-9fe6-8cc40f1ce533');

// Generate new cryptocurrency address on specified wallet
api.getNewAddress('455b3f25-8d3a-409f-9fe6-8cc40f1ce533', { currency: 'PLN' } );

// Get all historical addresses from specified wallet
api.getHistoricalAddresses('455b3f25-8d3a-409f-9fe6-8cc40f1ce533');

// Let's send some Bitcoins
api.withdrawCrypto('455b3f25-8d3a-409f-9fe6-8cc40f1ce533', { address: '3Qck3sNnAe5YVLe9WDzMp3aK2cgsU7F5Wv', amount: 0.5, comment: 'test' } );

// Get address to deposit USD
api.getFiatAddress('USD');

// Time for withdraw our USD
api.withdrawFiat('455b3f25-8d3a-409f-9fe6-8cc40f1ce655', 'USD', { bank_account_number: 'PL82154012872216000073790002', address: 'Ul. Puławska 111A/109, 02-707 Warszawa', name: 'Igoria Trade S.A.', title: 'VVVe94d7e43536fVVV', swift: 'EBOSPLPWXXX' } );

History

// Get transactions history for buy transactions from BTC-PLN where rate is from 23000 to 25000
api.getTransactionsHistory( { markets: ['BTC-PLN'], rateFrom:23000, rateTo: 25000, userAction: 'buy', nextPageCursor: 'start' } );

// Get 20 last historical operations on XMR wallets and sort descending by time
api.getOperationsHistory( { "balanceCurrencies":["XMR"], "limit":"20", "sort":[{"order":"DESC","by":"time"}], "nextPageCursor":"start"});

Manage wallets

// Get list of all wallets
api.getWallets();

// Create a new wallet for Bitcoin
api.newWallet( { currency: 'BTC', type: 'crypto', name: 'trading' } );

// I think that was a bad name, let's change it
api.changeWalletName('455b3f25-8d3a-409f-9fe6-8cc40f1ce533', { name: 'arbitration' } );

// Send some cryptocurrency over our wallets
api.internalTransfer('455b3f25-8d3a-409f-9fe6-8cc40f1ce533', '455b3f25-8d3a-409f-9fe6-8cc40f1ce534', { currency: 'BTC', funds: 0.4 } );