Coder Social home page Coder Social logo

hubot-crypto's Introduction

hubot-crypto NPM version

Usage

hubot <cryptocurrency>          returns price of cryptocurrency in USD (or configured default fiat)
hubot <cryptocurrency> <base>   returns price of cryptocurrency in base currency

Choices for cryptocurrency: bch, btc, eth, ltc, xrp, zec, xmr

Choices for base: btc, nearly any three character code for a fiat (USD, EUR, GBP, JPY, etc)

hubot crypto <source_currency> <target_currency>

Will attempt to find source_currency in terms of target_currency and includes a much wider set of choices for source_currency

See https://apiv2.bitcoinaverage.com/constants/symbols

hubot gdax <source_currency> <target_currency>

Will fetch prices from GDAX for the limited set of (BTC|ETH|LTC) --> (USD|EUR)

Examples

robot> robot btc
robot> BTC in USD: 14355.5 | 24hr change: -1690.34 (-10.53%) | Vol: 179634.38822293

robot> robot eth eur
robot> ETH in EUR: 393.8701 | 24hr change: +10.31 (+2.6883%) | Vol: 1017775.3482468

robot> robot xrp arf
robot> Could not find XRP in terms of ARF

robot> robot crypto omg
robot> OMG in BTC: 0.00058677 | 24hr change: +0.00007204 (+13.99513487%) | Vol: 207497.24702385

robot> robot crypto dash usd
robot> DASH in USD: 700.0112 | 24hr change: +2.4453 (+0.3505%) | Vol: 2493.51427182

robot> robot gdax ltc
robot> LTC in USD on GDAX: 149.49000000

Installation

  1. cd into your hubot dir, run npm install --save hubot-crypto (adds it as a dependency in package.json).
  2. Add "hubot-crypto" to your external-scripts.json file.
  3. Restart Hubot.

Or just drop crypto.coffee into your hubot's scripts/ directory.

Thanks to

https://github.com/github/hubot-scripts/blob/master/src/scripts/bitcoin.coffee

https://github.com/notpeter/hubot-bitcoin

Not exactly a fork, but I definitely took some guidance from both of the above

hubot-crypto's People

Contributors

jonmcoe avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

hubot-crypto's Issues

robot crypto omg example does not work as shown in your example

Hello, thanks for this hubot script. I am having trouble with the command "hubot crypto omg". It says that it cannot find OMG in terms of BTC but in your example it shows that it works. Here is some more info:

Part of the log:
at Feb 03 2018 21:39:16 GMT-0500 (EST)] INFO Message receive callback id LEdvXDDQPq4HsooAa ts Sat Feb 03 2018 21:39:16 GMT-0500 (EST)
[Sat Feb 03 2018 21:39:16 GMT-0500 (EST)] INFO [Incoming] snazzybunny: hubot crypto omg
[Sat Feb 03 2018 21:39:16 GMT-0500 (EST)] INFO setting roomName: general
[Sat Feb 03 2018 21:39:16 GMT-0500 (EST)] INFO Message sent to hubot brain.
[Sat Feb 03 2018 21:39:17 GMT-0500 (EST)] INFO Sending Message To Room: general
[Sat Feb 03 2018 21:39:17 GMT-0500 (EST)] INFO Message received with ID id

In chat:
snazzybunny Admin 9:39 PM
hubot crypto omg

hubot 9:39 PM
Could not find OMG in terms of BTC

Move to coinmarketcap's api

It might be a good idea to replace the bitcoinaverage's api with coinmarketcap.com 's

https://coinmarketcap.com/api/
https://api.coinmarketcap.com/v1/ticker/?limit=1000
https://api.coinmarketcap.com/v1/ticker/?convert=EUR&limit=1000
https://api.coinmarketcap.com/v1/ticker/?convert=ETH&limit=1000

It supports more currencies, will return more relevant prices, and won't necessitate calling multiple "indices" like bitcoinaverage.com. While there is a single coin endpoint (https://api.coinmarketcap.com/v1/ticker/litecoin/) the best move is probably to call the "all coins" endpoint, cache everything, and choose the desired result in memory.

The most notable downside to this approach is the 5min update window. So that's something to consider. It's not uncommon for an active channel to request the same coin's price within 5min. Hopefully the GDAX functionality would alleviate some of this gap, at least for the most popular ones.

NOTE: will require some caching bc the docs say "Please limit requests to no more than 10 per minute." Should be pretty easy, exactly bc of this one endpoint situation. Will need to fetch separately by target currency/fiat, but not by source.

This will probably break soon

Email from bitcoinaverage.com

Replacing Free Plan with Free Trials
We will no longer offer the option for the extremely limited free plan but have instead decided to allow our users to try any of our plans for free.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.