LoginSignup
9
8

More than 5 years have passed since last update.

Rubyで超シンプルなBitcoinのtickerを作った

Last updated at Posted at 2015-01-17

あいさつ

最近Bitcoin始めたんですが、使っている所が指値出来なくて軽くプログラムを組む中で、

tickerを作りコレは公開出来そうだったのでgemにしてみました.

Rubitcoin

Rubitcoin って名前かなり気に入っている、読み方はルビットコイン〜〜

Github

Rubygems

$ gem install rubitcoin

または

Gemfile
gem 'rubitcoin'
$ bundle

使い方

require 'rubitcoin'

# 引数を渡さなければUSドル
Rubitcoin.fetch
#=> {:high=>220.0, :low=>196.0, :avg=>208.0, :vol=>4663985.33289, :vol_cur=>22407.9454, :last=>210.01, :buy=>210.01, :sell=>209.925, :updated=>1421464571.0}

Rubitcoin.high
#=> 223.15

Rubitcoin.last
#=> 222.15

# 通貨は英数字3文字で指定可能
Rubitcoin.fetch(:rur)
#=> {:high=>15120.05664, :low=>13800.0, :avg=>14460.02832, :vol=>5735982.89998, :vol_cur=>394.4822, :last=>14600.0, :buy=>14640.0, :sell=>14445.4708, :updated=>1421464501.0}

Rubitcoin.high(:rur)
#=> 15120.05664

# fetch Rubitcoin.call にaliasあり
Rubitcoin.(:eur)
#=> {:high=>193.09383, :low=>173.13251, :avg=>183.11317, :vol=>21602.3727, :vol_cur=>117.53392, :last=>184.96301, :buy=>184.96301, :sell=>183.09709, :updated=>1421465049.0}
....

rubitcoin コマンド

gem を入れるとrubitcoinコマンドも一緒に入ってきます

$ rubitcoin

価格に変動があればfetchして表示してくれます.

Screenshot 2015-01-16 20.21.41.png

データは https://btc-e.com/api/3 から頂いています.

9
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
8