Sha256: bd420b9f4aef47ebfe91f9fce8346d3982b95c738859772504128f90bf5cd2b6
Contents?: true
Size: 613 Bytes
Versions: 2
Compression:
Stored size: 613 Bytes
Contents
# frozen_string_literal: true module Mcoin class Subscriber attr_reader :markets def initialize(picked = Market.available, type = :BTC, currency = :USD) @markets = markets_from(picked, type, currency) end def start(interval = 1, &block) loop do Parallel.async(markets, :fetch) do |result| yield result.to_ticker end sleep interval end end protected def markets_from(picked, type, currency) @markets ||= picked.map do |name| Market .pick(name) .new(type, currency) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mcoin-0.4.0 | lib/mcoin/subscriber.rb |
mcoin-0.3.0 | lib/mcoin/subscriber.rb |