Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Crypto currencies exchanges api implementation using typescript and rxjs
Cryptocurrency exchanges client api wrapper.
These features are supported with all major exchanges
observable
stream so familiar with Rxjs would be an advantage but basically using stream .subscribe((data) => {/**/})
method should be sufficient. You can also easily turn an one-time-complete
observable (rest API request) into promise using .toPromise()
to be used with async await.Binance, Bitbank, Bitfinex, Coinbase
id/docs | homepage | version | origin | country | |
---|---|---|---|---|---|
binance | Binance | * | API | China | |
bitbank | Bitbank | * | API | Japan | |
bitfinex | Bitfinex | 2 | API | British Virgin Islands | |
coinbase | Coinbase | * | API | US |
Task | Date | Status |
---|---|---|
Binance Private User Data Stream | 2018/09 | :white_check_mark: |
Binance Private Api | 2018/12 | |
Bitbank, Bitifnex, Coinbase private stream | 2019/Q1 | |
Huobi, Okex | 2019/Q1 | |
More exchanges | 2019/Q2 | |
Python and Go version | 2019/Q3, Q4 |
This library is designed to be usable in both nodejs and browser (with frontend framework like Angular, React, Vue..., with bundle tools like Webpack or Rollup having typescript configured, the umd javascript file coming later) environments.
When used in browser environment, the browser must support for native
npm i --save ccex-api
import { BinanceApi } from 'ccex-api/exchanges/binance;
const binanceApi = new BinanceApi();
binanceApi.fetchTicker$('btc_usdt').subscribe(ticker => console.log(ticker));
binanceApi.ticker$('btc_usdt').subscribe(ticker => console.log(ticker));
setTimeout(() => { binanceApi.stopTicker('btc_usdt') }, 5000);
Or you can include only the part that you need
import { BitbankCandlestick } from 'ccex-api/exchanges/bitbank/candlestick;
const bitbankCandlestick = new BitbankCandlestick();
bitbankCandlestick.getApproximateHistoryPrice('btc_jpy', 1526917534904, 1).subscribe(price => console.log(price));
Basically all exchanges have these following unified, generalized api implemented.
api | params | return value | desctiption |
---|---|---|---|
exchangeInfo | ExchangeInfo | ||
markets | string[] | All supported markets (pair) | |
representativeMarkets | string[] | Major supported markets (used for test purpose) | |
supportFeatures | SupportFeatures | ||
fetchTicker$ | pair: string | Observable<Ticker> | api request for ticker |
ticker$ | pair: string | Observable<Ticker> | realtime ticker stream |
stopTicker | pair: string | stop realtime ticker stream | |
fetchTrades$ | pair: string | Observable<Trade> | api request for trade |
trade$ | pair: string | Observable<Trade> | realtime trade stream |
stopTrade | pair: string | stop realtime trade stream | |
fetchOrderbook$ | pair: string | Observable<Orderbook> | api request for orderbook |
orderbook$ | pair: string | Observable<Orderbook> | realtime orderbook stream |
stopOrderbook | pair: string | stop realtime orderbook stream | |
fetchCandleStickRange$ | pair: string minutesFoot: number start: number end: number | Observable<CandleStick[]> | api request for candlestick |
lastCandle$ | pair: string minutesFoot: number lastCandle: CandleStick | Observable<CandleStick> | Realtime candlestick stream, calculated from an initial lastCandle and realtime trade stream. This function is useful in implementing Tradingview datafeed |
Besides, an exchange may have more specific functions, it depends on exchange provided features and implementation.
In that case, specific guide for that exchange will be located at exchanges/{exchange}/README.md
(TODO)
In order to add a new exchange, simply clone folder src/exchanges/sample
, rename, implement functions and include appropiate tests for sub-modules (ticker, orderbook...) and some internal functions.
Finally make sure the exchange sample
pass predefined test by running
npm run test sample
If you find a bug or anything should be added to fit your need, please create issue. This is still in very early stage so any feedback would be much appreciated.
We can test all or 1 specific exchange. Note that a realtime test can fail by timeout according to server data stream coming late.
npm run test
npm run test binance
npm run test bitbank
FAQs
Crypto currencies exchanges api implementation using typescript and rxjs
The npm package ccex-api receives a total of 12 weekly downloads. As such, ccex-api popularity was classified as not popular.
We found that ccex-api 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.