cryptoexchange 0.18.0 → 0.18.1
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 +1 -0
- data/cryptoexchange.gemspec +1 -1
- data/lib/cryptoexchange/client.rb +0 -1
- data/lib/cryptoexchange/exchanges/crypto_bridge/services/market.rb +1 -1
- data/lib/cryptoexchange/exchanges/lykke/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/lykke/services/market.rb +57 -0
- data/lib/cryptoexchange/exchanges/lykke/services/order_book.rb +46 -0
- data/lib/cryptoexchange/exchanges/lykke/services/pairs.rb +27 -0
- data/lib/cryptoexchange/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fbe71828cb0f838eede94383a66ca96287d673d
|
4
|
+
data.tar.gz: ebe336b986d5e116b72be8594e4552b9459c2132
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a050b4ee6c3345d1e9a30697032850e3a838a71dbd81c40211149e97fdf227d3c00dbeadfb7096f8a86ee324068391e5652607e77ea09eadc1c0b5dfd10e9876
|
7
|
+
data.tar.gz: 3897a27ac966ac6c19cdc6a662f67df781b7181ace0a6c8b05fc664cb2d1347fb6faf26f7e1e5cd9dab9f454b190732e7ce7a7e511f7b5247dae1eef201968ef
|
data/README.md
CHANGED
@@ -77,6 +77,7 @@ Or install it yourself as:
|
|
77
77
|
| Livecoin | Y | | | | Y |
|
78
78
|
| LocalBitcoins | Y | Y | Y | | Y |
|
79
79
|
| Luno | Y | | | | Y |
|
80
|
+
| Lykke | Y | Y | N | | Y |
|
80
81
|
| MercadoBitcoin | Y | | | | User-Defined|
|
81
82
|
| Mercatox | Y | N | N | N | Y |
|
82
83
|
| Nova Exchange | Y | | | | Y |
|
data/cryptoexchange.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency "rb-readline"
|
29
29
|
spec.add_development_dependency "vcr", "~> 3.0.3"
|
30
30
|
spec.add_development_dependency "webmock"
|
31
|
-
|
31
|
+
|
32
32
|
spec.add_dependency "http", '~> 1.0.0'
|
33
33
|
spec.add_dependency "lru_redux"
|
34
34
|
end
|
@@ -37,7 +37,7 @@ module Cryptoexchange::Exchanges
|
|
37
37
|
ticker.ask = NumericHelper.to_d(output['ask'])
|
38
38
|
ticker.bid = NumericHelper.to_d(output['bid'])
|
39
39
|
ticker.last = NumericHelper.to_d(output['last'])
|
40
|
-
ticker.volume = NumericHelper.to_d(output['volume'])
|
40
|
+
ticker.volume = NumericHelper.divide(NumericHelper.to_d(output['volume']), ticker.last)
|
41
41
|
ticker.timestamp = Time.now.to_i
|
42
42
|
ticker.payload = output
|
43
43
|
ticker
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Lykke
|
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
|
+
pairs_output = HTTP.get(dictionary_url)
|
14
|
+
pairs_dictionary = JSON.parse(pairs_output.to_s)
|
15
|
+
adapt_all(output, pairs_dictionary)
|
16
|
+
end
|
17
|
+
|
18
|
+
def ticker_url
|
19
|
+
"#{Cryptoexchange::Exchanges::Lykke::Market::API_URL}/Market"
|
20
|
+
end
|
21
|
+
|
22
|
+
def dictionary_url
|
23
|
+
"#{Cryptoexchange::Exchanges::Lykke::Market::API_URL}/AssetPairs/dictionary"
|
24
|
+
end
|
25
|
+
|
26
|
+
def adapt_all(output, pairs_dictionary)
|
27
|
+
output.map do |ticker|
|
28
|
+
next unless pairs_dictionary.any?{|match| match["id"] == ticker["assetPair"]}
|
29
|
+
pair_object = pairs_dictionary.select{|pair| pair["id"] == ticker["assetPair"]}
|
30
|
+
base = pair_object[0]["baseAssetId"]
|
31
|
+
target = pair_object[0]["quotingAssetId"]
|
32
|
+
market_pair = Cryptoexchange::Models::MarketPair.new(
|
33
|
+
base: base,
|
34
|
+
target: target,
|
35
|
+
market: Lykke::Market::NAME
|
36
|
+
)
|
37
|
+
adapt(ticker, market_pair)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def adapt(ticker_output, market_pair)
|
42
|
+
ticker = Cryptoexchange::Models::Ticker.new
|
43
|
+
ticker.base = market_pair.base
|
44
|
+
ticker.target = market_pair.target
|
45
|
+
ticker.market = Lykke::Market::NAME
|
46
|
+
ticker.bid = NumericHelper.to_d(ticker_output['bid'])
|
47
|
+
ticker.ask = NumericHelper.to_d(ticker_output['ask'])
|
48
|
+
ticker.last = NumericHelper.to_d(ticker_output['lastPrice'])
|
49
|
+
ticker.volume = NumericHelper.to_d(ticker_output['volume24H'])
|
50
|
+
ticker.timestamp = Time.now.to_i
|
51
|
+
ticker.payload = ticker_output
|
52
|
+
ticker
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Lykke
|
3
|
+
module Services
|
4
|
+
class OrderBook < 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(order_book_url(market_pair))
|
13
|
+
adapt(output, market_pair)
|
14
|
+
end
|
15
|
+
|
16
|
+
def order_book_url(market_pair)
|
17
|
+
base = market_pair.base
|
18
|
+
target = market_pair.target
|
19
|
+
"#{Cryptoexchange::Exchanges::Lykke::Market::API_URL}/OrderBook/#{base+target}"
|
20
|
+
end
|
21
|
+
|
22
|
+
def adapt(output, market_pair)
|
23
|
+
order_book = Cryptoexchange::Models::OrderBook.new
|
24
|
+
timestamp = Time.now.to_i
|
25
|
+
|
26
|
+
order_book.base = market_pair.base
|
27
|
+
order_book.target = market_pair.target
|
28
|
+
order_book.market = Lykke::Market::NAME
|
29
|
+
order_book.asks = adapt_orders(output[0]["prices"], timestamp)
|
30
|
+
order_book.bids = adapt_orders(output[1]["prices"], timestamp)
|
31
|
+
order_book.timestamp = timestamp
|
32
|
+
order_book.payload = output
|
33
|
+
order_book
|
34
|
+
end
|
35
|
+
|
36
|
+
def adapt_orders(orders, timestamp)
|
37
|
+
orders.collect do |order_entry|
|
38
|
+
Cryptoexchange::Models::Order.new(price: NumericHelper.to_d(order_entry["price"]),
|
39
|
+
amount: NumericHelper.to_d(order_entry["volume"]),
|
40
|
+
timestamp: timestamp)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Lykke
|
3
|
+
module Services
|
4
|
+
class Pairs < Cryptoexchange::Services::Pairs
|
5
|
+
PAIRS_URL = "#{Cryptoexchange::Exchanges::Lykke::Market::API_URL}/AssetPairs/dictionary"
|
6
|
+
|
7
|
+
def fetch
|
8
|
+
output = super
|
9
|
+
adapt(output)
|
10
|
+
end
|
11
|
+
|
12
|
+
def adapt(output)
|
13
|
+
output.map do |pair|
|
14
|
+
base = pair["baseAssetId"]
|
15
|
+
target = pair["quotingAssetId"]
|
16
|
+
Cryptoexchange::Models::MarketPair.new(
|
17
|
+
base: base,
|
18
|
+
target: target,
|
19
|
+
market: Lykke::Market::NAME
|
20
|
+
)
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
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.18.
|
4
|
+
version: 0.18.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TM Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -334,6 +334,10 @@ files:
|
|
334
334
|
- lib/cryptoexchange/exchanges/luno/market.rb
|
335
335
|
- lib/cryptoexchange/exchanges/luno/services/market.rb
|
336
336
|
- lib/cryptoexchange/exchanges/luno/services/pairs.rb
|
337
|
+
- lib/cryptoexchange/exchanges/lykke/market.rb
|
338
|
+
- lib/cryptoexchange/exchanges/lykke/services/market.rb
|
339
|
+
- lib/cryptoexchange/exchanges/lykke/services/order_book.rb
|
340
|
+
- lib/cryptoexchange/exchanges/lykke/services/pairs.rb
|
337
341
|
- lib/cryptoexchange/exchanges/mercado_bitcoin/market.rb
|
338
342
|
- lib/cryptoexchange/exchanges/mercado_bitcoin/mercado_bitcoin.yml
|
339
343
|
- lib/cryptoexchange/exchanges/mercado_bitcoin/services/market.rb
|