class Capwatch::Coin

Attributes

distribution[RW]
name[RW]
percent_change_1h[RW]
percent_change_24h[RW]
percent_change_7d[RW]
price_btc[RW]
price_usd[RW]
quantity[RW]
symbol[RW]

Public Class Methods

new() { |self| ... } click to toggle source
# File lib/capwatch/coin.rb, line 12
def initialize
  yield self if block_given?
end

Public Instance Methods

price_eth() click to toggle source
# File lib/capwatch/coin.rb, line 28
def price_eth
  price_btc / Exchange.rate_for("ETH")
end
serialize() click to toggle source
# File lib/capwatch/coin.rb, line 32
def serialize
  {
    symbol: symbol,
    name: name,
    quantity: quantity,
    price_usd: price_usd,
    price_btc: price_btc,
    distribution: distribution,
    percent_change_1h: percent_change_1h,
    percent_change_24h: percent_change_24h,
    percent_change_7d: percent_change_7d,
    value_btc: value_btc,
    value_usd: value_usd,
    value_eth: value_eth,
    price_eth: price_eth,
  }
end
value_btc() click to toggle source
# File lib/capwatch/coin.rb, line 16
def value_btc
  price_btc * quantity
end
value_eth() click to toggle source
# File lib/capwatch/coin.rb, line 24
def value_eth
  price_eth * quantity
end
value_usd() click to toggle source
# File lib/capwatch/coin.rb, line 20
def value_usd
  price_usd * quantity
end