Sha256: 8f52f21309f679b6dba40bf502bba716d47388d2eb5f646e7fe1e9c750541334
Contents?: true
Size: 910 Bytes
Versions: 3
Compression:
Stored size: 910 Bytes
Contents
# frozen_string_literal: true module Mcoin module Command # :nodoc: class Ticker < Base include HasMarket include HasType include Saveable attr_reader :option description 'Show market information' def execute raise OptionParser::MissingArgument, :market if option.market.nil? print save if save? end def print tickers = Parallel.map(markets, :fetch).map(&:to_ticker) Printer.new(tickers).print end def save database.save(markets.map(&:to_ticker).map(&:to_influx)) end def markets @markets ||= option.market.map do |name| Market .pick(name) .new(option.type, option.currency) end end private def prepare super option.type = :BTC option.currency = :USD end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mcoin-0.3.0 | lib/mcoin/command/ticker.rb |
mcoin-0.2.1 | lib/mcoin/command/ticker.rb |
mcoin-0.2.0 | lib/mcoin/command/ticker.rb |