cryptoexchange 0.18.1 → 0.18.2
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/lib/cryptoexchange/exchanges/kuna/kuna.yml +21 -0
- data/lib/cryptoexchange/exchanges/kuna/market.rb +8 -0
- data/lib/cryptoexchange/exchanges/kuna/services/market.rb +39 -0
- data/lib/cryptoexchange/exchanges/kuna/services/order_book.rb +46 -0
- data/lib/cryptoexchange/exchanges/kuna/services/pairs.rb +22 -0
- data/lib/cryptoexchange/exchanges/kuna/services/trades.rb +32 -0
- data/lib/cryptoexchange/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d68db2e28dc81a1083e37083f761bd8b04a95be
|
4
|
+
data.tar.gz: 7d416e4cf1a42bce2fcb75ac7bba9ca00af68d4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d8e9978a21bcd7a285f4d0cad9d9287ece0b84af2b0428df52e337828e203e97d1b03858d83725ac10f17252a4620991e6a3dba3a390991c64cae809afb598c
|
7
|
+
data.tar.gz: 44ea8261152dc01a184f5d5cddb28bcfd391e9f3ddbb0cc1642eab6585dece4146ffd297fe320356a8b2f896f90f6bf77ee76f2ae122a4a734a70660ed7f584a
|
data/README.md
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
:pairs:
|
2
|
+
- :base: BTC
|
3
|
+
:target: UAH
|
4
|
+
- :base: ETH
|
5
|
+
:target: UAH
|
6
|
+
- :base: WAVES
|
7
|
+
:target: UAH
|
8
|
+
- :base: GBG
|
9
|
+
:target: UAH
|
10
|
+
- :base: GOL
|
11
|
+
:target: GBG
|
12
|
+
- :base: KUN
|
13
|
+
:target: BTC
|
14
|
+
- :base: BCH
|
15
|
+
:target: BTC
|
16
|
+
- :base: RMC
|
17
|
+
:target: BTC
|
18
|
+
- :base: R
|
19
|
+
:target: BTC
|
20
|
+
- :base: ARN
|
21
|
+
:target: BTC
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Kuna
|
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::Kuna::Market::API_URL}/tickers/#{market_pair.base.downcase}#{market_pair.target.downcase}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def adapt(output, market_pair)
|
21
|
+
ticker = Cryptoexchange::Models::Ticker.new
|
22
|
+
ticker_json = output['ticker']
|
23
|
+
ticker.base = market_pair.base
|
24
|
+
ticker.target = market_pair.target
|
25
|
+
ticker.market = Kuna::Market::NAME
|
26
|
+
ticker.ask = NumericHelper.to_d(ticker_json['sell'])
|
27
|
+
ticker.bid = NumericHelper.to_d(ticker_json['buy'])
|
28
|
+
ticker.last = NumericHelper.to_d(ticker_json['last'])
|
29
|
+
ticker.high = NumericHelper.to_d(ticker_json['high'])
|
30
|
+
ticker.low = NumericHelper.to_d(ticker_json['low'])
|
31
|
+
ticker.volume = NumericHelper.to_d(ticker_json['vol'])
|
32
|
+
ticker.timestamp = output['at']
|
33
|
+
ticker.payload = output
|
34
|
+
ticker
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Kuna
|
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(ticker_url(market_pair))
|
13
|
+
adapt(output, market_pair)
|
14
|
+
end
|
15
|
+
|
16
|
+
def ticker_url(market_pair)
|
17
|
+
"#{Cryptoexchange::Exchanges::Kuna::Market::API_URL}/order_book?market=#{market_pair.base.downcase}#{market_pair.target.downcase}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def adapt(output, market_pair)
|
21
|
+
order_book = Cryptoexchange::Models::OrderBook.new
|
22
|
+
timestamp = Time.now.to_i
|
23
|
+
|
24
|
+
order_book.base = market_pair.base
|
25
|
+
order_book.target = market_pair.target
|
26
|
+
order_book.market = Kuna::Market::NAME
|
27
|
+
order_book.asks = adapt_orders output['asks']
|
28
|
+
order_book.bids = adapt_orders output['bids']
|
29
|
+
order_book.timestamp = timestamp
|
30
|
+
order_book.payload = output
|
31
|
+
order_book
|
32
|
+
end
|
33
|
+
|
34
|
+
def adapt_orders(orders)
|
35
|
+
orders.collect do |order_entry|
|
36
|
+
Cryptoexchange::Models::Order.new(
|
37
|
+
price: order_entry['price'],
|
38
|
+
amount: order_entry['volume'],
|
39
|
+
timestamp: Time.parse(order_entry['created_at']).to_i
|
40
|
+
)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Kuna
|
3
|
+
module Services
|
4
|
+
class Pairs < Cryptoexchange::Services::Pairs
|
5
|
+
|
6
|
+
def fetch
|
7
|
+
adapt(super)
|
8
|
+
end
|
9
|
+
|
10
|
+
def adapt(output)
|
11
|
+
output.map do |pair|
|
12
|
+
Cryptoexchange::Models::MarketPair.new(
|
13
|
+
base: pair[:base],
|
14
|
+
target: pair[:target],
|
15
|
+
market: Kuna::Market::NAME
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Cryptoexchange::Exchanges
|
2
|
+
module Kuna
|
3
|
+
module Services
|
4
|
+
class Trades < Cryptoexchange::Services::Market
|
5
|
+
def fetch(market_pair)
|
6
|
+
output = super(ticker_url(market_pair))
|
7
|
+
adapt(output, market_pair)
|
8
|
+
end
|
9
|
+
|
10
|
+
def ticker_url(market_pair)
|
11
|
+
"#{Cryptoexchange::Exchanges::Kuna::Market::API_URL}/trades?market=#{market_pair.base.downcase}#{market_pair.target.downcase}"
|
12
|
+
end
|
13
|
+
|
14
|
+
def adapt(output, market_pair)
|
15
|
+
output.collect do |trade|
|
16
|
+
tr = Cryptoexchange::Models::Trade.new
|
17
|
+
tr.trade_id = trade['id']
|
18
|
+
tr.base = market_pair.base
|
19
|
+
tr.target = market_pair.target
|
20
|
+
tr.type = trade['side'] == 'null' ? nil : trade['side']
|
21
|
+
tr.price = trade['price']
|
22
|
+
tr.amount = trade['volume']
|
23
|
+
tr.timestamp = Time.parse(trade['created_at']).to_i
|
24
|
+
tr.payload = trade
|
25
|
+
tr.market = Kuna::Market::NAME
|
26
|
+
tr
|
27
|
+
end
|
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.18.
|
4
|
+
version: 0.18.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TM Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -319,6 +319,12 @@ files:
|
|
319
319
|
- lib/cryptoexchange/exchanges/kucoin/market.rb
|
320
320
|
- lib/cryptoexchange/exchanges/kucoin/services/market.rb
|
321
321
|
- lib/cryptoexchange/exchanges/kucoin/services/pairs.rb
|
322
|
+
- lib/cryptoexchange/exchanges/kuna/kuna.yml
|
323
|
+
- lib/cryptoexchange/exchanges/kuna/market.rb
|
324
|
+
- lib/cryptoexchange/exchanges/kuna/services/market.rb
|
325
|
+
- lib/cryptoexchange/exchanges/kuna/services/order_book.rb
|
326
|
+
- lib/cryptoexchange/exchanges/kuna/services/pairs.rb
|
327
|
+
- lib/cryptoexchange/exchanges/kuna/services/trades.rb
|
322
328
|
- lib/cryptoexchange/exchanges/lakebtc/market.rb
|
323
329
|
- lib/cryptoexchange/exchanges/lakebtc/services/market.rb
|
324
330
|
- lib/cryptoexchange/exchanges/lakebtc/services/pairs.rb
|