bitex 0.1.10 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -20,7 +20,7 @@ Or install it yourself as:
20
20
 
21
21
  ## Use Public Market Data
22
22
 
23
- Bitex::BitcoinMarketData and Bitex::LitecoinMarketData classes have methods for
23
+ Bitex::BitcoinMarketData has methods for
24
24
  fetching all public market data available.
25
25
 
26
26
  ### Ticker
@@ -61,7 +61,7 @@ on that page. Once done you can start using it as follows:
61
61
 
62
62
  ### Place an Ask
63
63
 
64
- ruby > Bitex::Ask.create!(:ltc, 2, 500) # Sell 2 LTC
64
+ ruby > Bitex::Ask.create!(:btc, 2, 500) # Try to sell 2 Btc at $500 each.
65
65
 
66
66
  ### List your pending or recently active orders
67
67
 
@@ -1,6 +1,6 @@
1
1
  module Bitex
2
2
  # Public market data for a specie, do not use directly, use
3
- # {BitcoinMarketData} and {LitecoinMarketData} instead.
3
+ # {BitcoinMarketData} instead.
4
4
  class MarketData
5
5
 
6
6
  # The species currency ticker conveniently formatted as a ruby Hash with
@@ -57,11 +57,4 @@ module Bitex
57
57
  'btc'
58
58
  end
59
59
  end
60
-
61
- # A {MarketData} for Litecoin.
62
- class LitecoinMarketData < MarketData
63
- def self.specie
64
- 'ltc'
65
- end
66
- end
67
60
  end
@@ -1,3 +1,3 @@
1
1
  module Bitex
2
- VERSION = "0.1.10"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -1 +1 @@
1
- {"usd_balance":10000.00,"usd_reserved":2000.00,"usd_available":8000.00,"btc_balance":20.00000000,"btc_reserved":5.00000000,"btc_available":15.00000000,"ltc_balance":250.00000000,"ltc_reserved":100.00000000,"ltc_available":150.00000000,"fee":0.5,"btc_deposit_address":"1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","ltc_deposit_address":"LXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"}
1
+ {"usd_balance":10000.00,"usd_reserved":2000.00,"usd_available":8000.00,"btc_balance":20.00000000,"btc_reserved":5.00000000,"btc_available":15.00000000,"fee":0.5,"btc_deposit_address":"1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"}
@@ -1,46 +1,39 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Bitex::MarketData do
4
-
5
- { btc: Bitex::BitcoinMarketData,
6
- ltc: Bitex::LitecoinMarketData
7
- }.each do |specie, market_data|
8
- describe "when getting #{specie} market data" do
9
- it "gets the ticker" do
10
- stub_get("/#{specie}/market/ticker", 'market_ticker')
11
- market_data.ticker.should == {
12
- last: 639.0, high: 659.0, low: 639.0, vwap: 647.195852839369,
13
- volume: 4.80579022, bid: 637.0, ask: 638.5
14
- }
15
- end
16
-
17
- it "gets the order book" do
18
- stub_get("/#{specie}/market/order_book", 'order_book')
19
- market_data.order_book.should == {
20
- bids: [[639.21,1.95],[637.0,0.47],[630.0,1.58]],
21
- asks: [[642.4,0.4],[643.3,0.95],[644.3,0.25]]
22
- }
23
- end
24
-
25
- it "gets the transactions" do
26
- stub_get("/#{specie}/market/transactions", 'transactions')
27
- market_data.transactions.should == [
28
- [1404259180, 1272, 650.0, 0.5],
29
- [1404259179, 1271, 639.0, 0.46948356]
30
- ]
31
- end
32
-
33
- %w(last_24_hours last_7_days last_30_days).each do |method|
34
- it "gets aggregated data for #{method}" do
35
- stub_get("/#{specie}/market/#{method}", 'aggregated_data')
36
- market_data.send(method).should == [
37
- [1403668800, 570.0, 574.0, 570.0, 574.0, 1.06771929, 571.0, 570.917848641659],
38
- [1403683200, 560.0, 570.0, 560.0, 570.0, 1.14175147, 565.0, 565.753596095655],
39
- [1403697600, 560.0, 560.0, 560.0, 560.0, 0.0, 565.0, 0.0],
40
- [1403712000, 560.0, 560.0, 560.0, 560.0, 0.0, 565.0, 0.0]
41
- ]
42
- end
43
- end
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]
36
+ ]
44
37
  end
45
38
  end
46
39
  end
@@ -12,12 +12,8 @@ describe Bitex::Profile do
12
12
  btc_balance: 20.0,
13
13
  btc_reserved: 5.0,
14
14
  btc_available: 15.0,
15
- ltc_balance: 250.0,
16
- ltc_reserved: 100.0,
17
- ltc_available: 150.0,
18
15
  fee: 0.5,
19
16
  btc_deposit_address: "1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
20
- ltc_deposit_address: "LXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
21
17
  }
22
18
  end
23
19
  end
@@ -59,14 +59,14 @@ describe Bitex::SpecieWithdrawal do
59
59
  end
60
60
 
61
61
  it 'creates a new withdrawal' do
62
- stub_private(:post, "/private/ltc/withdrawals", 'specie_withdrawal', {
62
+ stub_private(:post, "/private/btc/withdrawals", 'specie_withdrawal', {
63
63
  address: '1ADDR',
64
64
  amount: 110,
65
65
  label: 'thelabel',
66
66
  })
67
- deposit = Bitex::SpecieWithdrawal.create!(:ltc, '1ADDR', 110, 'thelabel')
68
- deposit.should be_a Bitex::SpecieWithdrawal
69
- deposit.status.should == :received
67
+ withdrawal = Bitex::SpecieWithdrawal.create!(:btc, '1ADDR', 110, 'thelabel')
68
+ withdrawal.should be_a Bitex::SpecieWithdrawal
69
+ withdrawal.status.should == :received
70
70
  end
71
71
 
72
72
  it 'finds a single usd deposit' do
@@ -21,14 +21,6 @@ shared_examples_for 'Order' do |api_path|
21
21
  order.status.should == :received
22
22
  end
23
23
 
24
- it 'places for ltc' do
25
- stub_private(:post, "/private/#{api_path}", "#{api_path}_create",
26
- {amount: 100.50, price: 1000.00, specie: 2})
27
- order = subject.class.create!(:ltc, 100.50, 1000.00)
28
- order.should be_a subject.class
29
- order.status.should == :received
30
- end
31
-
32
24
  it 'places for btc and waits until processed by our matching engine' do
33
25
  stub_private(:post, "/private/#{api_path}", "#{api_path}_create",
34
26
  {amount: 100.50, price: 1000.00, specie: 1})
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.1.10
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-01-05 00:00:00.000000000 Z
13
+ date: 2015-02-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport