Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
bitcoinaverage
Advanced tools
This library enables quick and easy access to our Bitcoin, Ethereum, Litecoin, Ripple and other cryptocurrency exchange rates.
npm install bitcoinaverage
Get your public and private keys from our website and you are ready to run these examples.
const ba = require('bitcoinaverage');
var publicKey = 'yourPublicKey';
var restClient = ba.restfulClient(publicKey);
var wsClient = ba.websocketClient(publicKey);
The response received by https://apiv2.bitcoinaverage.com/indices/global/ticker/BTCUSD.
The symbol_set can be one of: local, global, crypto and tokens.
The symbol can be any pair from our Full symbol list
var symbol_set = 'global';
var symbol = 'BTCUSD';
restClient.getTickerDataPerSymbol('global', 'BTCUSD', function(response) {
console.log(response);
}, function(error){
console.log(error);
}) ;
restClient.perExchangeData('bitstamp',
function(response){
console.log(response);
},
function(err){
console.log(err);
});
restClient.allExchangeDataForSymbol('BTCGBP',
function(response){
console.log(response);
},
function(err){
console.log(err);
});
Connect to one of our websocket endpoints and get real-time updates for the Bitcoin Global Price Index.
wsClient.connectToTickerWebsocket('global', 'BTCUSD', function(response) {
console.log(response);
}, function(error){
console.log(error)
}, function(){
console.log("websocket closed");
});
Enterprise users can access our new and improved version 2 of our Websocket API. It provides faster updates and supports multiple symbols in a single connection.
wsClient.connectToTickerWebsocketV2('tokens', ['OMGETH', 'EOSBTC'], function(response) {
console.log(response);
}, function(error){
console.log(error)
}, function(){
console.log("websocket closed");
});
var symbols = ['BTCUSD', 'ETHUSD'];
var exchange = 'bitfinex';
var ORDERBOOKS = {
BTCUSD: {},
ETHUSD: {}
};
var symbol = '';
ws.connectToOrderbookWebsocket(exchange, symbols, function(response){
symbol = respnose.data.symbol;
if(response.data.type === "snapshot"){
ORDERBOOKS[symbol].asks = response.data.asks;
ORDERBOOKS[symbol].bids = response.data.bids;
}else{
console.log(response.data.updates);
for (var i = 0; i < response.data.updates.length; i++){
var item = response.data.updates[i];
if(item.amount === 0){
delete(ORDERBOOKS[symbol][item.side][item.price]);
}else{
ORDERBOOKS[symbol][item.side][item.price] = item;
}
}
}
}, function(err){
console.log(err);
});
The latest version of our websocket module is available via our Grow and Dominate plans as well as the legacy Enterprise users.
Our version 3 builds on top of version 2 with added improvements in reliability, speed and flexibility.
wsClient.connectToTickerWebsocketV3('global', ['BTCUSD', 'BTCEUR', 'BTCGBP'], function(response) {
console.log("Success", response);
}, function(error){
console.log(error)
}, function(){
console.log("websocket closed");
});
Version 3 of our exchange websocket channel allows you to subscribe only to the symbols you need from a particular exchange.
wsClient.connectToOrderbookWebsocketV3('coinbasepro', ['BTCUSD', 'LTCEUR', 'ETHBTC'], function(response) {
console.log("Success", response);
}, function(error){
console.log(error)
}, function(){
console.log("websocket closed");
});
Subscribe to live orderbook updates from multiple symbols from single exchange.
Supported exchanges are: Coinbasepro, Bitstamp, Bitfinex, Binance, Bittrex and Kraken.
wsClient.connectToOrderbookWebsocketV3('coinbasepro', ['BTCUSD', 'LTCEUR', 'ETHBTC'], function(response) {
console.log("Success", response);
}, function(error){
console.log(error)
}, function(){
console.log("websocket closed");
});
Subscribe to live trades updates from multiple symbols from single exchange.
Supported exchanges are: Coinbasepro, Bitstamp, Bitfinex, Binance, Bittrex and Kraken.
wsClient.connectToTradesWebsocketV3('coinbasepro', ['BTCUSD', 'LTCEUR', 'ETHBTC'], function(response) {
console.log("Success", response);
}, function(error){
console.log(error)
}, function(){
console.log("websocket closed");
});
FAQs
Official library of BitcoinAverage API
We found that bitcoinaverage demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.