mcoin 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/README.md +1 -1
- data/lib/mcoin/command.rb +1 -1
- data/lib/mcoin/command/ext/has_pair.rb +12 -0
- data/lib/mcoin/command/ticker.rb +14 -7
- data/lib/mcoin/market/base.rb +1 -1
- data/lib/mcoin/version.rb +1 -1
- metadata +2 -3
- data/Gemfile.lock +0 -26
- data/lib/mcoin/command/ext/has_type.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49ab57d9100eb27a91c752e1ca71d72571d31cfa
|
4
|
+
data.tar.gz: e66056a6d6595342fb59062de0929bbe38710e7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b82b09b1360b95b54af7db305522c35280e680928a2c6418235c7616493f752799b34ee160dbc845081819127249cf0046966e55a1163a0ae1f747ba18022684
|
7
|
+
data.tar.gz: 366117743778be55ca0c074e34df2d88d5e520837aeb969ba286a1610bfd5836a49e9751712a5d74d8436181eec2bc29d1a24416fcf0342fdc609e08d2ee3b05
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -58,7 +58,7 @@ Please note, the ticker is async pull data from market, the timestamp may not to
|
|
58
58
|
* [x] Fetch ticker
|
59
59
|
* [x] Fetch in parallels
|
60
60
|
* [x] Fetch from multiple market
|
61
|
-
* [
|
61
|
+
* [x] Fetch multiple coin type via specify `pair`
|
62
62
|
* [ ] Support more public API command
|
63
63
|
* [ ] Improve printer
|
64
64
|
* [ ] Generalize database save interface
|
data/lib/mcoin/command.rb
CHANGED
@@ -12,7 +12,7 @@ module Mcoin
|
|
12
12
|
autoload :Ticker, 'mcoin/command/ticker'
|
13
13
|
|
14
14
|
autoload :HasMarket, 'mcoin/command/ext/has_market'
|
15
|
-
autoload :
|
15
|
+
autoload :HasPair, 'mcoin/command/ext/has_pair'
|
16
16
|
autoload :Saveable, 'mcoin/command/ext/saveable'
|
17
17
|
|
18
18
|
class << self
|
data/lib/mcoin/command/ticker.rb
CHANGED
@@ -5,7 +5,7 @@ module Mcoin
|
|
5
5
|
# :nodoc:
|
6
6
|
class Ticker < Base
|
7
7
|
include HasMarket
|
8
|
-
include
|
8
|
+
include HasPair
|
9
9
|
include Saveable
|
10
10
|
|
11
11
|
attr_reader :option
|
@@ -19,7 +19,7 @@ module Mcoin
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def print
|
22
|
-
tickers = Parallel.map(markets, :fetch).map(&:to_ticker)
|
22
|
+
tickers = Parallel.map(markets, :fetch).compact.map(&:to_ticker)
|
23
23
|
Printer.new(tickers).print
|
24
24
|
end
|
25
25
|
|
@@ -29,9 +29,17 @@ module Mcoin
|
|
29
29
|
|
30
30
|
def markets
|
31
31
|
@markets ||= option.market.map do |name|
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
pairs.map do |pair|
|
33
|
+
Market
|
34
|
+
.pick(name)
|
35
|
+
.new(*pair)
|
36
|
+
end
|
37
|
+
end.flatten
|
38
|
+
end
|
39
|
+
|
40
|
+
def pairs
|
41
|
+
@pairs ||= (option.pair || ['BTC-USD']).uniq.map do |pair|
|
42
|
+
pair.split('-').map(&:to_sym)
|
35
43
|
end
|
36
44
|
end
|
37
45
|
|
@@ -39,8 +47,7 @@ module Mcoin
|
|
39
47
|
|
40
48
|
def prepare
|
41
49
|
super
|
42
|
-
option.
|
43
|
-
option.currency = :USD
|
50
|
+
option.pair ||= []
|
44
51
|
end
|
45
52
|
end
|
46
53
|
end
|
data/lib/mcoin/market/base.rb
CHANGED
data/lib/mcoin/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mcoin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 蒼時弦也
|
@@ -50,7 +50,6 @@ files:
|
|
50
50
|
- ".rubocop.yml"
|
51
51
|
- ".travis.yml"
|
52
52
|
- Gemfile
|
53
|
-
- Gemfile.lock
|
54
53
|
- README.md
|
55
54
|
- Rakefile
|
56
55
|
- bin/console
|
@@ -61,7 +60,7 @@ files:
|
|
61
60
|
- lib/mcoin/command/base.rb
|
62
61
|
- lib/mcoin/command/common.rb
|
63
62
|
- lib/mcoin/command/ext/has_market.rb
|
64
|
-
- lib/mcoin/command/ext/
|
63
|
+
- lib/mcoin/command/ext/has_pair.rb
|
65
64
|
- lib/mcoin/command/ext/saveable.rb
|
66
65
|
- lib/mcoin/command/ticker.rb
|
67
66
|
- lib/mcoin/data.rb
|
data/Gemfile.lock
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
mcoin (0.3.0)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
coderay (1.1.2)
|
10
|
-
method_source (0.9.0)
|
11
|
-
pry (0.11.3)
|
12
|
-
coderay (~> 1.1.0)
|
13
|
-
method_source (~> 0.9.0)
|
14
|
-
rake (10.5.0)
|
15
|
-
|
16
|
-
PLATFORMS
|
17
|
-
ruby
|
18
|
-
|
19
|
-
DEPENDENCIES
|
20
|
-
bundler (~> 1.16)
|
21
|
-
mcoin!
|
22
|
-
pry
|
23
|
-
rake (~> 10.0)
|
24
|
-
|
25
|
-
BUNDLED WITH
|
26
|
-
1.16.1
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Mcoin
|
4
|
-
module Command
|
5
|
-
# :nodoc:
|
6
|
-
module HasType
|
7
|
-
def self.included(base)
|
8
|
-
base.option(:single, :type, '-t', '--type TYPE',
|
9
|
-
Mcoin::TYPES, "Available: #{Mcoin::TYPES.join(', ')}")
|
10
|
-
base.option(:single, :currency, '-c', '--currency CURRENCY',
|
11
|
-
Mcoin::CURRENCY, "Available: #{Mcoin::CURRENCY.join(', ')}")
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|