@rabbotio/cryptox

0.3.0 • Public • Published

cryptox

[WIP] Crypto exchange parser and adapter for latest price

Example

See examples/index.ts

import Cryptox from '@rabbotio/cryptox'

(async () => {
  // Get each symbol
  Cryptox.getPrice('bx', 'OMG', 'THB').then(data => console.log(`BX:OMG_THB = ${data.last}`))
  Cryptox.getPrice('binance', 'OMG', 'ETH').then(data => console.log(`Binance:OMG_ETH = ${data.last}`))
  Cryptox.getPrice('cex', 'ETH', 'USD').then(data => console.log(`CEX:OMG_USD = ${data.last}`))

  // Get all price and cached
  await Cryptox.fetchAndCache('bx')// TODO : , 'binance', 'cex')
    Cryptox.getCachedPrice('bx', 'OMG', 'THB').then(data => console.log(`BX:OMG_THB = ${data.last}`))
    Cryptox.getCachedPrice('bx', 'THB', 'OMG').then(data => console.log(`BX:THB_OMG = ${data.last}`))
  })()

TODO

  • [ ] fetchAndCache binance, cex
  • [ ] getPrices

Readme

Keywords

none

Package Sidebar

Install

npm i @rabbotio/cryptox

Weekly Downloads

4

Version

0.3.0

License

MIT

Last publish

Collaborators

  • katopz