cryptoexchange 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/cryptoexchange/exchanges/bitflyer/market.rb +1 -1
- data/lib/cryptoexchange/exchanges/coincheck/market.rb +1 -1
- data/lib/cryptoexchange/exchanges/novaexchange/services/market.rb +1 -1
- data/lib/cryptoexchange/exchanges/viabtc/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/viabtc/services/market.rb +41 -0
- data/lib/cryptoexchange/exchanges/viabtc/services/pairs.rb +25 -0
- data/lib/cryptoexchange/exchanges/viabtc/viabtc.yml +16 -0
- data/lib/cryptoexchange/exchanges/yunbi/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/yunbi/services/market.rb +40 -0
- data/lib/cryptoexchange/exchanges/yunbi/services/pairs.rb +32 -0
- data/lib/cryptoexchange/version.rb +1 -1
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c3c5092969d161c818141bf62cd47ff1d06566c
|
4
|
+
data.tar.gz: 9e4b6006845a7b059436d4403168eff080db35eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 212c4eb457261902793e931496bc458878f39cef023c79779bc5fb460c885170aeaf146ebc6e22944649f77f9e9ddecf170069f23268a6f7605b84812cafa1b5
|
7
|
+
data.tar.gz: d5adf2fc535d3178c73855225052d5480532c6558edbce2faaab19e411aea1eff969d84656d81dda8250fa20ca0cddff9dab58beac34b7987931b98b31d6d249
|
data/README.md
CHANGED
@@ -30,7 +30,7 @@ Or install it yourself as:
|
|
30
30
|
| OKCoin | Y | | | | User-Defined|
|
31
31
|
| LakeBTC | Y | | | | Y |
|
32
32
|
| Huobi | | | | | |
|
33
|
-
| Yunbi |
|
33
|
+
| Yunbi | Y | | | | Y |
|
34
34
|
| BTC38 | | | | | |
|
35
35
|
| CHBTC | | | | | |
|
36
36
|
| Bitstamp | Y | | | | User-Defined|
|
@@ -69,6 +69,7 @@ Or install it yourself as:
|
|
69
69
|
| Itbit | | | | | |
|
70
70
|
| Jubi | | | | | |
|
71
71
|
| MercadoBitcoin | | | | | |
|
72
|
+
| Viabtc | Y | | | | User-Defined|
|
72
73
|
|
73
74
|
## Usage
|
74
75
|
|
@@ -33,7 +33,7 @@ module Cryptoexchange::Exchanges
|
|
33
33
|
ticker.ask = NumericHelper.to_d(market['ask'])
|
34
34
|
ticker.high = NumericHelper.to_d(market['high24h'])
|
35
35
|
ticker.low = NumericHelper.to_d(market['low24h'])
|
36
|
-
ticker.volume = NumericHelper.to_d(market['volume24h'])
|
36
|
+
ticker.volume = NumericHelper.to_d(market['volume24h']) / ticker.last
|
37
37
|
ticker.timestamp = Time.now.to_i
|
38
38
|
ticker.payload = market
|
39
39
|
ticker
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Viabtc
|
3
|
+
module Services
|
4
|
+
class Market < Cryptoexchange::Services::Market
|
5
|
+
class << self
|
6
|
+
def supports_individual_ticker_query?
|
7
|
+
true
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def fetch(market_pair)
|
12
|
+
output = super(ticker_url(market_pair))
|
13
|
+
adapt(output, market_pair)
|
14
|
+
end
|
15
|
+
|
16
|
+
def ticker_url(market_pair)
|
17
|
+
"#{Cryptoexchange::Exchanges::Viabtc::Market::API_URL}/market/ticker?market=#{market_pair.base}#{market_pair.target}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def adapt(output, market_pair)
|
21
|
+
ticker = Cryptoexchange::Models::Ticker.new
|
22
|
+
output_data = output['data']
|
23
|
+
output_data_ticker = output_data['ticker']
|
24
|
+
|
25
|
+
ticker.base = market_pair.base
|
26
|
+
ticker.target = market_pair.target
|
27
|
+
ticker.market = Viabtc::Market::NAME
|
28
|
+
ticker.ask = NumericHelper.to_d(output_data_ticker['sell'])
|
29
|
+
ticker.bid = NumericHelper.to_d(output_data_ticker['buy'])
|
30
|
+
ticker.last = NumericHelper.to_d(output_data_ticker['last'])
|
31
|
+
ticker.high = NumericHelper.to_d(output_data_ticker['high'])
|
32
|
+
ticker.low = NumericHelper.to_d(output_data_ticker['low'])
|
33
|
+
ticker.volume = NumericHelper.to_d(output_data_ticker['vol'])
|
34
|
+
ticker.timestamp = output_data['date'].to_i
|
35
|
+
ticker.payload = output
|
36
|
+
ticker
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Viabtc
|
3
|
+
module Services
|
4
|
+
class Pairs < Cryptoexchange::Services::Pairs
|
5
|
+
|
6
|
+
def fetch
|
7
|
+
output = super
|
8
|
+
adapt(output)
|
9
|
+
end
|
10
|
+
|
11
|
+
def adapt(output)
|
12
|
+
market_pairs = []
|
13
|
+
output.each do |pair|
|
14
|
+
market_pairs << Cryptoexchange::Models::MarketPair.new(
|
15
|
+
base: pair[:base],
|
16
|
+
target: pair[:target],
|
17
|
+
market: Viabtc::Market::NAME
|
18
|
+
)
|
19
|
+
end
|
20
|
+
market_pairs
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Yunbi
|
3
|
+
module Services
|
4
|
+
class Market < Cryptoexchange::Services::Market
|
5
|
+
class << self
|
6
|
+
def supports_individual_ticker_query?
|
7
|
+
true
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def fetch(market_pair)
|
12
|
+
output = super(self.ticker_url(market_pair))
|
13
|
+
adapt(output, market_pair)
|
14
|
+
end
|
15
|
+
|
16
|
+
def ticker_url(market_pair)
|
17
|
+
parameter = "#{market_pair.base.downcase}#{market_pair.target.downcase}"
|
18
|
+
"#{Cryptoexchange::Exchanges::Yunbi::Market::API_URL}/tickers/#{parameter}"
|
19
|
+
end
|
20
|
+
|
21
|
+
def adapt(output, market_pair)
|
22
|
+
data_ticker = output['ticker']
|
23
|
+
ticker = Cryptoexchange::Models::Ticker.new
|
24
|
+
ticker.base = market_pair.base
|
25
|
+
ticker.target = market_pair.target
|
26
|
+
ticker.market = Yunbi::Market::NAME
|
27
|
+
ticker.last = NumericHelper.to_d(data_ticker['last'])
|
28
|
+
ticker.bid = NumericHelper.to_d(data_ticker['buy'])
|
29
|
+
ticker.ask = NumericHelper.to_d(data_ticker['sell'])
|
30
|
+
ticker.high = NumericHelper.to_d(data_ticker['high'])
|
31
|
+
ticker.low = NumericHelper.to_d(data_ticker['low'])
|
32
|
+
ticker.volume = NumericHelper.to_d(data_ticker['vol'])
|
33
|
+
ticker.timestamp = output['at'].to_i
|
34
|
+
ticker.payload = output
|
35
|
+
ticker
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Yunbi
|
3
|
+
module Services
|
4
|
+
class Pairs < Cryptoexchange::Services::Pairs
|
5
|
+
PAIRS_URL = "#{Cryptoexchange::Exchanges::Yunbi::Market::API_URL}/markets"
|
6
|
+
|
7
|
+
def fetch
|
8
|
+
output = super
|
9
|
+
adapt(output)
|
10
|
+
end
|
11
|
+
|
12
|
+
def adapt(output)
|
13
|
+
market_pairs = []
|
14
|
+
output.each do |pair|
|
15
|
+
market_pair = Cryptoexchange::Models::MarketPair.new
|
16
|
+
base, target = pair['name'].split('/')
|
17
|
+
|
18
|
+
# Workaround for bad unicode {"id":"1stcny","name":"1SŦ/CNY"}
|
19
|
+
target.downcase!
|
20
|
+
base = pair['id'].match(/(.+)#{target}/)[1]
|
21
|
+
|
22
|
+
market_pair.base = base
|
23
|
+
market_pair.target = target
|
24
|
+
market_pair.market = Yunbi::Market::NAME
|
25
|
+
market_pairs << market_pair
|
26
|
+
end
|
27
|
+
market_pairs
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
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.
|
4
|
+
version: 0.5.0
|
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-08-
|
11
|
+
date: 2017-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -223,9 +223,16 @@ files:
|
|
223
223
|
- lib/cryptoexchange/exchanges/quoine/market.rb
|
224
224
|
- lib/cryptoexchange/exchanges/quoine/services/market.rb
|
225
225
|
- lib/cryptoexchange/exchanges/quoine/services/pairs.rb
|
226
|
+
- lib/cryptoexchange/exchanges/viabtc/market.rb
|
227
|
+
- lib/cryptoexchange/exchanges/viabtc/services/market.rb
|
228
|
+
- lib/cryptoexchange/exchanges/viabtc/services/pairs.rb
|
229
|
+
- lib/cryptoexchange/exchanges/viabtc/viabtc.yml
|
226
230
|
- lib/cryptoexchange/exchanges/yobit/market.rb
|
227
231
|
- lib/cryptoexchange/exchanges/yobit/services/market.rb
|
228
232
|
- lib/cryptoexchange/exchanges/yobit/services/pairs.rb
|
233
|
+
- lib/cryptoexchange/exchanges/yunbi/market.rb
|
234
|
+
- lib/cryptoexchange/exchanges/yunbi/services/market.rb
|
235
|
+
- lib/cryptoexchange/exchanges/yunbi/services/pairs.rb
|
229
236
|
- lib/cryptoexchange/helpers/hash_helper.rb
|
230
237
|
- lib/cryptoexchange/helpers/numeric_helper.rb
|
231
238
|
- lib/cryptoexchange/helpers/string_helper.rb
|