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.
crypto-socket
Advanced tools
Basic cryptocurrency ticker supporting multiple exchanges and currencies with websockets where available.
** Ronaldo Barbachano, 2016 **
*** Provided as is. ***
Combines public crypto currency websocket API's to provide a low-resource, zero configuration ticker. Each exchange, except for bittrex, uses a realtime websocket.
bittrex,bitstamp,poloniex,gdax,gemini,cex,bitfinex,okcoin,bitmex
cryptoSocket = require("crypto-socket")
cryptoSocket.start();
Starts a websocket. Where exchange is always lowercase and symbol is always upper-case.
// listen to ETHBTC on bitfinex,bitmex,and cex.
cryptoSocket.start("bitfinex","ETHBTC")
cryptoSocket.start("bitmex","ETHBTC")
cryptoSocket.start("cex","ETHBTC")
Pass an array to subscribe to multiple markets
cryptoSocket.start("bitfinex",['LTCBTC','BTCUSD'])
These exchanges should support all markets that they have, and will be simple to add more.
Note
As of now Poloniex exchange only has one open socket that sends back all data. The above syntax is not recommeneded unless you are only following one symbol; as it will open up multiple sockets that return all data, and filter out your selections.
A simple printout of all open ticker quotes.
// print out quotes every 1000 ms (1 second)
setInterval(
function(){
cryptoSocket.echoExchange()
},1000);
Access to the raw variable the module uses to store ticker quotes as they update. One value at a time.
// get bitfinex quotes
console.log(cryptoSocket.Exchanges['bitfinex'])
// renders '{ ETHBTC: 0.02492 }' to console.
** Does this store data? **
Nope. Ticker values (in most cases last sale price) is stored in memory.
*** Why? ***
Other popular BTC average modules require incredible amount of bandwidth at regular intervals which can make deployment difficult in many situations. Websockets are obviously the way to go for real time data, as constantly querying many exchanges can be taxing.
This module does not include exchange API's that do not have web sockets. Why? Theres a billion other modules that do something similar, and perhaps this is a wake up call to any exchange that does not offer rhobust websocket support.
Many developers would rather not be bothered reading through additional API documentation which, in many cases, is incomplete, hard to follow and usually lacking node.js examples. I did it for you! In node. You're welcome.
They are (usually) faster. Data is sent to the client as its received, versus a poll-and-diff approach which requires regular polling intervals. This can mean the difference between a constant 10k/s stream versus a sporadic 3k/s steam. Sites that poll many exchanges regularly increase bandwith use based on polling intervals. (For example if you attempt to use BTCAverage module, and three times a second, you can easily consume 300k/s) This module with all websockets activated consumes around 3-10k/s making it possible for low-bandwith enviornments to function somewhat efficently.
The exchange's api does not offer the symbol via websocket or laziness. Hook it up with a PR brah; after a while one gets burnt out glazing over poorly written/organized API documentation; and its all subject to change at any given moment so prepare for this to break.
For the most part they do not offer a public web socket and I did not feel it nessary to reduplicate more code to create a 'faux-socket', as there are many alternatives.
ETH - 0x9d7c3b85e4273E24C007481a8DB074f0FB2df5c8
FAQs
Basic cryptocurrency ticker supporting multiple exchanges and currencies with websockets where available.
We found that crypto-socket 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.