rbtc_arbitrage 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +6 -6
  2. data/.rspec +1 -1
  3. data/.travis.yml +13 -3
  4. data/Gemfile +10 -0
  5. data/Guardfile +8 -0
  6. data/README.md +41 -3
  7. data/btce-api-key.yml +2 -0
  8. data/lib/rbtc_arbitrage/campbx.rb +98 -0
  9. data/lib/rbtc_arbitrage/cli.rb +3 -1
  10. data/lib/rbtc_arbitrage/client.rb +45 -0
  11. data/lib/rbtc_arbitrage/clients/bitstamp_client.rb +52 -0
  12. data/lib/rbtc_arbitrage/clients/mtgox_client.rb +45 -0
  13. data/lib/rbtc_arbitrage/trader.rb +62 -66
  14. data/lib/rbtc_arbitrage/version.rb +1 -1
  15. data/lib/rbtc_arbitrage.rb +3 -1
  16. data/rbtc_arbitrage.gemspec +2 -0
  17. data/spec/cli_spec.rb +8 -0
  18. data/spec/client_spec.rb +18 -0
  19. data/spec/clients/bitstamp_client_spec.rb +53 -0
  20. data/spec/clients/mtgox_client_spec.rb +52 -0
  21. data/spec/spec_helper.rb +27 -12
  22. data/spec/support/cassettes/RbtcArbitrage_Clients_BitstampClient/_balance/fetches_the_balance_correctly.yml +96 -0
  23. data/spec/support/cassettes/RbtcArbitrage_Clients_BitstampClient/_price/fetches_price_for_buy_correctly.yml +52 -0
  24. data/spec/support/cassettes/RbtcArbitrage_Clients_BitstampClient/_price/fetches_price_for_sell_correctly.yml +52 -0
  25. data/spec/support/cassettes/RbtcArbitrage_Clients_BitstampClient/_price/fetches_prices_correctly.yml +44 -0
  26. data/spec/support/cassettes/RbtcArbitrage_Clients_MtGoxClient/_balance/fetches_the_balance_correctly.yml +77 -0
  27. data/spec/support/cassettes/RbtcArbitrage_Clients_MtGoxClient/_price/fetches_price_for_buy_correctly.yml +44 -0
  28. data/spec/support/cassettes/RbtcArbitrage_Clients_MtGoxClient/_price/fetches_price_for_sell_correctly.yml +44 -0
  29. data/spec/support/cassettes/RbtcArbitrage_Clients_MtGoxClient/_price/fetches_prices_correctly.yml +85 -0
  30. data/spec/support/cassettes/RbtcArbitrage_Trader/_execute_trade/should_raise_SecurityError_if_not_live.yml +93 -0
  31. data/spec/support/cassettes/RbtcArbitrage_Trader/_execute_trade/when_live/raises_SecurityError_if_not_enough_BTC.yml +86 -0
  32. data/spec/support/cassettes/RbtcArbitrage_Trader/_execute_trade/when_live/raises_SecurityError_if_not_enough_USD.yml +80 -0
  33. data/spec/support/cassettes/RbtcArbitrage_Trader/_execute_trade/when_live/should_fetch_balance.yml +225 -0
  34. data/spec/support/cassettes/RbtcArbitrage_Trader/_execute_trade/when_live/shouldn_t_raise_security_error.yml +262 -0
  35. data/spec/support/cassettes/RbtcArbitrage_Trader/_fetch_prices/gets_the_right_price_set.yml +176 -0
  36. data/spec/support/cassettes/RbtcArbitrage_Trader/_get_balance/fetches_the_right_balance.yml +166 -0
  37. data/spec/trader_spec.rb +156 -19
  38. metadata +89 -18
@@ -0,0 +1,53 @@
1
+ require 'spec_helper'
2
+
3
+ describe RbtcArbitrage::Clients::BitstampClient do
4
+ let(:client) { RbtcArbitrage::Clients::BitstampClient.new }
5
+ before(:each) { client.validate_env }
6
+
7
+ describe "#balance" do
8
+ it "fetches the balance correctly", :vcr do
9
+ balances = Bitstamp.balance
10
+ client.balance.should == [balances["usd_available"].to_f, balances["btc_available"].to_f]
11
+ end
12
+ end
13
+
14
+ describe "#price" do
15
+ [:buy, :sell].each do |action|
16
+ it "fetches price for #{action} correctly", :vcr do
17
+ client.price(action).should be_a(Float)
18
+ end
19
+ end
20
+
21
+ [[:bid, :sell], [:ask, :buy]].each do |actions|
22
+ it "calls Bistamp with #{actions[0]}" do
23
+ hash = Hashie::Mash.new("#{actions[0]}".to_sym => 10)
24
+ hash.should_receive(:"#{actions[0]}")
25
+ Bitstamp.should_receive(:ticker) { hash }
26
+ client.price(actions[1])
27
+ end
28
+ end
29
+ end
30
+
31
+ describe "#trade" do
32
+ [:buy, :sell].each do |action|
33
+ it "trades on Bitstamp with #{action}" do
34
+ client.instance_variable_set("@price", 1)
35
+ trade_price = {
36
+ buy: 1.001,
37
+ sell: 0.999,
38
+ }[action]
39
+ bitstamp_options = {amount: 0.01, price: trade_price}
40
+ Bitstamp.orders.should_receive(action).with(bitstamp_options)
41
+ client.trade(action)
42
+ end
43
+ end
44
+ end
45
+
46
+ describe "#transfer" do
47
+ it "calls Bitstamp correctly" do
48
+ sell_client = RbtcArbitrage::Clients::MtGoxClient.new
49
+ Bitstamp.should_receive(:transfer).with(0.01, sell_client.address)
50
+ client.transfer sell_client
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,52 @@
1
+ require 'spec_helper'
2
+
3
+ describe RbtcArbitrage::Clients::MtGoxClient do
4
+ let(:client) { RbtcArbitrage::Clients::MtGoxClient.new }
5
+ before(:each) { client.validate_env }
6
+
7
+ describe "#balance" do
8
+ it "fetches the balance correctly", :vcr do
9
+ balances = MtGox.balance
10
+ balance = client.balance
11
+ balance.should == [balances[0].amount.to_f, balances[1].amount.to_f]
12
+ end
13
+ end
14
+
15
+ describe "#price" do
16
+ [:buy, :sell].each do |action|
17
+ it "fetches price for #{action} correctly", :vcr do
18
+ client.price(action).should be_a(BigDecimal)
19
+ end
20
+ end
21
+
22
+ it "calls MtGox" do
23
+ hash = Hashie::Mash.new(buy: 10)
24
+ hash.should_receive(:buy)
25
+ MtGox.should_receive(:ticker) { hash }
26
+ client.price(:sell)
27
+
28
+ hash = Hashie::Mash.new(sell: 10)
29
+ hash.should_receive(:sell)
30
+ MtGox.should_receive(:ticker) { hash }
31
+ client.price(:buy)
32
+ end
33
+ end
34
+
35
+ describe "#trade" do
36
+ it "calls MtGox" do
37
+ MtGox.should_receive(:sell!).with(0.01, :market)
38
+ client.trade(:sell)
39
+
40
+ MtGox.should_receive(:buy!).with(0.01, :market)
41
+ client.trade(:buy)
42
+ end
43
+ end
44
+
45
+ describe "#transfer" do
46
+ it "calls MtGox correctly" do
47
+ sell_client = RbtcArbitrage::Clients::BitstampClient.new
48
+ MtGox.should_receive(:withdraw!).with(0.01, sell_client.address)
49
+ client.transfer sell_client
50
+ end
51
+ end
52
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,19 +1,34 @@
1
- # This file was generated by the `rspec --init` command. Conventionally, all
2
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
- # Require this file using `require "spec_helper"` to ensure that it is only
4
- # loaded once.
5
- #
6
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
- require 'rbtc_arbitrage'
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+ require 'codeclimate-test-reporter'
4
+
5
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
6
+ SimpleCov::Formatter::HTMLFormatter,
7
+ Coveralls::SimpleCov::Formatter,
8
+ # CodeClimate::TestReporter::Formatter
9
+ ]
10
+ SimpleCov.start do
11
+ add_filter "/spec/"
12
+ add_filter "/lib/rbtc_arbitrage/campbx.rb"
13
+ end
14
+
15
+ require 'bundler'
16
+ Bundler.require
17
+
18
+ VCR.configure do |c|
19
+ c.cassette_library_dir = 'spec/support/cassettes'
20
+ c.hook_into :webmock # or :fakeweb
21
+ c.ignore_localhost = true
22
+ c.ignore_hosts 'codeclimate.com'
23
+ c.ignore_request do |request|
24
+ # true
25
+ end
26
+ c.configure_rspec_metadata!
27
+ end
8
28
 
9
29
  RSpec.configure do |config|
10
30
  config.treat_symbols_as_metadata_keys_with_true_values = true
11
31
  config.run_all_when_everything_filtered = true
12
32
  config.filter_run :focus
13
-
14
- # Run specs in random order to surface order dependencies. If you find an
15
- # order dependency and want to debug it, you can fix the order by providing
16
- # the seed, which is printed after each run.
17
- # --seed 1234
18
33
  config.order = 'random'
19
34
  end
@@ -0,0 +1,96 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://www.bitstamp.net/api/balance/
6
+ body:
7
+ headers: {}
8
+ response:
9
+ status:
10
+ code: 200
11
+ message: OK
12
+ headers:
13
+ Date:
14
+ - Tue, 17 Dec 2013 18:40:02 GMT
15
+ Server:
16
+ - Apache
17
+ Content-Language:
18
+ - en
19
+ Expires:
20
+ - Tue, 17 Dec 2013 18:40:02 GMT
21
+ Vary:
22
+ - Accept-Language
23
+ Cache-Control:
24
+ - max-age=0
25
+ Last-Modified:
26
+ - Tue, 17 Dec 2013 18:40:02 GMT
27
+ Connection:
28
+ - close
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Content-Type:
32
+ - application/json
33
+ Set-Cookie:
34
+ - incap_ses_124_99025=/U1EcazP+UfdRdBvBoq4AYKasFIAAAAAdb3zOl4ewZCjqVwIQR8HRg==;
35
+ path=/; Domain=.bitstamp.net
36
+ - nlbi_99025=6To6TWWds1Vw9zhaItob8gAAAABgpcZ6AsnAXA2RDnqQ2T1z; path=/; Domain=.bitstamp.net
37
+ - visid_incap_99025=MMLr1fRQQF+jMYOwRSsxz4GasFIAAAAAQUIPAAAAAABoL4fhNvllL6g2wd8gq/Zs;
38
+ expires=Thu, 17 Dec 2015 17:12:31 GMT; path=/; Domain=.bitstamp.net
39
+ X-Iinfo:
40
+ - 6-3497408-3497716 NNNY CT(200 202 0) RT(1387305600895 539) q(0 0 4 0) r(4
41
+ 7) U6
42
+ X-Cdn:
43
+ - Incapsula
44
+ body:
45
+ encoding: ASCII-8BIT
46
+ string: '{"btc_reserved": "0", "fee": "0.5000", "btc_available": "0", "usd_reserved":
47
+ "0", "btc_balance": "0", "usd_balance": "0.00", "usd_available": "0.00"}'
48
+ http_version:
49
+ recorded_at: Tue, 17 Dec 2013 18:40:03 GMT
50
+ - request:
51
+ method: post
52
+ uri: https://www.bitstamp.net/api/balance/
53
+ headers: {}
54
+ response:
55
+ status:
56
+ code: 200
57
+ message: OK
58
+ headers:
59
+ Date:
60
+ - Tue, 17 Dec 2013 18:40:03 GMT
61
+ Server:
62
+ - Apache
63
+ Content-Language:
64
+ - en
65
+ Expires:
66
+ - Tue, 17 Dec 2013 18:40:03 GMT
67
+ Vary:
68
+ - Accept-Language
69
+ Cache-Control:
70
+ - max-age=0
71
+ Last-Modified:
72
+ - Tue, 17 Dec 2013 18:40:03 GMT
73
+ Connection:
74
+ - close
75
+ Transfer-Encoding:
76
+ - chunked
77
+ Content-Type:
78
+ - application/json
79
+ Set-Cookie:
80
+ - incap_ses_124_99025=LlOzDxXjiiDdRdBvBoq4AYOasFIAAAAAjKStMu6sRoI8G9vBobzXaw==;
81
+ path=/; Domain=.bitstamp.net
82
+ - nlbi_99025=iC3WZwFDbyNNIFu9Itob8gAAAABlF1MNYf5CBe4QsTL4PfH8; path=/; Domain=.bitstamp.net
83
+ - visid_incap_99025=MMLr1fRQQF+jMYOwRSsxz4GasFIAAAAAQUIPAAAAAABoL4fhNvllL6g2wd8gq/Zs;
84
+ expires=Thu, 17 Dec 2015 17:12:31 GMT; path=/; Domain=.bitstamp.net
85
+ X-Iinfo:
86
+ - 6-3498335-3498462 NNNY CT(193 217 0) RT(1387305602232 162) q(0 0 5 0) r(5
87
+ 7) U6
88
+ X-Cdn:
89
+ - Incapsula
90
+ body:
91
+ encoding: ASCII-8BIT
92
+ string: '{"btc_reserved": "0", "fee": "0.5000", "btc_available": "0", "usd_reserved":
93
+ "0", "btc_balance": "0", "usd_balance": "0.00", "usd_available": "0.00"}'
94
+ http_version:
95
+ recorded_at: Tue, 17 Dec 2013 18:40:04 GMT
96
+ recorded_with: VCR 2.7.0
@@ -0,0 +1,52 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.bitstamp.net/api/ticker/
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Date:
16
+ - Tue, 17 Dec 2013 18:52:04 GMT
17
+ Server:
18
+ - Apache
19
+ Content-Language:
20
+ - en
21
+ Expires:
22
+ - Tue, 17 Dec 2013 18:52:04 GMT
23
+ Vary:
24
+ - Accept-Language
25
+ Cache-Control:
26
+ - max-age=0
27
+ Last-Modified:
28
+ - Tue, 17 Dec 2013 18:52:04 GMT
29
+ Connection:
30
+ - close
31
+ Transfer-Encoding:
32
+ - chunked
33
+ Content-Type:
34
+ - application/json
35
+ Set-Cookie:
36
+ - incap_ses_124_99025=5DhUG6HHpgc7/tZvBoq4AVSdsFIAAAAAoM6lqyNWcwlVvCFr/4IIuw==;
37
+ path=/; Domain=.bitstamp.net
38
+ - nlbi_99025=HA9ZcYGgIXoCBMJHItob8gAAAACXpbRiMvo8jSczT4T6cKpV; path=/; Domain=.bitstamp.net
39
+ - visid_incap_99025=8mFx8YHMTyKSmlu5q6QgKlSdsFIAAAAAQUIPAAAAAADPhKj72XMvuuLQmfmN6bUE;
40
+ expires=Thu, 17 Dec 2015 17:22:01 GMT; path=/; Domain=.bitstamp.net
41
+ X-Iinfo:
42
+ - 2-306226-306234 NNNY CT(200 200 0) RT(1387306323909 189) q(0 0 4 -1) r(4 7)
43
+ U13
44
+ X-Cdn:
45
+ - Incapsula
46
+ body:
47
+ encoding: ASCII-8BIT
48
+ string: '{"high": "750.00", "last": "715.00", "timestamp": "1387306318", "bid":
49
+ "715.00", "volume": "64331.27905889", "low": "612.51", "ask": "716.44"}'
50
+ http_version:
51
+ recorded_at: Tue, 17 Dec 2013 18:52:06 GMT
52
+ recorded_with: VCR 2.7.0
@@ -0,0 +1,52 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.bitstamp.net/api/ticker/
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Date:
16
+ - Tue, 17 Dec 2013 18:52:06 GMT
17
+ Server:
18
+ - Apache
19
+ Content-Language:
20
+ - en
21
+ Expires:
22
+ - Tue, 17 Dec 2013 18:52:06 GMT
23
+ Vary:
24
+ - Accept-Language
25
+ Cache-Control:
26
+ - max-age=0
27
+ Last-Modified:
28
+ - Tue, 17 Dec 2013 18:52:06 GMT
29
+ Connection:
30
+ - close
31
+ Transfer-Encoding:
32
+ - chunked
33
+ Content-Type:
34
+ - application/json
35
+ Set-Cookie:
36
+ - incap_ses_124_99025=EG6NVFY4Zj3MANdvBoq4AVWdsFIAAAAAJ5HXgArrNoPSLKMXyrPmIA==;
37
+ path=/; Domain=.bitstamp.net
38
+ - nlbi_99025=BEeSMWMBHh4P8h8yItob8gAAAAByf4B7gSxAE4n9qUXQRygm; path=/; Domain=.bitstamp.net
39
+ - visid_incap_99025=8DwVZBcRQHCx3jP6h7xR7VWdsFIAAAAAQUIPAAAAAAD2kz0IxzLs0UNgtTywlZwj;
40
+ expires=Thu, 17 Dec 2015 17:22:01 GMT; path=/; Domain=.bitstamp.net
41
+ X-Iinfo:
42
+ - 5-2963838-2963878 NNNY CT(195 201 0) RT(1387306325135 166) q(0 0 3 -1) r(3
43
+ 6) U13
44
+ X-Cdn:
45
+ - Incapsula
46
+ body:
47
+ encoding: ASCII-8BIT
48
+ string: '{"high": "750.00", "last": "715.00", "timestamp": "1387306318", "bid":
49
+ "715.00", "volume": "64331.27905889", "low": "612.51", "ask": "716.44"}'
50
+ http_version:
51
+ recorded_at: Tue, 17 Dec 2013 18:52:06 GMT
52
+ recorded_with: VCR 2.7.0
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://data.mtgox.com/api/1/BTCUSD/ticker
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ User-Agent:
13
+ - mtgox gem 1.1.0
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx/1.4.4
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ X-Powered-By:
26
+ - PHP/5.5.4
27
+ Access-Control-Allow-Origin:
28
+ - '*'
29
+ Content-Length:
30
+ - '1387'
31
+ Cache-Control:
32
+ - public, max-age=27
33
+ Expires:
34
+ - Tue, 17 Dec 2013 18:41:04 GMT
35
+ Date:
36
+ - Tue, 17 Dec 2013 18:40:37 GMT
37
+ Connection:
38
+ - keep-alive
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"result":"success","return":{"high":{"value":"824.88888","value_int":"82488888","display":"$824.89","display_short":"$824.89","currency":"USD"},"low":{"value":"678.89040","value_int":"67889040","display":"$678.89","display_short":"$678.89","currency":"USD"},"avg":{"value":"741.06661","value_int":"74106661","display":"$741.07","display_short":"$741.07","currency":"USD"},"vwap":{"value":"738.12158","value_int":"73812158","display":"$738.12","display_short":"$738.12","currency":"USD"},"vol":{"value":"47976.69175988","value_int":"4797669175988","display":"47,976.69\u00a0BTC","display_short":"47,976.69\u00a0BTC","currency":"BTC"},"last_local":{"value":"746.00000","value_int":"74600000","display":"$746.00","display_short":"$746.00","currency":"USD"},"last_orig":{"value":"77000.000","value_int":"77000000","display":"\u00a577,000","display_short":"\u00a577,000","currency":"JPY"},"last_all":{"value":"747.69296","value_int":"74769296","display":"$747.69","display_short":"$747.69","currency":"USD"},"last":{"value":"746.00000","value_int":"74600000","display":"$746.00","display_short":"$746.00","currency":"USD"},"buy":{"value":"746.00000","value_int":"74600000","display":"$746.00","display_short":"$746.00","currency":"USD"},"sell":{"value":"749.40000","value_int":"74940000","display":"$749.40","display_short":"$749.40","currency":"USD"},"item":"BTC","now":"1387305632161184"}}'
42
+ http_version:
43
+ recorded_at: Tue, 17 Dec 2013 18:40:38 GMT
44
+ recorded_with: VCR 2.7.0
@@ -0,0 +1,77 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://data.mtgox.com/api/1/generic/info
6
+ body:
7
+ encoding: US-ASCII
8
+ string: nonce=1387161061259915
9
+ response:
10
+ status:
11
+ code: 200
12
+ message: OK
13
+ headers:
14
+ Server:
15
+ - nginx/1.4.4
16
+ Content-Type:
17
+ - application/json; charset=utf-8
18
+ X-Powered-By:
19
+ - PHP/5.5.4
20
+ Access-Control-Allow-Origin:
21
+ - '*'
22
+ Content-Length:
23
+ - '1731'
24
+ Expires:
25
+ - Mon, 16 Dec 2013 02:31:02 GMT
26
+ Cache-Control:
27
+ - max-age=0, no-cache, no-store
28
+ Pragma:
29
+ - no-cache
30
+ Date:
31
+ - Mon, 16 Dec 2013 02:31:02 GMT
32
+ Connection:
33
+ - keep-alive
34
+ body:
35
+ encoding: UTF-8
36
+ string: '{"result":"success","return":{"Login":"heynk","Index":"141119","Id":"84fdd298-4386-4d7c-86c0-af74f2e0d0ec","Link":"M82141119X","Rights":["deposit","get_info","merchant","trade","withdraw"],"Language":"en_US","Created":"2012-04-07
37
+ 13:52:16","Last_Login":"2013-10-15 20:52:29","Wallets":{"BTC":{"Balance":{"value":"0.00000133","value_int":"133","display":"0.00000133\u00a0BTC","display_short":"0.00\u00a0BTC","currency":"BTC"},"Operations":1,"Daily_Withdraw_Limit":{"value":"100.00000000","value_int":"10000000000","display":"100.00000000\u00a0BTC","display_short":"100.00\u00a0BTC","currency":"BTC"},"Monthly_Withdraw_Limit":null,"Max_Withdraw":{"value":"100.00000000","value_int":"10000000000","display":"100.00000000\u00a0BTC","display_short":"100.00\u00a0BTC","currency":"BTC"},"Open_Orders":{"value":"0.00000000","value_int":"0","display":"0.00000000\u00a0BTC","display_short":"0.00\u00a0BTC","currency":"BTC"}},"USD":{"Balance":{"value":"0.00000","value_int":"0","display":"$0.00000","display_short":"$0.00","currency":"USD"},"Operations":0,"Daily_Withdraw_Limit":{"value":"1000.00000","value_int":"100000000","display":"$1,000.00000","display_short":"$1,000.00","currency":"USD"},"Monthly_Withdraw_Limit":{"value":"10000.00000","value_int":"1000000000","display":"$10,000.00000","display_short":"$10,000.00","currency":"USD"},"Max_Withdraw":{"value":"1000.00000","value_int":"100000000","display":"$1,000.00000","display_short":"$1,000.00","currency":"USD"},"Open_Orders":{"value":"0.00000","value_int":"0","display":"$0.00000","display_short":"$0.00","currency":"USD"}}},"Monthly_Volume":{"value":"0.00000000","value_int":"0","display":"0.00000000\u00a0BTC","display_short":"0.00\u00a0BTC","currency":"BTC"},"Trade_Fee":0.6}}'
38
+ http_version:
39
+ recorded_at: Mon, 16 Dec 2013 02:31:02 GMT
40
+ - request:
41
+ method: post
42
+ uri: https://data.mtgox.com/api/1/generic/info
43
+ body:
44
+ encoding: US-ASCII
45
+ string: nonce=1387161062673595
46
+ response:
47
+ status:
48
+ code: 200
49
+ message: OK
50
+ headers:
51
+ Server:
52
+ - nginx/1.4.4
53
+ Content-Type:
54
+ - application/json; charset=utf-8
55
+ X-Powered-By:
56
+ - PHP/5.5.4
57
+ Access-Control-Allow-Origin:
58
+ - '*'
59
+ Content-Length:
60
+ - '1731'
61
+ Expires:
62
+ - Mon, 16 Dec 2013 02:31:03 GMT
63
+ Cache-Control:
64
+ - max-age=0, no-cache, no-store
65
+ Pragma:
66
+ - no-cache
67
+ Date:
68
+ - Mon, 16 Dec 2013 02:31:03 GMT
69
+ Connection:
70
+ - keep-alive
71
+ body:
72
+ encoding: UTF-8
73
+ string: '{"result":"success","return":{"Login":"heynk","Index":"141119","Id":"84fdd298-4386-4d7c-86c0-af74f2e0d0ec","Link":"M82141119X","Rights":["deposit","get_info","merchant","trade","withdraw"],"Language":"en_US","Created":"2012-04-07
74
+ 13:52:16","Last_Login":"2013-10-15 20:52:29","Wallets":{"BTC":{"Balance":{"value":"0.00000133","value_int":"133","display":"0.00000133\u00a0BTC","display_short":"0.00\u00a0BTC","currency":"BTC"},"Operations":1,"Daily_Withdraw_Limit":{"value":"100.00000000","value_int":"10000000000","display":"100.00000000\u00a0BTC","display_short":"100.00\u00a0BTC","currency":"BTC"},"Monthly_Withdraw_Limit":null,"Max_Withdraw":{"value":"100.00000000","value_int":"10000000000","display":"100.00000000\u00a0BTC","display_short":"100.00\u00a0BTC","currency":"BTC"},"Open_Orders":{"value":"0.00000000","value_int":"0","display":"0.00000000\u00a0BTC","display_short":"0.00\u00a0BTC","currency":"BTC"}},"USD":{"Balance":{"value":"0.00000","value_int":"0","display":"$0.00000","display_short":"$0.00","currency":"USD"},"Operations":0,"Daily_Withdraw_Limit":{"value":"1000.00000","value_int":"100000000","display":"$1,000.00000","display_short":"$1,000.00","currency":"USD"},"Monthly_Withdraw_Limit":{"value":"10000.00000","value_int":"1000000000","display":"$10,000.00000","display_short":"$10,000.00","currency":"USD"},"Max_Withdraw":{"value":"1000.00000","value_int":"100000000","display":"$1,000.00000","display_short":"$1,000.00","currency":"USD"},"Open_Orders":{"value":"0.00000","value_int":"0","display":"$0.00000","display_short":"$0.00","currency":"USD"}}},"Monthly_Volume":{"value":"0.00000000","value_int":"0","display":"0.00000000\u00a0BTC","display_short":"0.00\u00a0BTC","currency":"BTC"},"Trade_Fee":0.6}}'
75
+ http_version:
76
+ recorded_at: Mon, 16 Dec 2013 02:31:03 GMT
77
+ recorded_with: VCR 2.7.0
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://data.mtgox.com/api/1/BTCUSD/ticker
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ User-Agent:
13
+ - mtgox gem 1.1.0
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx/1.4.4
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ X-Powered-By:
26
+ - PHP/5.5.4
27
+ Access-Control-Allow-Origin:
28
+ - '*'
29
+ Content-Length:
30
+ - '1377'
31
+ Cache-Control:
32
+ - public, max-age=19
33
+ Expires:
34
+ - Tue, 17 Dec 2013 18:52:46 GMT
35
+ Date:
36
+ - Tue, 17 Dec 2013 18:52:27 GMT
37
+ Connection:
38
+ - keep-alive
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"result":"success","return":{"high":{"value":"824.88888","value_int":"82488888","display":"$824.89","display_short":"$824.89","currency":"USD"},"low":{"value":"678.89040","value_int":"67889040","display":"$678.89","display_short":"$678.89","currency":"USD"},"avg":{"value":"740.58273","value_int":"74058273","display":"$740.58","display_short":"$740.58","currency":"USD"},"vwap":{"value":"737.16841","value_int":"73716841","display":"$737.17","display_short":"$737.17","currency":"USD"},"vol":{"value":"46591.37947288","value_int":"4659137947288","display":"46,591.38\u00a0BTC","display_short":"46,591.38\u00a0BTC","currency":"BTC"},"last_local":{"value":"746.00000","value_int":"74600000","display":"$746.00","display_short":"$746.00","currency":"USD"},"last_orig":{"value":"746.00000","value_int":"74600000","display":"$746.00","display_short":"$746.00","currency":"USD"},"last_all":{"value":"746.00000","value_int":"74600000","display":"$746.00","display_short":"$746.00","currency":"USD"},"last":{"value":"746.00000","value_int":"74600000","display":"$746.00","display_short":"$746.00","currency":"USD"},"buy":{"value":"746.00000","value_int":"74600000","display":"$746.00","display_short":"$746.00","currency":"USD"},"sell":{"value":"747.00000","value_int":"74700000","display":"$747.00","display_short":"$747.00","currency":"USD"},"item":"BTC","now":"1387306337410204"}}'
42
+ http_version:
43
+ recorded_at: Tue, 17 Dec 2013 18:52:28 GMT
44
+ recorded_with: VCR 2.7.0
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://data.mtgox.com/api/1/BTCUSD/ticker
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ User-Agent:
13
+ - mtgox gem 1.1.0
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx/1.4.4
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ X-Powered-By:
26
+ - PHP/5.5.4
27
+ Access-Control-Allow-Origin:
28
+ - '*'
29
+ Content-Length:
30
+ - '1377'
31
+ Cache-Control:
32
+ - public, max-age=19
33
+ Expires:
34
+ - Tue, 17 Dec 2013 18:52:46 GMT
35
+ Date:
36
+ - Tue, 17 Dec 2013 18:52:27 GMT
37
+ Connection:
38
+ - keep-alive
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"result":"success","return":{"high":{"value":"824.88888","value_int":"82488888","display":"$824.89","display_short":"$824.89","currency":"USD"},"low":{"value":"678.89040","value_int":"67889040","display":"$678.89","display_short":"$678.89","currency":"USD"},"avg":{"value":"740.58273","value_int":"74058273","display":"$740.58","display_short":"$740.58","currency":"USD"},"vwap":{"value":"737.16841","value_int":"73716841","display":"$737.17","display_short":"$737.17","currency":"USD"},"vol":{"value":"46591.37947288","value_int":"4659137947288","display":"46,591.38\u00a0BTC","display_short":"46,591.38\u00a0BTC","currency":"BTC"},"last_local":{"value":"746.00000","value_int":"74600000","display":"$746.00","display_short":"$746.00","currency":"USD"},"last_orig":{"value":"746.00000","value_int":"74600000","display":"$746.00","display_short":"$746.00","currency":"USD"},"last_all":{"value":"746.00000","value_int":"74600000","display":"$746.00","display_short":"$746.00","currency":"USD"},"last":{"value":"746.00000","value_int":"74600000","display":"$746.00","display_short":"$746.00","currency":"USD"},"buy":{"value":"746.00000","value_int":"74600000","display":"$746.00","display_short":"$746.00","currency":"USD"},"sell":{"value":"747.00000","value_int":"74700000","display":"$747.00","display_short":"$747.00","currency":"USD"},"item":"BTC","now":"1387306337410204"}}'
42
+ http_version:
43
+ recorded_at: Tue, 17 Dec 2013 18:52:28 GMT
44
+ recorded_with: VCR 2.7.0
@@ -0,0 +1,85 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://data.mtgox.com/api/1/BTCUSD/ticker
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ User-Agent:
13
+ - mtgox gem 1.1.0
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx/1.4.4
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ X-Powered-By:
26
+ - PHP/5.5.4
27
+ Access-Control-Allow-Origin:
28
+ - '*'
29
+ Content-Length:
30
+ - '1377'
31
+ Cache-Control:
32
+ - public, max-age=19
33
+ Expires:
34
+ - Mon, 16 Dec 2013 02:37:47 GMT
35
+ Date:
36
+ - Mon, 16 Dec 2013 02:37:28 GMT
37
+ Connection:
38
+ - keep-alive
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"result":"success","return":{"high":{"value":"928.00000","value_int":"92800000","display":"$928.00","display_short":"$928.00","currency":"USD"},"low":{"value":"838.02010","value_int":"83802010","display":"$838.02","display_short":"$838.02","currency":"USD"},"avg":{"value":"881.69362","value_int":"88169362","display":"$881.69","display_short":"$881.69","currency":"USD"},"vwap":{"value":"877.80871","value_int":"87780871","display":"$877.81","display_short":"$877.81","currency":"USD"},"vol":{"value":"15209.28682013","value_int":"1520928682013","display":"15,209.29\u00a0BTC","display_short":"15,209.29\u00a0BTC","currency":"BTC"},"last_local":{"value":"915.00000","value_int":"91500000","display":"$915.00","display_short":"$915.00","currency":"USD"},"last_orig":{"value":"915.00000","value_int":"91500000","display":"$915.00","display_short":"$915.00","currency":"USD"},"last_all":{"value":"915.00000","value_int":"91500000","display":"$915.00","display_short":"$915.00","currency":"USD"},"last":{"value":"915.00000","value_int":"91500000","display":"$915.00","display_short":"$915.00","currency":"USD"},"buy":{"value":"912.40000","value_int":"91240000","display":"$912.40","display_short":"$912.40","currency":"USD"},"sell":{"value":"915.00000","value_int":"91500000","display":"$915.00","display_short":"$915.00","currency":"USD"},"item":"BTC","now":"1387161430752600"}}'
42
+ http_version:
43
+ recorded_at: Mon, 16 Dec 2013 02:37:28 GMT
44
+ - request:
45
+ method: get
46
+ uri: https://data.mtgox.com/api/1/BTCUSD/ticker
47
+ body:
48
+ encoding: US-ASCII
49
+ string: ''
50
+ headers:
51
+ Accept:
52
+ - application/json
53
+ User-Agent:
54
+ - mtgox gem 1.1.0
55
+ Accept-Encoding:
56
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
57
+ response:
58
+ status:
59
+ code: 200
60
+ message: OK
61
+ headers:
62
+ Server:
63
+ - nginx/1.4.4
64
+ Content-Type:
65
+ - application/json; charset=utf-8
66
+ X-Powered-By:
67
+ - PHP/5.5.4
68
+ Access-Control-Allow-Origin:
69
+ - '*'
70
+ Content-Length:
71
+ - '1377'
72
+ Cache-Control:
73
+ - public, max-age=19
74
+ Expires:
75
+ - Mon, 16 Dec 2013 02:37:47 GMT
76
+ Date:
77
+ - Mon, 16 Dec 2013 02:37:28 GMT
78
+ Connection:
79
+ - keep-alive
80
+ body:
81
+ encoding: UTF-8
82
+ string: '{"result":"success","return":{"high":{"value":"928.00000","value_int":"92800000","display":"$928.00","display_short":"$928.00","currency":"USD"},"low":{"value":"838.02010","value_int":"83802010","display":"$838.02","display_short":"$838.02","currency":"USD"},"avg":{"value":"881.69362","value_int":"88169362","display":"$881.69","display_short":"$881.69","currency":"USD"},"vwap":{"value":"877.80871","value_int":"87780871","display":"$877.81","display_short":"$877.81","currency":"USD"},"vol":{"value":"15209.28682013","value_int":"1520928682013","display":"15,209.29\u00a0BTC","display_short":"15,209.29\u00a0BTC","currency":"BTC"},"last_local":{"value":"915.00000","value_int":"91500000","display":"$915.00","display_short":"$915.00","currency":"USD"},"last_orig":{"value":"915.00000","value_int":"91500000","display":"$915.00","display_short":"$915.00","currency":"USD"},"last_all":{"value":"915.00000","value_int":"91500000","display":"$915.00","display_short":"$915.00","currency":"USD"},"last":{"value":"915.00000","value_int":"91500000","display":"$915.00","display_short":"$915.00","currency":"USD"},"buy":{"value":"912.40000","value_int":"91240000","display":"$912.40","display_short":"$912.40","currency":"USD"},"sell":{"value":"915.00000","value_int":"91500000","display":"$915.00","display_short":"$915.00","currency":"USD"},"item":"BTC","now":"1387161430752600"}}'
83
+ http_version:
84
+ recorded_at: Mon, 16 Dec 2013 02:37:28 GMT
85
+ recorded_with: VCR 2.7.0