rbtc_arbitrage 1.0.1 → 1.1.0

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: a1ae715eb30b67673c7fb9efa9cd6a9d7fcbc786
4
- data.tar.gz: ac76073648c581650bece469ab13d79af0034653
3
+ metadata.gz: 148434f269c04f443fcfff7fa4296afcd99c3ebd
4
+ data.tar.gz: 108d60840e184dbb14e8349ca7983a6edeb599b2
5
5
  SHA512:
6
- metadata.gz: 6ef2161031e005cf0b32454b61b2737fe1af44319aa78486e79878fb7af461af21a91411437d8e110fc080496b7095e3dda5b3c95ac1343a0b0e514f62b7d162
7
- data.tar.gz: b140bab5a24e2df05e6314df2f06826cd14144982bf561afe57e1f544d2d4705e3efe19d0e86aa530c7732e9c338f76a503acfe087fa57f9ddf6a210fd8fe779
6
+ metadata.gz: 6502ed6e3c1af4bb81c35b125ee91be0883893d1d494ffcc99e92a3066acac804b6d29cc8223f649836e7f7a7a03a51a71be2e3ab6c147ff00f3bffa81737f97
7
+ data.tar.gz: 6b6652d8fadd9e974282594882b605586da5284d7aa1be6a55a6523dd41a2c2f73930410d916d3c3ebfc0aa4a79bc89bf7058997372fa193ea0aee880264527c
data/.travis.yml CHANGED
@@ -13,3 +13,8 @@ env:
13
13
  - secure: ksmMGyDkwmIUkJIHzdrAld+GN2KEm9l8dtxZikoP7B9zRymhnPhImDfZHbByFV0DIZmNiUMFvNLIIpgznjpFdpcEjCbLQnfniKTscMyQZ1pvOesCyaPnSHBENRDsADFCG/TMeP5VXtUUL2k/eNIzHU0cVJT8JaEMdihPDy+mrO8=
14
14
  - secure: I3rS8d84BoCsZo9c/PcY6F/GDThVu/rPKMjTUGHkbtWXVD8E809JxaWavu/+EesyUhn8dDGwMRUc+4d6gtk+QeQVOyLkkPIaCII4puJEHqdyJpqrJlsZbXaGO/JJ6mx2y0I6wDryKeLhZqVn6VdxycF+7OTqYdCFGV+o49wirIU=
15
15
  - secure: kih2LqMwQDZErJFU4hslPZcAdtYwQIYyzxnkObIWtIQpLAVQNssbISLBe5ogWNXi8FyiEktAH5Yy0orjTp2ynmrA6rE6NU/vD3oBDeeI7CCd+13weeIW+uReyixuI5zn6zzJLHdxn+rUwowfdYrt9vF54uEjKCVL32pbLZjdavk=
16
+ - secure: Y4BCviYqCE0JnumhmuIdGp79qQUMiTjBPruQszf65vivmD3jKXXldY0AzUpxUpHwHVAI755Xyc80IuIFQfo+w2gykK18DFKVuKjRqxxqzRKMzf6sB+haXOm0vK0+2y2E1q9EX7DygXuxuDtGRAOKsvPRZWgPERH67bR+e2mR4+0=
17
+ - secure: bKrqQ2Q2Rp7aR8yGYLplTCPLXck3BbpJsCirxoX6mJpDUsZTiM+sCxHKDnTeBptNaFfJe1JKb0xKhzu9CuY2gHi+XtrUu/yAq4M0+3vWG8h7Ios4ztI2BTnM4yi6vYaKkhdRrHFPdNdiL1/+bWW9/4SH1yOfw17UpnT3YbBdX4s=
18
+ - secure: YLXu/SNHJrhqc6Go9Tk7A2Dwf8XncZtGfRKwSbMb6WdNNw/8Zfd49tcf6FbiJS/THah5j/x4+X6kcxbCzgxndfIqpJNSn5gndYLWHIMWZ4B+ppM76SyvqsyrCWWWBcbnuKI8/FhN+1jvdKCRC1XO5hFbdBLqXMXjrcqTFF78k/Y=
19
+ - secure: IFyJX6lAmBpef0I50UPCy6L5IRxqRKoPhv74s5y0FPB4chrir7iMZ7Sd1IczxV7ly4Dt7hdALHP1qMTmkcGmTV6YOzwR46G4JAwWtX2xlf4OYk4jey7qjNsS6iijD6dvdYjqSKUuGaX3Til3kUOLcA3hhINvHxj5unv2pHB2W70=
20
+ - secure: YiYtCBJNfgWuzQ059RMmZxM00bs4c/GuqaEaKufLPPByJHHt3z4jCNT5lurox/RIqSYTv+1Nvgor1xJZF4VPDIhtoCpVRe3g5Pvubrp4gWQry11ta0f1JhPSrm5ORlF1hpHPfzHHSh+/YVmKcO8agQAaIgfKcXDzsE6j5QqiGWQ=
@@ -2,7 +2,7 @@ require 'thor'
2
2
  require 'mtgox'
3
3
  require_relative 'rbtc_arbitrage/campbx.rb'
4
4
  require 'bitstamp'
5
- # require 'btce'
5
+ require 'btce'
6
6
  require_relative 'rbtc_arbitrage/client.rb'
7
7
  Dir["#{File.dirname(__FILE__)}/rbtc_arbitrage/**/*.rb"].each { |f| require(f) }
8
8
 
@@ -14,10 +14,9 @@ module RbtcArbitrage
14
14
  self
15
15
  end
16
16
 
17
- def validate_keys
18
- ["KEY", "SECRET", "ADDRESS"].each do |suffix|
19
- prefix = exchange.to_s.upcase
20
- key = "#{prefix}_#{suffix}"
17
+ def validate_keys *args
18
+ args.each do |key|
19
+ key = key.to_s.upcase
21
20
  if ENV[key].blank?
22
21
  raise ArgumentError, "Exiting because missing required ENV variable $#{key}."
23
22
  end
@@ -10,7 +10,7 @@ module RbtcArbitrage
10
10
  end
11
11
 
12
12
  def validate_env
13
- validate_keys
13
+ validate_keys :bitstamp_key, :bitstamp_client_id, :bitstamp_secret
14
14
  Bitstamp.setup do |config|
15
15
  config.client_id = ENV["BITSTAMP_CLIENT_ID"]
16
16
  config.key = ENV["BITSTAMP_KEY"]
@@ -0,0 +1,58 @@
1
+ module RbtcArbitrage
2
+ module Clients
3
+ class BtceClient
4
+ include RbtcArbitrage::Client
5
+
6
+ def exchange
7
+ :btce
8
+ end
9
+
10
+ def balance
11
+ return @balance if @balance
12
+ balances = interface.get_info["return"]["funds"]
13
+ @balance = [balances["btc"], balances["usd"]]
14
+ end
15
+
16
+ def interface
17
+ end
18
+
19
+ def validate_env
20
+ validate_keys :btce_key, :btce_secret, :btce_address
21
+ end
22
+
23
+ def trade action
24
+ warning = "BTC-E does not support API bitcoin transfer. "
25
+ warning << "If you really want to trade, you will have "
26
+ warning << "to manually send bitcoin. Enter 'accept' to continue. \n> "
27
+ @options[:logger].warn warning if @options[:verbose]
28
+ return false unless gets.chomp == "accept"
29
+ opts = {
30
+ type: action,
31
+ rate: price(action),
32
+ amount: @options[:volume],
33
+ pair: "btc_usd"
34
+ }
35
+ interface.trade opts
36
+ end
37
+
38
+ def price action
39
+ return @ticker[action.to_s] if @ticker
40
+ @ticker = Btce::Ticker.new("btc_usd").json["ticker"]
41
+ @ticker[action.to_s]
42
+ end
43
+
44
+ def transfer client
45
+ if @options[:verbose]
46
+ error = "BTC-E does not have a 'transfer' API.\n"
47
+ error << "You must transfer bitcoin manually."
48
+ @options[:logger].error error
49
+ end
50
+ end
51
+
52
+ def interface
53
+ opts = {key: ENV['BTCE_KEY'], secret: ENV['BTCE_SECRET']}
54
+ @interface ||= Btce::TradeAPI.new(opts)
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,48 @@
1
+ module RbtcArbitrage
2
+ module Clients
3
+ class CampbxClient
4
+ include RbtcArbitrage::Client
5
+
6
+ def exchange
7
+ :campbx
8
+ end
9
+
10
+ def balance
11
+ return @balance if @balance
12
+ funds = interface.my_funds
13
+ [funds["Total BTC"].to_f, funds["Total USD"].to_f]
14
+ end
15
+
16
+ def interface
17
+ @interface ||= CampBX::API.new(ENV['CAMPBX_KEY'],ENV['CAMPBX_SECRET'])
18
+ end
19
+
20
+ def validate_env
21
+ validate_keys :campbx_key, :campbx_secret
22
+
23
+ end
24
+
25
+ def trade action
26
+ trade_mode = "Quick#{action.to_s.capitalize}"
27
+ interface.trade_enter trade_mode, @options[:volume], price(action)
28
+ end
29
+
30
+ def price action
31
+ return @price if @price
32
+ action = {
33
+ buy: "Best Ask",
34
+ sell: "Best Bid",
35
+ }[action]
36
+ @price = interface.xticker[action].to_f
37
+ end
38
+
39
+ def transfer client
40
+ interface.send_btc client.address, @options[:volume]
41
+ end
42
+
43
+ def address
44
+ @address ||= interface.get_btc_address
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,46 @@
1
+ module RbtcArbitrage
2
+ module Clients
3
+ class ExchangeClient
4
+ include RbtcArbitrage::Client
5
+
6
+ # return a symbol as the name
7
+ # of this exchange
8
+ def exchange
9
+ end
10
+
11
+ # Returns an array of Floats.
12
+ # The first element is the balance in BTC;
13
+ # The second is in USD.
14
+ def balance
15
+ end
16
+
17
+ def interface
18
+ end
19
+
20
+ # Configures the client's API keys.
21
+ def validate_env
22
+ end
23
+
24
+ # `action` is :buy or :sell
25
+ def trade action
26
+ end
27
+
28
+ # `action` is :buy or :sell
29
+ # Returns a Numeric type.
30
+ def price action
31
+ end
32
+
33
+ # Transfers BTC to the address of a different
34
+ # exchange.
35
+ def transfer client
36
+ end
37
+
38
+ # If there is an API method to fetch your
39
+ # BTC address, implement this, otherwise
40
+ # remove this method and set the ENV
41
+ # variable [this-exchange-name-in-caps]_ADDRESS
42
+ def address
43
+ end
44
+ end
45
+ end
46
+ end
@@ -17,7 +17,7 @@ module RbtcArbitrage
17
17
  # Configures the MtGox
18
18
  # client's API keys.
19
19
  def validate_env
20
- validate_keys
20
+ validate_keys :mtgox_key, :mtgox_secret, :mtgox_address
21
21
  MtGox.configure do |config|
22
22
  config.key = ENV["MTGOX_KEY"]
23
23
  config.secret = ENV["MTGOX_SECRET"]
@@ -1,3 +1,3 @@
1
1
  module RbtcArbitrage
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -26,6 +26,6 @@ Gem::Specification.new do |spec|
26
26
  spec.add_dependency "activemodel", ">= 3.1"
27
27
  spec.add_dependency "activesupport", ">= 3.1"
28
28
  spec.add_dependency "thor"
29
- spec.add_dependency "btce"
29
+ spec.add_dependency "btce", '0.2.4'
30
30
  spec.add_dependency "bitstamp"
31
31
  end
data/spec/client_spec.rb CHANGED
@@ -15,4 +15,19 @@ describe RbtcArbitrage::Client do
15
15
  client.should_receive(:trade).with(:buy)
16
16
  client.buy
17
17
  end
18
+
19
+ describe RbtcArbitrage::Clients do
20
+ RbtcArbitrage.clients.each do |client|
21
+ required_methods = [:trade, :balance, :validate_env, :exchange]
22
+ required_methods << [:price, :transfer, :address]
23
+ required_methods.flatten!
24
+ describe client do
25
+ it "has all requred methods" do
26
+ required_methods.each do |meth|
27
+ client.new.methods.should include(meth)
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
18
33
  end
@@ -0,0 +1,88 @@
1
+ require 'spec_helper'
2
+
3
+ describe RbtcArbitrage::Clients::BtceClient do
4
+ let(:client) { RbtcArbitrage::Clients::BtceClient.new(verbose: false) }
5
+ let(:btce) { client.interface }
6
+
7
+ it { client.exchange.should == :btce }
8
+
9
+ before(:each) do
10
+ btce.stub(:get_info) {
11
+ {
12
+ "success" => 1,
13
+ "return" => {
14
+ "funds" => {
15
+ "usd" => 2.57460659,
16
+ "btc" => 0.00012226,
17
+ "ltc" => 3.00815559,
18
+ "nmc" => 0,
19
+ "rur" => 8.0116908,
20
+ "eur" => 0,
21
+ "nvc" => 0,
22
+ "trc" => 0,
23
+ "ppc" => 0,
24
+ "ftc" => 0,
25
+ "xpm" => 0},
26
+ "rights" => {
27
+ "info" => 1,
28
+ "trade" => 0,
29
+ "withdraw" => 0
30
+ },
31
+ "transaction_count" => 120,
32
+ "open_orders" => 1,
33
+ "server_time"=>1385947487
34
+ }
35
+ }
36
+ }
37
+ end
38
+
39
+ describe "#balance" do
40
+ it "fetches the balance correctly", :vcr do
41
+ balances = btce.get_info["return"]["funds"]
42
+ expected = [balances["btc"], balances["usd"]]
43
+ client.balance.should eql(expected)
44
+ client.balance.each do |b|
45
+ b.should be_a(Float)
46
+ end
47
+ end
48
+ end
49
+
50
+ describe "#price" do
51
+ [:buy, :sell].each do |action|
52
+ it "fetches price for #{action} correctly", :vcr do
53
+ client.price(action).should be_a(Float)
54
+ end
55
+ end
56
+
57
+ it "calls btc-e", :vcr do
58
+ ticker = Btce::Ticker.new("btc_usd").json["ticker"]
59
+ client.price(:sell).should == ticker["sell"]
60
+ client.price(:buy).should == ticker["buy"]
61
+ end
62
+ end
63
+
64
+ describe "#trade" do
65
+ it "calls CampBX" do
66
+ client.stub(:gets) { 'accept' }
67
+
68
+ client.instance_variable_set(:@ticker, {"sell" => 10, "buy" => 11})
69
+ opts = {pair: "btc_usd", type: :sell, rate: 10, amount: 0.01}
70
+ btce.should_receive(:trade).with(opts)
71
+ client.trade(:sell)
72
+
73
+ opts[:type] = :buy
74
+ opts[:rate] = 11
75
+ btce.should_receive(:trade).with(opts)
76
+ client.trade(:buy)
77
+ end
78
+ end
79
+
80
+ describe "#transfer" do
81
+ it "calls CampBX correctly" do
82
+ client.options[:verbose] = true
83
+ sell_client = RbtcArbitrage::Clients::BitstampClient.new
84
+ client.options[:logger].should_receive(:error)
85
+ client.transfer(sell_client)
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,66 @@
1
+ require 'spec_helper'
2
+
3
+ describe RbtcArbitrage::Clients::CampbxClient do
4
+ let(:client) { RbtcArbitrage::Clients::CampbxClient.new }
5
+ let(:campbx) { client.interface }
6
+
7
+ before(:each) { client.validate_env }
8
+
9
+ it { client.exchange.should == :campbx }
10
+
11
+ describe "#balance" do
12
+ it "fetches the balance correctly", :vcr do
13
+ balances = campbx.my_funds
14
+ expected = [balances["Total BTC"].to_f, balances["Total USD"].to_f]
15
+ client.balance.should == expected
16
+ end
17
+ end
18
+
19
+ describe "#price" do
20
+ [:buy, :sell].each do |action|
21
+ it "fetches price for #{action} correctly", :vcr do
22
+ client.price(action).should be_a(Float)
23
+ end
24
+ end
25
+
26
+ it "calls CampBX" do
27
+ hash = Hashie::Mash.new("Best Bid" => 10)
28
+ hash.should_receive(:[]).with("Best Bid")
29
+ campbx.should_receive(:xticker) { hash }
30
+ client.price(:sell)
31
+
32
+ client.instance_variable_set(:@price, nil)
33
+ hash = Hashie::Mash.new("Best Ask" => 10)
34
+ hash.should_receive(:[]).with("Best Ask")
35
+ campbx.should_receive(:xticker) { hash }
36
+ client.price(:buy)
37
+ end
38
+ end
39
+
40
+ describe "#trade" do
41
+ it "calls CampBX" do
42
+ client.instance_variable_set(:@price, 10)
43
+ campbx.should_receive(:trade_enter).with("QuickSell",0.01,10)
44
+ client.trade(:sell)
45
+
46
+ client.instance_variable_set(:@price, 11)
47
+ campbx.should_receive(:trade_enter).with("QuickBuy",0.01,11)
48
+ client.trade(:buy)
49
+ end
50
+ end
51
+
52
+ describe "#transfer" do
53
+ it "calls CampBX correctly" do
54
+ sell_client = RbtcArbitrage::Clients::BitstampClient.new
55
+ campbx.should_receive(:send_btc).with(sell_client.address, 0.01)
56
+ client.transfer sell_client
57
+ end
58
+ end
59
+
60
+ describe "#address" do
61
+ it "calls campbx" do
62
+ campbx.should_receive(:get_btc_address)
63
+ client.address
64
+ end
65
+ end
66
+ end
@@ -25,6 +25,7 @@ describe RbtcArbitrage::Clients::MtGoxClient do
25
25
  MtGox.should_receive(:ticker) { hash }
26
26
  client.price(:sell)
27
27
 
28
+ client.instance_variable_set(:@price, nil)
28
29
  hash = Hashie::Mash.new(sell: 10)
29
30
  hash.should_receive(:sell)
30
31
  MtGox.should_receive(:ticker) { hash }
@@ -0,0 +1,91 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://btc-e.com/api/2/btc_usd/ticker
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - '*/*'
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - cloudflare-nginx
23
+ Date:
24
+ - Sun, 22 Dec 2013 22:16:28 GMT
25
+ Content-Type:
26
+ - text/html; charset=utf-8
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - __cfduid=d1f8cab4bb52538ed98053a854f645b891387750587941; expires=Mon, 23-Dec-2019
33
+ 23:50:00 GMT; path=/; domain=.btc-e.com; HttpOnly
34
+ X-Frame-Options:
35
+ - DENY
36
+ Expires:
37
+ - Thu, 01 Jan 1970 00:00:01 GMT
38
+ Cache-Control:
39
+ - no-cache
40
+ Cf-Ray:
41
+ - e102d36ad9f0293
42
+ body:
43
+ encoding: UTF-8
44
+ string: '{"ticker":{"high":659.99902,"low":572.09998,"avg":616.0495,"vol":14435222.43502,"vol_cur":23193.90705,"last":610.684,"buy":613.992,"sell":613.185,"updated":1387750587,"server_time":1387750588}}'
45
+ http_version:
46
+ recorded_at: Sun, 22 Dec 2013 22:16:28 GMT
47
+ - request:
48
+ method: get
49
+ uri: https://btc-e.com/api/2/btc_usd/ticker
50
+ body:
51
+ encoding: US-ASCII
52
+ string: ''
53
+ headers:
54
+ Accept-Encoding:
55
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
56
+ Accept:
57
+ - '*/*'
58
+ User-Agent:
59
+ - Ruby
60
+ response:
61
+ status:
62
+ code: 200
63
+ message: OK
64
+ headers:
65
+ Server:
66
+ - cloudflare-nginx
67
+ Date:
68
+ - Sun, 22 Dec 2013 22:16:28 GMT
69
+ Content-Type:
70
+ - text/html; charset=utf-8
71
+ Transfer-Encoding:
72
+ - chunked
73
+ Connection:
74
+ - keep-alive
75
+ Set-Cookie:
76
+ - __cfduid=d58ae9f8e9b973513f80e342b90bcbdb31387750588525; expires=Mon, 23-Dec-2019
77
+ 23:50:00 GMT; path=/; domain=.btc-e.com; HttpOnly
78
+ X-Frame-Options:
79
+ - DENY
80
+ Expires:
81
+ - Thu, 01 Jan 1970 00:00:01 GMT
82
+ Cache-Control:
83
+ - no-cache
84
+ Cf-Ray:
85
+ - e102d3a42aa0293
86
+ body:
87
+ encoding: UTF-8
88
+ string: '{"ticker":{"high":659.99902,"low":572.09998,"avg":616.0495,"vol":14435222.43502,"vol_cur":23193.90705,"last":610.684,"buy":613.992,"sell":613.185,"updated":1387750587,"server_time":1387750588}}'
89
+ http_version:
90
+ recorded_at: Sun, 22 Dec 2013 22:16:28 GMT
91
+ recorded_with: VCR 2.7.0
@@ -0,0 +1,47 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://btc-e.com/api/2/btc_usd/ticker
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - '*/*'
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - cloudflare-nginx
23
+ Date:
24
+ - Sun, 22 Dec 2013 22:13:52 GMT
25
+ Content-Type:
26
+ - text/html; charset=utf-8
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - __cfduid=de7ec8d7456b1f37e41e2b0fe4a09cfba1387750431811; expires=Mon, 23-Dec-2019
33
+ 23:50:00 GMT; path=/; domain=.btc-e.com; HttpOnly
34
+ X-Frame-Options:
35
+ - DENY
36
+ Expires:
37
+ - Thu, 01 Jan 1970 00:00:01 GMT
38
+ Cache-Control:
39
+ - no-cache
40
+ Cf-Ray:
41
+ - e102966dc670669
42
+ body:
43
+ encoding: UTF-8
44
+ string: '{"ticker":{"high":659.99902,"low":572.09998,"avg":616.0495,"vol":14402660.31015,"vol_cur":23140.70104,"last":613.1,"buy":614.99,"sell":612.7,"updated":1387750431,"server_time":1387750432}}'
45
+ http_version:
46
+ recorded_at: Sun, 22 Dec 2013 22:13:52 GMT
47
+ recorded_with: VCR 2.7.0
@@ -0,0 +1,47 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://btc-e.com/api/2/btc_usd/ticker
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - '*/*'
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - cloudflare-nginx
23
+ Date:
24
+ - Sun, 22 Dec 2013 22:13:52 GMT
25
+ Content-Type:
26
+ - text/html; charset=utf-8
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - __cfduid=d5173355cf2a4f0a2af0f2ee70de42a711387750432284; expires=Mon, 23-Dec-2019
33
+ 23:50:00 GMT; path=/; domain=.btc-e.com; HttpOnly
34
+ X-Frame-Options:
35
+ - DENY
36
+ Expires:
37
+ - Thu, 01 Jan 1970 00:00:01 GMT
38
+ Cache-Control:
39
+ - no-cache
40
+ Cf-Ray:
41
+ - e102969cbd00669
42
+ body:
43
+ encoding: UTF-8
44
+ string: '{"ticker":{"high":659.99902,"low":572.09998,"avg":616.0495,"vol":14402660.31015,"vol_cur":23140.70104,"last":613.1,"buy":614.99,"sell":612.7,"updated":1387750431,"server_time":1387750432}}'
45
+ http_version:
46
+ recorded_at: Sun, 22 Dec 2013 22:13:52 GMT
47
+ recorded_with: VCR 2.7.0
@@ -0,0 +1,95 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://campbx.com/api/myfunds.php
6
+ headers:
7
+ Accept-Encoding:
8
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
9
+ Accept:
10
+ - '*/*'
11
+ User-Agent:
12
+ - Ruby
13
+ Content-Type:
14
+ - application/x-www-form-urlencoded
15
+ response:
16
+ status:
17
+ code: 200
18
+ message: OK
19
+ headers:
20
+ Server:
21
+ - cloudflare-nginx
22
+ Date:
23
+ - Sun, 22 Dec 2013 20:52:46 GMT
24
+ Content-Type:
25
+ - application/json
26
+ Transfer-Encoding:
27
+ - chunked
28
+ Connection:
29
+ - keep-alive
30
+ Set-Cookie:
31
+ - __cfduid=dcf93eb6010f388100750784fd2ba7ad51387745566048; expires=Mon, 23-Dec-2019
32
+ 23:50:00 GMT; path=/; domain=.campbx.com; HttpOnly
33
+ X-Frame-Options:
34
+ - SAMEORIGIN
35
+ Cache-Control:
36
+ - no-cache, must-revalidate, max-age=3600
37
+ Vary:
38
+ - Accept-Encoding
39
+ Expires:
40
+ - Sun, 22 Dec 2013 21:52:45 GMT
41
+ Cf-Ray:
42
+ - e0fb29b52190657
43
+ body:
44
+ encoding: UTF-8
45
+ string: "\r\n{\"Total USD\":\"1.41\",\"Total BTC\":\"0.00790000\",\"Liquid USD\":\"1.41\",\"Liquid
46
+ BTC\":\"0.00790000\",\"Margin Account USD\":\"0.00\",\"Margin Account BTC\":\"0.00000000\"}"
47
+ http_version:
48
+ recorded_at: Sun, 22 Dec 2013 20:52:46 GMT
49
+ - request:
50
+ method: post
51
+ uri: https://campbx.com/api/myfunds.php
52
+ headers:
53
+ Accept-Encoding:
54
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
55
+ Accept:
56
+ - '*/*'
57
+ User-Agent:
58
+ - Ruby
59
+ Content-Type:
60
+ - application/x-www-form-urlencoded
61
+ response:
62
+ status:
63
+ code: 200
64
+ message: OK
65
+ headers:
66
+ Server:
67
+ - cloudflare-nginx
68
+ Date:
69
+ - Sun, 22 Dec 2013 20:52:47 GMT
70
+ Content-Type:
71
+ - application/json
72
+ Transfer-Encoding:
73
+ - chunked
74
+ Connection:
75
+ - keep-alive
76
+ Set-Cookie:
77
+ - __cfduid=d4b55f5f94eb19005616f2b37678ae4d31387745567323; expires=Mon, 23-Dec-2019
78
+ 23:50:00 GMT; path=/; domain=.campbx.com; HttpOnly
79
+ X-Frame-Options:
80
+ - SAMEORIGIN
81
+ Cache-Control:
82
+ - no-cache, must-revalidate, max-age=3600
83
+ Vary:
84
+ - Accept-Encoding
85
+ Expires:
86
+ - Sun, 22 Dec 2013 21:52:46 GMT
87
+ Cf-Ray:
88
+ - e0fb2a340cd012d
89
+ body:
90
+ encoding: UTF-8
91
+ string: "\r\n{\"Total USD\":\"1.41\",\"Total BTC\":\"0.00790000\",\"Liquid USD\":\"1.41\",\"Liquid
92
+ BTC\":\"0.00790000\",\"Margin Account USD\":\"0.00\",\"Margin Account BTC\":\"0.00000000\"}"
93
+ http_version:
94
+ recorded_at: Sun, 22 Dec 2013 20:52:47 GMT
95
+ recorded_with: VCR 2.7.0
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://campbx.com/api/xticker.php
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - '*/*'
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - cloudflare-nginx
23
+ Date:
24
+ - Sun, 22 Dec 2013 20:54:39 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - __cfduid=d98aba474beb6580e3a16963937d1feab1387745679008; expires=Mon, 23-Dec-2019
33
+ 23:50:00 GMT; path=/; domain=.campbx.com; HttpOnly
34
+ X-Frame-Options:
35
+ - SAMEORIGIN
36
+ Cache-Control:
37
+ - no-cache, must-revalidate, max-age=3600
38
+ Vary:
39
+ - Accept-Encoding
40
+ Expires:
41
+ - Sun, 22 Dec 2013 21:54:38 GMT
42
+ Cf-Ray:
43
+ - e0fb55dc03e012d
44
+ body:
45
+ encoding: UTF-8
46
+ string: '{"Last Trade":"629.99","Best Bid":"611.00","Best Ask":"634.49"}'
47
+ http_version:
48
+ recorded_at: Sun, 22 Dec 2013 20:54:39 GMT
49
+ recorded_with: VCR 2.7.0
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://campbx.com/api/xticker.php
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - '*/*'
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - cloudflare-nginx
23
+ Date:
24
+ - Sun, 22 Dec 2013 20:54:40 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - __cfduid=ddfbcf00e20688eca7437a961caf31c281387745680288; expires=Mon, 23-Dec-2019
33
+ 23:50:00 GMT; path=/; domain=.campbx.com; HttpOnly
34
+ X-Frame-Options:
35
+ - SAMEORIGIN
36
+ Cache-Control:
37
+ - no-cache, must-revalidate, max-age=3600
38
+ Vary:
39
+ - Accept-Encoding
40
+ Expires:
41
+ - Sun, 22 Dec 2013 21:54:39 GMT
42
+ Cf-Ray:
43
+ - e0fb565c0b4012d
44
+ body:
45
+ encoding: UTF-8
46
+ string: '{"Last Trade":"629.99","Best Bid":"611.00","Best Ask":"634.49"}'
47
+ http_version:
48
+ recorded_at: Sun, 22 Dec 2013 20:54:40 GMT
49
+ recorded_with: VCR 2.7.0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbtc_arbitrage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hank Stoever
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-19 00:00:00.000000000 Z
11
+ date: 2013-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -112,16 +112,16 @@ dependencies:
112
112
  name: btce
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: 0.2.4
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
124
+ version: 0.2.4
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: bitstamp
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -159,6 +159,9 @@ files:
159
159
  - lib/rbtc_arbitrage/cli.rb
160
160
  - lib/rbtc_arbitrage/client.rb
161
161
  - lib/rbtc_arbitrage/clients/bitstamp_client.rb
162
+ - lib/rbtc_arbitrage/clients/btce_client.rb
163
+ - lib/rbtc_arbitrage/clients/campbx_client.rb
164
+ - lib/rbtc_arbitrage/clients/client.rb.example
162
165
  - lib/rbtc_arbitrage/clients/mtgox_client.rb
163
166
  - lib/rbtc_arbitrage/trader.rb
164
167
  - lib/rbtc_arbitrage/version.rb
@@ -166,6 +169,8 @@ files:
166
169
  - spec/cli_spec.rb
167
170
  - spec/client_spec.rb
168
171
  - spec/clients/bitstamp_client_spec.rb
172
+ - spec/clients/btce_client_spec.rb
173
+ - spec/clients/campbx_client_spec.rb
169
174
  - spec/clients/mtgox_client_spec.rb
170
175
  - spec/rbtc_arbitrage_spec.rb
171
176
  - spec/spec_helper.rb
@@ -173,6 +178,12 @@ files:
173
178
  - spec/support/cassettes/RbtcArbitrage_Clients_BitstampClient/_price/fetches_price_for_buy_correctly.yml
174
179
  - spec/support/cassettes/RbtcArbitrage_Clients_BitstampClient/_price/fetches_price_for_sell_correctly.yml
175
180
  - spec/support/cassettes/RbtcArbitrage_Clients_BitstampClient/_price/fetches_prices_correctly.yml
181
+ - spec/support/cassettes/RbtcArbitrage_Clients_BtceClient/_price/calls_btc-e.yml
182
+ - spec/support/cassettes/RbtcArbitrage_Clients_BtceClient/_price/fetches_price_for_buy_correctly.yml
183
+ - spec/support/cassettes/RbtcArbitrage_Clients_BtceClient/_price/fetches_price_for_sell_correctly.yml
184
+ - spec/support/cassettes/RbtcArbitrage_Clients_CampbxClient/_balance/fetches_the_balance_correctly.yml
185
+ - spec/support/cassettes/RbtcArbitrage_Clients_CampbxClient/_price/fetches_price_for_buy_correctly.yml
186
+ - spec/support/cassettes/RbtcArbitrage_Clients_CampbxClient/_price/fetches_price_for_sell_correctly.yml
176
187
  - spec/support/cassettes/RbtcArbitrage_Clients_MtGoxClient/_balance/fetches_the_balance_correctly.yml
177
188
  - spec/support/cassettes/RbtcArbitrage_Clients_MtGoxClient/_price/fetches_price_for_buy_correctly.yml
178
189
  - spec/support/cassettes/RbtcArbitrage_Clients_MtGoxClient/_price/fetches_price_for_sell_correctly.yml
@@ -213,6 +224,8 @@ test_files:
213
224
  - spec/cli_spec.rb
214
225
  - spec/client_spec.rb
215
226
  - spec/clients/bitstamp_client_spec.rb
227
+ - spec/clients/btce_client_spec.rb
228
+ - spec/clients/campbx_client_spec.rb
216
229
  - spec/clients/mtgox_client_spec.rb
217
230
  - spec/rbtc_arbitrage_spec.rb
218
231
  - spec/spec_helper.rb
@@ -220,6 +233,12 @@ test_files:
220
233
  - spec/support/cassettes/RbtcArbitrage_Clients_BitstampClient/_price/fetches_price_for_buy_correctly.yml
221
234
  - spec/support/cassettes/RbtcArbitrage_Clients_BitstampClient/_price/fetches_price_for_sell_correctly.yml
222
235
  - spec/support/cassettes/RbtcArbitrage_Clients_BitstampClient/_price/fetches_prices_correctly.yml
236
+ - spec/support/cassettes/RbtcArbitrage_Clients_BtceClient/_price/calls_btc-e.yml
237
+ - spec/support/cassettes/RbtcArbitrage_Clients_BtceClient/_price/fetches_price_for_buy_correctly.yml
238
+ - spec/support/cassettes/RbtcArbitrage_Clients_BtceClient/_price/fetches_price_for_sell_correctly.yml
239
+ - spec/support/cassettes/RbtcArbitrage_Clients_CampbxClient/_balance/fetches_the_balance_correctly.yml
240
+ - spec/support/cassettes/RbtcArbitrage_Clients_CampbxClient/_price/fetches_price_for_buy_correctly.yml
241
+ - spec/support/cassettes/RbtcArbitrage_Clients_CampbxClient/_price/fetches_price_for_sell_correctly.yml
223
242
  - spec/support/cassettes/RbtcArbitrage_Clients_MtGoxClient/_balance/fetches_the_balance_correctly.yml
224
243
  - spec/support/cassettes/RbtcArbitrage_Clients_MtGoxClient/_price/fetches_price_for_buy_correctly.yml
225
244
  - spec/support/cassettes/RbtcArbitrage_Clients_MtGoxClient/_price/fetches_price_for_sell_correctly.yml