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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0fbe71828cb0f838eede94383a66ca96287d673d
4
- data.tar.gz: ebe336b986d5e116b72be8594e4552b9459c2132
3
+ metadata.gz: 4d68db2e28dc81a1083e37083f761bd8b04a95be
4
+ data.tar.gz: 7d416e4cf1a42bce2fcb75ac7bba9ca00af68d4f
5
5
  SHA512:
6
- metadata.gz: a050b4ee6c3345d1e9a30697032850e3a838a71dbd81c40211149e97fdf227d3c00dbeadfb7096f8a86ee324068391e5652607e77ea09eadc1c0b5dfd10e9876
7
- data.tar.gz: 3897a27ac966ac6c19cdc6a662f67df781b7181ace0a6c8b05fc664cb2d1347fb6faf26f7e1e5cd9dab9f454b190732e7ce7a7e511f7b5247dae1eef201968ef
6
+ metadata.gz: 9d8e9978a21bcd7a285f4d0cad9d9287ece0b84af2b0428df52e337828e203e97d1b03858d83725ac10f17252a4620991e6a3dba3a390991c64cae809afb598c
7
+ data.tar.gz: 44ea8261152dc01a184f5d5cddb28bcfd391e9f3ddbb0cc1642eab6585dece4146ffd297fe320356a8b2f896f90f6bf77ee76f2ae122a4a734a70660ed7f584a
data/README.md CHANGED
@@ -71,6 +71,7 @@ Or install it yourself as:
71
71
  | Korbit | Y | | | | User-Defined|
72
72
  | Kraken | Y | | | | Y |
73
73
  | Kucoin | Y | | | | Y |
74
+ | Kuna | Y | Y | Y | | User-Defined|
74
75
  | LakeBTC | Y | | | | Y |
75
76
  | Liqui | Y | | | | Y |
76
77
  | LiteBit.eu | Y | | | | Y |
@@ -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,8 @@
1
+ module Cryptoexchange::Exchanges
2
+ module Kuna
3
+ class Market
4
+ NAME = 'kuna'
5
+ API_URL = 'https://kuna.io/api/v2'
6
+ end
7
+ end
8
+ end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Cryptoexchange
2
- VERSION = "0.18.1"
2
+ VERSION = "0.18.2"
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.18.1
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-02 00:00:00.000000000 Z
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