cryptoexchange 0.15.5 → 0.15.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4efeb9568ea25bec26e7d668d1e948068c7c8c5d
4
- data.tar.gz: 67502a01f9443e06b29674ae301e6c94eb0d0538
3
+ metadata.gz: 19a97cc3b59cd630f0397ec1801b390b8f4418f2
4
+ data.tar.gz: f5752ac6bde0c9da2de4f6f8b46847d1855da74c
5
5
  SHA512:
6
- metadata.gz: 072264380303a1094baf0f92d882eb298cdba150e8c9b90525f2392e0e1ac1f12a198b4f98d06130b856c94d9493d37aaaa41124be2b8be579a70d3ac93256f7
7
- data.tar.gz: d0d49d7e276a20f950a5c11dda86ce4109d1576fb19c806c6cde28e8b1e2ef7dcb6c6c8219ceea28f930e266cc4afeb8c11b869e294ad0b981faf51d17cc42f6
6
+ metadata.gz: d82481cfade67a66fc7239082d1784fa39142ac884d25b089cdb10f5c1c945098a3d3f9e743645570ae2bcfb4bd5a64e9ac6115b7cfe2520d1a138e910062def
7
+ data.tar.gz: d867ceee8b6b2c409f47764d585a4929e524efe8b0b4542abadeae25c841d874638a509feb070d3470f4b688e41975a98e10ead553ce7bdc6ba5c30c3f95b649
@@ -2,6 +2,8 @@ module Cryptoexchange::Exchanges
2
2
  module Binance
3
3
  module Services
4
4
  class Pairs < Cryptoexchange::Services::Pairs
5
+ PAIRS_URL = "#{Cryptoexchange::Exchanges::Binance::Market::API_URL}/ticker/allPrices"
6
+ TARGETS = ['BTC', 'ETH', 'BNB', 'USDT']
5
7
 
6
8
  def fetch
7
9
  output = super
@@ -11,14 +13,33 @@ module Cryptoexchange::Exchanges
11
13
  def adapt(output)
12
14
  market_pairs = []
13
15
  output.each do |pair|
16
+ symbol = pair['symbol']
17
+ base, target = strip_pairs(symbol)
18
+ next unless base && target
14
19
  market_pairs << Cryptoexchange::Models::MarketPair.new(
15
- base: pair[:base],
16
- target: pair[:target],
20
+ base: base,
21
+ target: target,
17
22
  market: Binance::Market::NAME
18
23
  )
19
24
  end
20
25
  market_pairs
21
26
  end
27
+
28
+ def strip_pairs(pair_symbol)
29
+ #Match last 3 or 4 if it hits target
30
+ last_4 = pair_symbol[-4..-1]
31
+ last_3 = pair_symbol[-3..-1]
32
+
33
+ if TARGETS.include? last_4
34
+ base = pair_symbol[0..-5]
35
+ target = last_4
36
+ elsif TARGETS.include? last_3
37
+ base = pair_symbol[0..-4]
38
+ target = last_3
39
+ end
40
+
41
+ [base, target]
42
+ end
22
43
  end
23
44
  end
24
45
  end
@@ -0,0 +1,8 @@
1
+ module Cryptoexchange::Exchanges
2
+ module CoinsMarkets
3
+ class Market
4
+ NAME = 'coins_markets'
5
+ API_URL = 'https://coinsmarkets.com'
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,50 @@
1
+ module Cryptoexchange::Exchanges
2
+ module CoinsMarkets
3
+ module Services
4
+ class Market < Cryptoexchange::Services::Market
5
+ class << self
6
+ def supports_individual_ticker_query?
7
+ false
8
+ end
9
+ end
10
+
11
+ def fetch
12
+ output = super ticker_url
13
+ adapt_all(output)
14
+ end
15
+
16
+ def ticker_url
17
+ "#{Cryptoexchange::Exchanges::CoinsMarkets::Market::API_URL}/apicoin.php"
18
+ end
19
+
20
+ def adapt_all(output)
21
+ output.map do |key, value|
22
+ base, target = key.split('_')
23
+ market_pair = Cryptoexchange::Models::MarketPair.new(
24
+ base: base,
25
+ target: target,
26
+ market: CoinsMarkets::Market::NAME
27
+ )
28
+ adapt(value, market_pair)
29
+ end
30
+ end
31
+
32
+ def adapt(output, market_pair)
33
+ ticker = Cryptoexchange::Models::Ticker.new
34
+ ticker.base = market_pair.base
35
+ ticker.target = market_pair.target
36
+ ticker.market = CoinsMarkets::Market::NAME
37
+ ticker.ask = NumericHelper.to_d(output['lowestAsk'])
38
+ ticker.bid = NumericHelper.to_d(output['highestBid'])
39
+ ticker.last = NumericHelper.to_d(output['last'])
40
+ ticker.high = NumericHelper.to_d(output['high24hr'])
41
+ ticker.low = NumericHelper.to_d(output['low24hr'])
42
+ ticker.volume = NumericHelper.to_d(output['24htrade'])
43
+ ticker.timestamp = Time.now.to_i
44
+ ticker.payload = output
45
+ ticker
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,25 @@
1
+ module Cryptoexchange::Exchanges
2
+ module CoinsMarkets
3
+ module Services
4
+ class Pairs < Cryptoexchange::Services::Pairs
5
+ PAIRS_URL = "#{Cryptoexchange::Exchanges::CoinsMarkets::Market::API_URL}/apicoin.php"
6
+
7
+ def fetch
8
+ output = super
9
+ adapt(output)
10
+ end
11
+
12
+ def adapt(output)
13
+ output.map do |key, _|
14
+ base, target = key.split('_')
15
+ Cryptoexchange::Models::MarketPair.new(
16
+ base: base,
17
+ target: target,
18
+ market: CoinsMarkets::Market::NAME
19
+ )
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,8 @@
1
+ module Cryptoexchange::Exchanges
2
+ module Coss
3
+ class Market
4
+ NAME = 'coss'
5
+ API_URL = 'https://exchange.coss.io/api'
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,52 @@
1
+ module Cryptoexchange::Exchanges
2
+ module Coss
3
+ module Services
4
+ class Market < Cryptoexchange::Services::Market
5
+ class << self
6
+ def supports_individual_ticker_query?
7
+ false
8
+ end
9
+ end
10
+
11
+ def fetch
12
+ output = super ticker_url
13
+ adapt_all(output)
14
+ end
15
+
16
+ def ticker_url
17
+ "#{Cryptoexchange::Exchanges::Coss::Market::API_URL}/ticker"
18
+ end
19
+
20
+ def adapt_all(output)
21
+ output.map do |_, value|
22
+ base, target = value['id'].split('-')
23
+ market_pair = Cryptoexchange::Models::MarketPair.new(
24
+ base: base,
25
+ target: target,
26
+ market: Coss::Market::NAME
27
+ )
28
+ adapt(value, market_pair)
29
+ end
30
+ end
31
+
32
+ def adapt(output, market_pair)
33
+ # Other fields on output that are not used: start24h, change24h
34
+ # No values assigned to ticker fields: ask, bid
35
+
36
+ ticker = Cryptoexchange::Models::Ticker.new
37
+ ticker.base = market_pair.base
38
+ ticker.target = market_pair.target
39
+ ticker.market = Coss::Market::NAME
40
+ ticker.last = NumericHelper.to_d(output['lastPrice'])
41
+ ticker.high = NumericHelper.to_d(output['high24h'])
42
+ ticker.low = NumericHelper.to_d(output['low24h'])
43
+ ticker.volume = NumericHelper.to_d(output['volume'])
44
+ ticker.change = NumericHelper.to_d(output['change24h'])
45
+ ticker.timestamp = Time.now.to_i
46
+ ticker.payload = output
47
+ ticker
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,25 @@
1
+ module Cryptoexchange::Exchanges
2
+ module Coss
3
+ module Services
4
+ class Pairs < Cryptoexchange::Services::Pairs
5
+ PAIRS_URL = "#{Cryptoexchange::Exchanges::Coss::Market::API_URL}/ticker"
6
+
7
+ def fetch
8
+ output = super
9
+ adapt(output)
10
+ end
11
+
12
+ def adapt(output)
13
+ output.map do |_, value|
14
+ base, target = value['id'].split('-')
15
+ Cryptoexchange::Models::MarketPair.new(
16
+ base: base,
17
+ target: target,
18
+ market: Coss::Market::NAME
19
+ )
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,3 +1,3 @@
1
1
  module Cryptoexchange
2
- VERSION = "0.15.5"
2
+ VERSION = "0.15.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptoexchange
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.5
4
+ version: 0.15.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - TM Lee
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-15 00:00:00.000000000 Z
11
+ date: 2017-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -172,7 +172,6 @@ files:
172
172
  - lib/cryptoexchange/exchanges/anx/market.rb
173
173
  - lib/cryptoexchange/exchanges/anx/services/market.rb
174
174
  - lib/cryptoexchange/exchanges/anx/services/pairs.rb
175
- - lib/cryptoexchange/exchanges/binance/binance.yml
176
175
  - lib/cryptoexchange/exchanges/binance/market.rb
177
176
  - lib/cryptoexchange/exchanges/binance/services/market.rb
178
177
  - lib/cryptoexchange/exchanges/binance/services/order_book.rb
@@ -246,6 +245,12 @@ files:
246
245
  - lib/cryptoexchange/exchanges/coinone/market.rb
247
246
  - lib/cryptoexchange/exchanges/coinone/services/market.rb
248
247
  - lib/cryptoexchange/exchanges/coinone/services/pairs.rb
248
+ - lib/cryptoexchange/exchanges/coins_markets/market.rb
249
+ - lib/cryptoexchange/exchanges/coins_markets/services/market.rb
250
+ - lib/cryptoexchange/exchanges/coins_markets/services/pairs.rb
251
+ - lib/cryptoexchange/exchanges/coss/market.rb
252
+ - lib/cryptoexchange/exchanges/coss/services/market.rb
253
+ - lib/cryptoexchange/exchanges/coss/services/pairs.rb
249
254
  - lib/cryptoexchange/exchanges/cryptopia/market.rb
250
255
  - lib/cryptoexchange/exchanges/cryptopia/services/market.rb
251
256
  - lib/cryptoexchange/exchanges/cryptopia/services/pairs.rb
@@ -1,147 +0,0 @@
1
- :pairs:
2
- - :base: ETH
3
- :target: BTC
4
- - :base: LTC
5
- :target: BTC
6
- - :base: BNB
7
- :target: BTC
8
- - :base: NEO
9
- :target: BTC
10
- - :base: QTUM
11
- :target: ETH
12
- - :base: EOS
13
- :target: ETH
14
- - :base: SNT
15
- :target: ETH
16
- - :base: BNT
17
- :target: ETH
18
- - :base: BCC
19
- :target: BTC
20
- - :base: GAS
21
- :target: BTC
22
- - :base: BNB
23
- :target: ETH
24
- - :base: BTM
25
- :target: ETH
26
- - :base: HCC
27
- :target: BTC
28
- - :base: BTC
29
- :target: USDT
30
- - :base: ETH
31
- :target: USDT
32
- - :base: HSR
33
- :target: BTC
34
- - :base: OAX
35
- :target: ETH
36
- - :base: DNT
37
- :target: ETH
38
- - :base: MCO
39
- :target: ETH
40
- - :base: ICN
41
- :target: ETH
42
- - :base: ELC
43
- :target: BTC
44
- - :base: MCO
45
- :target: BTC
46
- - :base: WTC
47
- :target: BTC
48
- - :base: WTC
49
- :target: ETH
50
- - :base: LLT
51
- :target: BTC
52
- - :base: LRC
53
- :target: BTC
54
- - :base: LRC
55
- :target: ETH
56
- - :base: QTUM
57
- :target: BTC
58
- - :base: YOYO
59
- :target: BTC
60
- - :base: OMG
61
- :target: BTC
62
- - :base: OMG
63
- :target: ETH
64
- - :base: ZRX
65
- :target: BTC
66
- - :base: ZRX
67
- :target: ETH
68
- - :base: STRAT
69
- :target: BTC
70
- - :base: STRAT
71
- :target: ETH
72
- - :base: SNGLS
73
- :target: BTC
74
- - :base: SNGLS
75
- :target: ETH
76
- - :base: BQX
77
- :target: BTC
78
- - :base: BQX
79
- :target: ETH
80
- - :base: KNC
81
- :target: BTC
82
- - :base: KNC
83
- :target: ETH
84
- - :base: FUN
85
- :target: BTC
86
- - :base: FUN
87
- :target: ETH
88
- - :base: SNM
89
- :target: BTC
90
- - :base: SNM
91
- :target: ETH
92
- - :base: NEO
93
- :target: ETH
94
- - :base: IOTA
95
- :target: BTC
96
- - :base: IOTA
97
- :target: ETH
98
- - :base: LINK
99
- :target: BTC
100
- - :base: LINK
101
- :target: ETH
102
- - :base: XVG
103
- :target: BTC
104
- - :base: XVG
105
- :target: ETH
106
- - :base: CTR
107
- :target: BTC
108
- - :base: CTR
109
- :target: ETH
110
- - :base: SALT
111
- :target: BTC
112
- - :base: SALT
113
- :target: ETH
114
- - :base: MDA
115
- :target: BTC
116
- - :base: MDA
117
- :target: ETH
118
- - :base: MTL
119
- :target: BTC
120
- - :base: MTL
121
- :target: ETH
122
- - :base: SUB
123
- :target: BTC
124
- - :base: SUB
125
- :target: ETH
126
- - :base: EOS
127
- :target: BTC
128
- - :base: SNT
129
- :target: BTC
130
- - :base: ETC
131
- :target: ETH
132
- - :base: ETC
133
- :target: BTC
134
- - :base: MTH
135
- :target: BTC
136
- - :base: MTH
137
- :target: ETH
138
- - :base: ENG
139
- :target: BTC
140
- - :base: ENG
141
- :target: ETH
142
- - :base: DNT
143
- :target: BTC
144
- - :base: ZEC
145
- :target: BTC
146
- - :base: ZEC
147
- :target: ETH