bitex 0.6.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7504b1d05131be725c8c685085de3dd783cd6c19
4
- data.tar.gz: 015ab1434b6fb8fc3fb6723293d4c3251a652ac6
3
+ metadata.gz: a80cac6737caca0072c5dbabd5cf2108af955715
4
+ data.tar.gz: 0b190989454c5d7ef169931e51143c9e45dd1692
5
5
  SHA512:
6
- metadata.gz: d2ac3d5ac05de9bb8edd92ab6d4c96aacc7c890d714949f1b65bf52f09ec9350887f9abe6566c087c3396eecb93ccf157a65cd8937f792dbc38c77898c56962e
7
- data.tar.gz: 8cfac85e42a66e6a53744ebfdc478612801fb745703e13db5bc3222a623cb89451785dd246fed03361bd53da8e84900d1befc21b8f6cd721de0fa9dec3ea1793
6
+ metadata.gz: 6bc6b05dba9426cf40092f439247fa52d62b22e8692156406160d99a49a3f42e10ebe1c790c71cb31f76b74af57db2f9001d66b0be8594d69059dc7f8ee5a2b2
7
+ data.tar.gz: 81c42a6e20d19cd49deadf0d25df749f95b648dfc13f00a2cfc866c94e7b47bdab2bb7553d0ebf57504e229831655d80af8940eeb0b303588358cbd71a7908d9
@@ -18,7 +18,7 @@ module Bitex
18
18
  mattr_accessor :debug
19
19
  mattr_accessor :ssl_version
20
20
 
21
- ORDER_BOOKS = { btc_usd: 1, btc_ars: 5, btc_pyg: 10, btc_clp: 11, btc_uyu: 12 }.freeze
21
+ ORDER_BOOKS = { btc_usd: 1, btc_ars: 5, bch_usd: 8, btc_pyg: 10, btc_clp: 11, btc_uyu: 12 }.freeze
22
22
  class UnknownOrderBook < StandardError
23
23
  end
24
24
  end
@@ -37,6 +37,7 @@ module Bitex
37
37
  end
38
38
  fields += options.map do |k, v|
39
39
  next unless v
40
+
40
41
  Curl::PostField.content(k.to_s, v)
41
42
  end.compact
42
43
  curl.send("http_#{verb.downcase}", *fields)
@@ -61,6 +62,7 @@ module Bitex
61
62
 
62
63
  def self.private(verb, path, options = {}, files = {})
63
64
  raise StandardError, 'No api_key available to make private key calls' if Bitex.api_key.nil?
65
+
64
66
  response = curl(verb, path, options.merge(api_key: Bitex.api_key), files)
65
67
  JSON.parse(response.body)
66
68
  end
@@ -56,4 +56,11 @@ module Bitex
56
56
  'btc'
57
57
  end
58
58
  end
59
+
60
+ # A {MarketData} for Bitcoin Cash.
61
+ class BitcoinCashMarketData < MarketData
62
+ def self.specie
63
+ 'bch'
64
+ end
65
+ end
59
66
  end
@@ -1,3 +1,3 @@
1
1
  module Bitex
2
- VERSION = '0.6.0'.freeze
2
+ VERSION = '0.9.1'.freeze
3
3
  end
@@ -1,39 +1,41 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Bitex::MarketData do
4
- it "gets the ticker" do
5
- stub_get("/btc/market/ticker", 'market_ticker')
6
- Bitex::BitcoinMarketData.ticker.should == {
7
- last: 639.0, high: 659.0, low: 639.0, vwap: 647.195852839369,
8
- volume: 4.80579022, bid: 637.0, ask: 638.5
9
- }
10
- end
11
-
12
- it "gets the order book" do
13
- stub_get("/btc/market/order_book", 'order_book')
14
- Bitex::BitcoinMarketData.order_book.should == {
15
- bids: [[639.21,1.95],[637.0,0.47],[630.0,1.58]],
16
- asks: [[642.4,0.4],[643.3,0.95],[644.3,0.25]]
17
- }
18
- end
19
-
20
- it "gets the transactions" do
21
- stub_get("/btc/market/transactions", 'transactions')
22
- Bitex::BitcoinMarketData.transactions.should == [
23
- [1404259180, 1272, 650.0, 0.5],
24
- [1404259179, 1271, 639.0, 0.46948356]
25
- ]
26
- end
27
-
28
- %w(last_24_hours last_7_days last_30_days).each do |method|
29
- it "gets aggregated data for #{method}" do
30
- stub_get("/btc/market/#{method}", 'aggregated_data')
31
- Bitex::BitcoinMarketData.send(method).should == [
32
- [1403668800, 570.0, 574.0, 570.0, 574.0, 1.06771929, 571.0, 570.917848641659],
33
- [1403683200, 560.0, 570.0, 560.0, 570.0, 1.14175147, 565.0, 565.753596095655],
34
- [1403697600, 560.0, 560.0, 560.0, 560.0, 0.0, 565.0, 0.0],
35
- [1403712000, 560.0, 560.0, 560.0, 560.0, 0.0, 565.0, 0.0]
4
+ { btc: Bitex::BitcoinMarketData, bch: Bitex::BitcoinCashMarketData }.each do |crypto_currency, market|
5
+ it "gets the ticker" do
6
+ stub_get("/#{crypto_currency}/market/ticker", 'market_ticker')
7
+ market.ticker.should == {
8
+ last: 639.0, high: 659.0, low: 639.0, vwap: 647.195852839369,
9
+ volume: 4.80579022, bid: 637.0, ask: 638.5
10
+ }
11
+ end
12
+
13
+ it "gets the order book" do
14
+ stub_get("/#{crypto_currency}/market/order_book", 'order_book')
15
+ market.order_book.should == {
16
+ bids: [[639.21,1.95],[637.0,0.47],[630.0,1.58]],
17
+ asks: [[642.4,0.4],[643.3,0.95],[644.3,0.25]]
18
+ }
19
+ end
20
+
21
+ it "gets the transactions" do
22
+ stub_get("/#{crypto_currency}/market/transactions", 'transactions')
23
+ market.transactions.should == [
24
+ [1404259180, 1272, 650.0, 0.5],
25
+ [1404259179, 1271, 639.0, 0.46948356]
36
26
  ]
37
27
  end
28
+
29
+ %w(last_24_hours last_7_days last_30_days).each do |method|
30
+ it "gets aggregated data for #{method}" do
31
+ stub_get("/#{crypto_currency}/market/#{method}", 'aggregated_data')
32
+ market.send(method).should == [
33
+ [1403668800, 570.0, 574.0, 570.0, 574.0, 1.06771929, 571.0, 570.917848641659],
34
+ [1403683200, 560.0, 570.0, 560.0, 570.0, 1.14175147, 565.0, 565.753596095655],
35
+ [1403697600, 560.0, 560.0, 560.0, 560.0, 0.0, 565.0, 0.0],
36
+ [1403712000, 560.0, 560.0, 560.0, 560.0, 0.0, 565.0, 0.0]
37
+ ]
38
+ end
39
+ end
38
40
  end
39
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nubis
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-08-09 00:00:00.000000000 Z
12
+ date: 2019-01-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport