cryptoexchange 0.7.0 → 0.8.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/PULL_REQUEST_TEMPLATE +8 -0
- data/README.md +2 -0
- data/lib/cryptoexchange/exchanges/bitbay/bitbay.yml +39 -0
- data/lib/cryptoexchange/exchanges/bitbay/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/bitbay/services/market.rb +40 -0
- data/lib/cryptoexchange/exchanges/bitbay/services/pairs.rb +25 -0
- data/lib/cryptoexchange/exchanges/bitso/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/bitso/services/market.rb +39 -0
- data/lib/cryptoexchange/exchanges/bitso/services/pairs.rb +28 -0
- data/lib/cryptoexchange/exchanges/hitbtc/services/market.rb +1 -1
- data/lib/cryptoexchange/version.rb +1 -1
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1bb54be6fb31a9770c153b4c28a886aa64eb4e0
|
4
|
+
data.tar.gz: cbc0fe5516e3523bacb1918b211bb2df43256883
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 799a3759ba65451566ec6c4084ad7fcd61a25a562d3a52536058d03773016f3bbc5ecb81d98cef4576086b9adab48ef3bb58087b15372137a21a27e14524b0fa
|
7
|
+
data.tar.gz: bad6fb4d55364b34e06ced2d611580fc87f9abba4190067233f14515e957456f2ed93a0e21d152836251acdfafcb16c937f1eb135623927fd6b31da0326d5570
|
@@ -0,0 +1,8 @@
|
|
1
|
+
|
2
|
+
- What is the purpose of this Pull Request?
|
3
|
+
- What is the related issue for this Pull Request?
|
4
|
+
- [ ] I have added Specs
|
5
|
+
- [ ] (If implementing Market Ticker) I have verified that the `volume` attributes is correct
|
6
|
+
- [ ] (If implementing Market Ticker) I have verified that the `base` and `target` is correct
|
7
|
+
|
8
|
+
|
data/README.md
CHANGED
@@ -26,6 +26,7 @@ Or install it yourself as:
|
|
26
26
|
| ----------------- | ------- | ---------- | ------- | ------- | ----------- |
|
27
27
|
| ANX | Y | | | | User-Defined|
|
28
28
|
| Gatecoin | Y | | | | Y |
|
29
|
+
| Bitso | Y | | | | Y
|
29
30
|
| BTCC | Y | | | | User-Defined|
|
30
31
|
| OKCoin | Y | | | | User-Defined|
|
31
32
|
| LakeBTC | Y | | | | Y |
|
@@ -71,6 +72,7 @@ Or install it yourself as:
|
|
71
72
|
| MercadoBitcoin | | | | | |
|
72
73
|
| Viabtc | Y | | | | User-Defined|
|
73
74
|
| Tidex | Y | | | | Y |
|
75
|
+
| Bitbay | Y | | | | User-Defined|
|
74
76
|
|
75
77
|
## Usage
|
76
78
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
:pairs:
|
2
|
+
- :base: BCC
|
3
|
+
:target: USD
|
4
|
+
- :base: BCC
|
5
|
+
:target: EUR
|
6
|
+
- :base: BCC
|
7
|
+
:target: PLN
|
8
|
+
- :base: BCC
|
9
|
+
:target: BTC
|
10
|
+
- :base: LSK
|
11
|
+
:target: USD
|
12
|
+
- :base: LSK
|
13
|
+
:target: EUR
|
14
|
+
- :base: LSK
|
15
|
+
:target: PLN
|
16
|
+
- :base: LSK
|
17
|
+
:target: BTC
|
18
|
+
- :base: ETH
|
19
|
+
:target: USD
|
20
|
+
- :base: ETH
|
21
|
+
:target: EUR
|
22
|
+
- :base: ETH
|
23
|
+
:target: PLN
|
24
|
+
- :base: ETH
|
25
|
+
:target: BTC
|
26
|
+
- :base: LTC
|
27
|
+
:target: USD
|
28
|
+
- :base: LTC
|
29
|
+
:target: EUR
|
30
|
+
- :base: LTC
|
31
|
+
:target: PLN
|
32
|
+
- :base: LTC
|
33
|
+
:target: BTC
|
34
|
+
- :base: BTC
|
35
|
+
:target: USD
|
36
|
+
- :base: BTC
|
37
|
+
:target: EUR
|
38
|
+
- :base: BTC
|
39
|
+
:target: PLN
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Bitbay
|
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
|
+
base = market_pair.base.downcase
|
18
|
+
target = market_pair.target.downcase
|
19
|
+
"#{Cryptoexchange::Exchanges::Bitbay::Market::API_URL}/#{base}#{target}/ticker.json"
|
20
|
+
end
|
21
|
+
|
22
|
+
def adapt(output, market_pair)
|
23
|
+
ticker = Cryptoexchange::Models::Ticker.new
|
24
|
+
ticker.base = market_pair.base
|
25
|
+
ticker.target = market_pair.target
|
26
|
+
ticker.market = Bitbay::Market::NAME
|
27
|
+
ticker.bid = NumericHelper.to_d(output['bid'])
|
28
|
+
ticker.ask = NumericHelper.to_d(output['ask'])
|
29
|
+
ticker.last = NumericHelper.to_d(output['last'])
|
30
|
+
ticker.high = NumericHelper.to_d(output['max'])
|
31
|
+
ticker.low = NumericHelper.to_d(output['min'])
|
32
|
+
ticker.volume = NumericHelper.to_d(output["volume"])
|
33
|
+
ticker.timestamp = DateTime.now.to_time.to_i
|
34
|
+
ticker.payload = output
|
35
|
+
ticker
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Bitbay
|
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: Bitbay::Market::NAME
|
18
|
+
)
|
19
|
+
end
|
20
|
+
market_pairs
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Bitso
|
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::Bitso::Market::API_URL}/ticker?book=#{market_pair.base}_#{market_pair.target}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def adapt(output, market_pair)
|
21
|
+
market = output['payload']
|
22
|
+
ticker = Cryptoexchange::Models::Ticker.new
|
23
|
+
ticker.base = market_pair.base
|
24
|
+
ticker.target = market_pair.target
|
25
|
+
ticker.market = Bitso::Market::NAME
|
26
|
+
ticker.ask = NumericHelper.to_d(market['ask'])
|
27
|
+
ticker.bid = NumericHelper.to_d(market['bid'])
|
28
|
+
ticker.last = NumericHelper.to_d(market['last'])
|
29
|
+
ticker.high = NumericHelper.to_d(market['high'])
|
30
|
+
ticker.low = NumericHelper.to_d(market['low'])
|
31
|
+
ticker.volume = NumericHelper.to_d(market['volume'])
|
32
|
+
ticker.timestamp = DateTime.parse(market['created_at']).to_time.to_i
|
33
|
+
ticker.payload = market
|
34
|
+
ticker
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Bitso
|
3
|
+
module Services
|
4
|
+
class Pairs < Cryptoexchange::Services::Pairs
|
5
|
+
PAIRS_URL = "#{Cryptoexchange::Exchanges::Bitso::Market::API_URL}/available_books"
|
6
|
+
|
7
|
+
def fetch
|
8
|
+
output = super
|
9
|
+
adapt(output)
|
10
|
+
end
|
11
|
+
|
12
|
+
def adapt(output)
|
13
|
+
market_pairs = []
|
14
|
+
output["payload"].each do |pair|
|
15
|
+
base, target = pair["book"].upcase.split("_")
|
16
|
+
market_pairs << Cryptoexchange::Models::MarketPair.new(
|
17
|
+
base: base,
|
18
|
+
target: target,
|
19
|
+
market: Bitso::Market::NAME
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
market_pairs
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -32,7 +32,7 @@ module Cryptoexchange::Exchanges
|
|
32
32
|
ticker.high = NumericHelper.to_d(output['high'])
|
33
33
|
ticker.low = NumericHelper.to_d(output['low'])
|
34
34
|
ticker.volume = NumericHelper.to_d(output['volume'])
|
35
|
-
ticker.timestamp = output['timestamp']
|
35
|
+
ticker.timestamp = output['timestamp'].to_i / 1000
|
36
36
|
ticker.payload = output
|
37
37
|
ticker
|
38
38
|
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.8.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-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- CODE_OF_CONDUCT.md
|
122
122
|
- Gemfile
|
123
123
|
- LICENSE.txt
|
124
|
+
- PULL_REQUEST_TEMPLATE
|
124
125
|
- README.md
|
125
126
|
- Rakefile
|
126
127
|
- bin/console
|
@@ -132,6 +133,10 @@ files:
|
|
132
133
|
- lib/cryptoexchange/exchanges/anx/market.rb
|
133
134
|
- lib/cryptoexchange/exchanges/anx/services/market.rb
|
134
135
|
- lib/cryptoexchange/exchanges/anx/services/pairs.rb
|
136
|
+
- lib/cryptoexchange/exchanges/bitbay/bitbay.yml
|
137
|
+
- lib/cryptoexchange/exchanges/bitbay/market.rb
|
138
|
+
- lib/cryptoexchange/exchanges/bitbay/services/market.rb
|
139
|
+
- lib/cryptoexchange/exchanges/bitbay/services/pairs.rb
|
135
140
|
- lib/cryptoexchange/exchanges/bitcoin_indonesia/bitcoin_indonesia.yml
|
136
141
|
- lib/cryptoexchange/exchanges/bitcoin_indonesia/market.rb
|
137
142
|
- lib/cryptoexchange/exchanges/bitcoin_indonesia/services/market.rb
|
@@ -146,6 +151,9 @@ files:
|
|
146
151
|
- lib/cryptoexchange/exchanges/bithumb/market.rb
|
147
152
|
- lib/cryptoexchange/exchanges/bithumb/services/market.rb
|
148
153
|
- lib/cryptoexchange/exchanges/bithumb/services/pairs.rb
|
154
|
+
- lib/cryptoexchange/exchanges/bitso/market.rb
|
155
|
+
- lib/cryptoexchange/exchanges/bitso/services/market.rb
|
156
|
+
- lib/cryptoexchange/exchanges/bitso/services/pairs.rb
|
149
157
|
- lib/cryptoexchange/exchanges/bitstamp/bitstamp.yml
|
150
158
|
- lib/cryptoexchange/exchanges/bitstamp/market.rb
|
151
159
|
- lib/cryptoexchange/exchanges/bitstamp/services/market.rb
|