rbtc_arbitrage 2.0.2 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +3 -1
  3. data/bitstamp/.gitignore +21 -0
  4. data/bitstamp/.rspec +2 -0
  5. data/bitstamp/.ruby-gemset +1 -0
  6. data/bitstamp/.ruby-version +1 -0
  7. data/bitstamp/Gemfile +24 -0
  8. data/bitstamp/Gemfile.lock +64 -0
  9. data/bitstamp/LICENSE.txt +20 -0
  10. data/bitstamp/README.md +96 -0
  11. data/bitstamp/Rakefile +49 -0
  12. data/bitstamp/VERSION +1 -0
  13. data/bitstamp/bitstamp.gemspec +94 -0
  14. data/bitstamp/lib/bitstamp/collection.rb +30 -0
  15. data/bitstamp/lib/bitstamp/helper.rb +19 -0
  16. data/bitstamp/lib/bitstamp/model.rb +33 -0
  17. data/bitstamp/lib/bitstamp/net.rb +49 -0
  18. data/bitstamp/lib/bitstamp/orders.rb +41 -0
  19. data/bitstamp/lib/bitstamp/ticker.rb +16 -0
  20. data/bitstamp/lib/bitstamp/transactions.rb +37 -0
  21. data/bitstamp/lib/bitstamp.rb +77 -0
  22. data/bitstamp/spec/bitstamp_spec.rb +57 -0
  23. data/bitstamp/spec/collection_spec.rb +12 -0
  24. data/bitstamp/spec/fixtures/vcr_cassettes/bitstamp/balance.yml +63 -0
  25. data/bitstamp/spec/fixtures/vcr_cassettes/bitstamp/order_book.yml +1910 -0
  26. data/bitstamp/spec/fixtures/vcr_cassettes/bitstamp/orders/all.yml +62 -0
  27. data/bitstamp/spec/fixtures/vcr_cassettes/bitstamp/orders/buy.yml +62 -0
  28. data/bitstamp/spec/fixtures/vcr_cassettes/bitstamp/orders/sell/failure.yml +60 -0
  29. data/bitstamp/spec/fixtures/vcr_cassettes/bitstamp/ticker.yml +63 -0
  30. data/bitstamp/spec/fixtures/vcr_cassettes/bitstamp/transactions.yml +244 -0
  31. data/bitstamp/spec/fixtures/vcr_cassettes/bitstamp/user_transactions/all.yml +223 -0
  32. data/bitstamp/spec/orders_spec.rb +40 -0
  33. data/bitstamp/spec/spec_helper.rb +26 -0
  34. data/bitstamp/spec/support/bitstamp_setup.rb +19 -0
  35. data/bitstamp/spec/support/vcr.rb +21 -0
  36. data/bitstamp/spec/transactions_spec.rb +32 -0
  37. data/lib/rbtc_arbitrage/trader/logger.rb +18 -7
  38. data/lib/rbtc_arbitrage/version.rb +1 -1
  39. data/lib/rbtc_arbitrage.rb +5 -1
  40. data/rbtc_arbitrage.gemspec +21 -0
  41. metadata +50 -2
@@ -0,0 +1,223 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://www.bitstamp.net/api/user_transactions/
6
+ body:
7
+ encoding: US-ASCII
8
+ string: key=BITSTAMP_KEY&nonce=1380238185&signature=7CBA96CEB133CF1E40EB223B8EE85696D75FFFB2AF8DFF9052F9F6651F829C2A&timedelta=3600
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: !binary |-
14
+ T0s=
15
+ headers:
16
+ !binary "U2VydmVy":
17
+ - !binary |-
18
+ Y2xvdWRmbGFyZS1uZ2lueA==
19
+ !binary "RGF0ZQ==":
20
+ - !binary |-
21
+ VGh1LCAyNiBTZXAgMjAxMyAyMzoyOTo0NiBHTVQ=
22
+ !binary "Q29udGVudC1UeXBl":
23
+ - !binary |-
24
+ YXBwbGljYXRpb24vanNvbg==
25
+ !binary "VHJhbnNmZXItRW5jb2Rpbmc=":
26
+ - !binary |-
27
+ Y2h1bmtlZA==
28
+ !binary "Q29ubmVjdGlvbg==":
29
+ - !binary |-
30
+ a2VlcC1hbGl2ZQ==
31
+ !binary "U2V0LUNvb2tpZQ==":
32
+ - !binary |-
33
+ X19jZmR1aWQ9ZDg0ODRmMzI3NTJiOTlmMGMzNzI0YWE1YjNkYjczNjA2MTM4
34
+ MDIzODE4NTY4MzsgZXhwaXJlcz1Nb24sIDIzLURlYy0yMDE5IDIzOjUwOjAw
35
+ IEdNVDsgcGF0aD0vOyBkb21haW49LmJpdHN0YW1wLm5ldA==
36
+ !binary "Q29udGVudC1MYW5ndWFnZQ==":
37
+ - !binary |-
38
+ ZW4=
39
+ !binary "RXhwaXJlcw==":
40
+ - !binary |-
41
+ VGh1LCAyNiBTZXAgMjAxMyAyMzoyOTo0NiBHTVQ=
42
+ !binary "VmFyeQ==":
43
+ - !binary |-
44
+ QWNjZXB0LUxhbmd1YWdl
45
+ !binary "Q2FjaGUtQ29udHJvbA==":
46
+ - !binary |-
47
+ bWF4LWFnZT0w
48
+ !binary "TGFzdC1Nb2RpZmllZA==":
49
+ - !binary |-
50
+ VGh1LCAyNiBTZXAgMjAxMyAyMzoyOTo0NiBHTVQ=
51
+ !binary "Q2YtUmF5":
52
+ - !binary |-
53
+ YjQzYmNmNDg0NjQwMzIw
54
+ body:
55
+ encoding: ASCII-8BIT
56
+ string: !binary |-
57
+ W3sidXNkIjogIjAuMDAiLCAiYnRjIjogIi0zLjAwNzgxMTI0IiwgImJ0Y191
58
+ c2QiOiAiMC4wMCIsICJvcmRlcl9pZCI6IG51bGwsICJmZWUiOiAiMC4wMCIs
59
+ ICJ0eXBlIjogMSwgImlkIjogMTQ0NDQ3NiwgImRhdGV0aW1lIjogIjIwMTMt
60
+ MDktMjYgMTM6NDY6NTkifSwgeyJ1c2QiOiAiLTM3My41MSIsICJidGMiOiAi
61
+ My4wMDc4MTEyNCIsICJidGNfdXNkIjogIjEyNC4xOCIsICJvcmRlcl9pZCI6
62
+ IDc2MjM5NDIsICJmZWUiOiAiMS41MCIsICJ0eXBlIjogMiwgImlkIjogMTQ0
63
+ NDQwNCwgImRhdGV0aW1lIjogIjIwMTMtMDktMjYgMTM6Mjg6NTUifSwgeyJ1
64
+ c2QiOiAiNDUwMC4wMCIsICJidGMiOiAiMC4wMDAwMDAwMCIsICJidGNfdXNk
65
+ IjogIjAuMDAiLCAib3JkZXJfaWQiOiBudWxsLCAiZmVlIjogIjE1LjAwIiwg
66
+ InR5cGUiOiAwLCA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5LjU1MjUzNDExIiwgImJ0Y191c2QiOiAiMTAy
215
+ LjYwIiwgIm9yZGVyX2lkIjogbnVsbCwgImZlZSI6ICI0LjkxIiwgInR5cGUi
216
+ OiAyLCAiaWQiOiAxMjIwODk2LCAiZGF0ZXRpbWUiOiAiMjAxMy0wOC0xOSAy
217
+ MjowMDowOCJ9LCB7InVzZCI6ICIxMDAwLjAwIiwgImJ0YyI6ICIwLjAwMDAw
218
+ MDAwIiwgImJ0Y191c2QiOiAiMC4wMCIsICJvcmRlcl9pZCI6IG51bGwsICJm
219
+ ZWUiOiAiMTUuMDAiLCAidHlwZSI6IDAsICJpZCI6IDEyMTgzODUsICJkYXRl
220
+ dGltZSI6ICIyMDEzLTA4LTE5IDEzOjA0OjM5In1d
221
+ http_version:
222
+ recorded_at: Thu, 26 Sep 2013 23:29:46 GMT
223
+ recorded_with: VCR 2.6.0
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+
3
+ describe Bitstamp::Orders do
4
+ before { setup_bitstamp }
5
+
6
+ describe :all, vcr: {cassette_name: 'bitstamp/orders/all'} do
7
+ subject { Bitstamp.orders.all }
8
+ it { should be_kind_of Array }
9
+ describe "first order" do
10
+ subject { Bitstamp.orders.all.first }
11
+ its(:price) { should == "1.01" }
12
+ its(:amount) { should == "1.00000000" }
13
+ its(:type) { should == 0 }
14
+ its(:datetime) { should == "2013-09-26 23:15:04" }
15
+ end
16
+ end
17
+
18
+ describe :sell do
19
+ context "no permission found", vcr: {cassette_name: 'bitstamp/orders/sell/failure'} do
20
+ subject { Bitstamp.orders.sell(:amount => 1, :price => 1000) }
21
+ it { should be_kind_of Bitstamp::Order }
22
+ its(:error) { should == "No permission found" }
23
+ end
24
+ # context "bitcoins available", vcr: {cassette_name: 'bitstamp/orders/sell/success'} do
25
+ # subject { Bitstamp.orders.sell(:amount => 1, :price => 1000) }
26
+ # xit { should be_kind_of Bitstamp::Order }
27
+ # its(:error) { should be_nil }
28
+ # end
29
+ end
30
+
31
+ describe :buy, vcr: {cassette_name: 'bitstamp/orders/buy'} do
32
+ subject { Bitstamp.orders.buy(:amount => 1, :price => 1.01) }
33
+ it { should be_kind_of Bitstamp::Order }
34
+ its(:price) { should == "1.01" }
35
+ its(:amount) { should == "1" }
36
+ its(:type) { should == 0 }
37
+ its(:datetime) { should == "2013-09-26 23:26:56.849475" }
38
+ its(:error) { should be_nil }
39
+ end
40
+ end
@@ -0,0 +1,26 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ # This file was generated by the `rspec --init` command. Conventionally, all
5
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
6
+ # Require this file using `require "spec_helper"` to ensure that it is only
7
+ # loaded once.
8
+
9
+ require 'bitstamp'
10
+
11
+ # Requires supporting ruby files with custom matchers and macros, etc,
12
+ # in spec/support/ and its subdirectories.
13
+ Dir[File.expand_path("./spec/support/**/*.rb")].each { |f| require f }
14
+
15
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16
+ RSpec.configure do |config|
17
+ config.treat_symbols_as_metadata_keys_with_true_values = true
18
+ config.run_all_when_everything_filtered = true
19
+ config.filter_run :focus
20
+
21
+ # Run specs in random order to surface order dependencies. If you find an
22
+ # order dependency and want to debug it, you can fix the order by providing
23
+ # the seed, which is printed after each run.
24
+ # --seed 1234
25
+ config.order = 'random'
26
+ end
@@ -0,0 +1,19 @@
1
+ RSpec.configure do |config|
2
+ config.before(:each) do
3
+ # The famous singleton problem
4
+ Bitstamp.setup do |config|
5
+ config.key = nil
6
+ config.secret = nil
7
+ config.client_id = nil
8
+ end
9
+ end
10
+ end
11
+
12
+ def setup_bitstamp
13
+ Bitstamp.setup do |config|
14
+ raise "You must set environment variable BITSTAMP_KEY and BITSTAMP_SECRET with your username and password to run specs." if ENV['BITSTAMP_KEY'].nil? or ENV['BITSTAMP_SECRET'].nil?
15
+ config.key = ENV['BITSTAMP_KEY']
16
+ config.secret = ENV['BITSTAMP_SECRET']
17
+ config.client_id = ENV['BITSTAMP_CLIENT_ID']
18
+ end
19
+ end
@@ -0,0 +1,21 @@
1
+ require 'vcr'
2
+ require 'webmock/rspec'
3
+
4
+ VCR.configure do |c|
5
+ c.allow_http_connections_when_no_cassette = false
6
+ c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
7
+ c.hook_into :webmock # or :fakeweb
8
+ c.configure_rspec_metadata!
9
+ c.filter_sensitive_data('BITSTAMP_KEY') do |interaction|
10
+ ENV['BITSTAMP_KEY']
11
+ end
12
+ c.filter_sensitive_data('BITSTAMP_SECRET') do |interaction|
13
+ ENV['BITSTAMP_SECRET']
14
+ end
15
+ end
16
+
17
+ RSpec.configure do |c|
18
+ # so we can use :vcr rather than :vcr => true;
19
+ # in RSpec 3 this will no longer be necessary.
20
+ c.treat_symbols_as_metadata_keys_with_true_values = true
21
+ end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ describe Bitstamp::UserTransactions do
4
+ before { setup_bitstamp }
5
+
6
+ describe :all, vcr: {cassette_name: 'bitstamp/user_transactions/all'} do
7
+ subject { Bitstamp.user_transactions.all }
8
+ its(:count) { should == 47 }
9
+ context "first transaction" do
10
+ subject { Bitstamp.user_transactions.all.first }
11
+ it { should be_kind_of(Bitstamp::UserTransaction) }
12
+ its(:btc) { should == "-3.00781124" }
13
+ its(:btc_usd) { should == "0.00" }
14
+ its(:datetime) { should == "2013-09-26 13:46:59" }
15
+ its(:fee) { should == "0.00" }
16
+ its(:order_id) { should be_nil }
17
+ its(:type) { should == 1 }
18
+ its(:usd) { should == "0.00" }
19
+ end
20
+ end
21
+
22
+ end
23
+
24
+ describe Bitstamp::Transactions do
25
+ before { setup_bitstamp }
26
+
27
+ describe :all, vcr:{cassette_name: 'bitstamp/transactions'} do
28
+ subject { Bitstamp.transactions }
29
+ it { should be_kind_of Array }
30
+ end
31
+
32
+ end
@@ -8,21 +8,32 @@ module RbtcArbitrage
8
8
  def log_info
9
9
  lower_ex = @buy_client.exchange.to_s.capitalize
10
10
  higher_ex = @sell_client.exchange.to_s.capitalize
11
- logger.info "#{lower_ex}: $#{buyer[:price].round(2)}"
12
- logger.info "#{higher_ex}: $#{seller[:price].round(2)}"
13
- logger.info "buying #{@options[:volume]} btc from #{lower_ex} for $#{@paid.round(2)}"
14
- logger.info "selling #{@options[:volume]} btc on #{higher_ex} for $#{@received.round(2)}"
11
+ logger.info "#{lower_ex}: $#{color(buyer[:price].round(2))}"
12
+ logger.info "#{higher_ex}: $#{color(seller[:price].round(2))}"
13
+ logger.info log_string("buying", lower_ex, @paid)
14
+ logger.info log_string("selling", lower_ex, @received)
15
15
 
16
16
  log_profit
17
17
  end
18
-
18
+
19
19
  private
20
20
 
21
+ def log_string action, exchange, amount
22
+ message = "#{action} #{color @options[:volume]} "
23
+ message << "btc at #{exchange} for $"
24
+ message << color(amount.round(2))
25
+ end
26
+
27
+ def color message
28
+ message.to_s.fg("#D5EC28").bg("#000")
29
+ end
30
+
21
31
  def log_profit
22
- profit_msg = "profit: $#{(@received - @paid).round(2)} (#{@percent.round(2)}%)"
32
+ profit_msg = "profit: $#{color (@received - @paid).round(2)}"
33
+ profit_msg << " (#{color(@percent.round(2))}%)"
23
34
  if cutoff = @options[:cutoff]
24
35
  profit_msg << " is #{@percent < cutoff ? 'below' : 'above'} cutoff"
25
- profit_msg << " of #{cutoff}%."
36
+ profit_msg << " of #{color(cutoff)}%."
26
37
  end
27
38
  logger.info profit_msg
28
39
  end
@@ -1,3 +1,3 @@
1
1
  module RbtcArbitrage
2
- VERSION = "2.0.2"
2
+ VERSION = "2.1.0"
3
3
  end
@@ -1,10 +1,14 @@
1
1
  require 'bundler'
2
- Bundler.require(:default)
2
+ Dir.chdir("#{File.dirname(__FILE__)}/../") do
3
+ Bundler.require(:default)
4
+ end
5
+ require 'bitstamp'
3
6
  require 'thor'
4
7
  require_relative 'rbtc_arbitrage/campbx.rb'
5
8
  require 'btce'
6
9
  require 'coinbase'
7
10
  require 'pony'
11
+ require 'tco'
8
12
  require_relative 'rbtc_arbitrage/client.rb'
9
13
  Dir["#{File.dirname(__FILE__)}/rbtc_arbitrage/trader/*.rb"].each { |f| require(f) }
10
14
  Dir["#{File.dirname(__FILE__)}/rbtc_arbitrage/**/*.rb"].each { |f| require(f) }
@@ -14,6 +14,26 @@ Gem::Specification.new do |spec|
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
17
+ # get an array of submodule dirs by executing 'pwd' inside each submodule
18
+ `git submodule --quiet foreach pwd`.split($\).each do |submodule_path|
19
+ # for each submodule, change working directory to that submodule
20
+ Dir.chdir(submodule_path) do
21
+ # issue git ls-files in submodule's directory
22
+ submodule_files = `git ls-files`.split($\)
23
+ # prepend the submodule path to create absolute file paths
24
+ submodule_files_fullpaths = submodule_files.map do |filename|
25
+ "#{submodule_path}/#{filename}"
26
+ end
27
+ # remove leading path parts to get paths relative to the gem's root dir
28
+ # (this assumes, that the gemspec resides in the gem's root dir)
29
+ submodule_files_paths = submodule_files_fullpaths.map do |filename|
30
+ filename.gsub "#{File.dirname(__FILE__)}/", ""
31
+ end
32
+ # add relative paths to gem.files
33
+ spec.files += submodule_files_paths
34
+ end
35
+ end
36
+
17
37
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
38
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
39
  spec.require_paths = ["lib"]
@@ -29,4 +49,5 @@ Gem::Specification.new do |spec|
29
49
  spec.add_dependency "btce", '0.2.4'
30
50
  spec.add_dependency "coinbase", '1.2.6'
31
51
  spec.add_dependency "pony"
52
+ spec.add_dependency "tco", "0.1.0"
32
53
  end
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: 2.0.2
4
+ version: 2.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: 2014-03-24 00:00:00.000000000 Z
11
+ date: 2014-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - '>='
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: tco
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '='
144
+ - !ruby/object:Gem::Version
145
+ version: 0.1.0
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '='
151
+ - !ruby/object:Gem::Version
152
+ version: 0.1.0
139
153
  description: A gem for conducting arbitrage with Bitcoin.
140
154
  email:
141
155
  - hstove@gmail.com
@@ -156,6 +170,40 @@ files:
156
170
  - README.md
157
171
  - Rakefile
158
172
  - bin/rbtc
173
+ - bitstamp/.gitignore
174
+ - bitstamp/.rspec
175
+ - bitstamp/.ruby-gemset
176
+ - bitstamp/.ruby-version
177
+ - bitstamp/Gemfile
178
+ - bitstamp/Gemfile.lock
179
+ - bitstamp/LICENSE.txt
180
+ - bitstamp/README.md
181
+ - bitstamp/Rakefile
182
+ - bitstamp/VERSION
183
+ - bitstamp/bitstamp.gemspec
184
+ - bitstamp/lib/bitstamp.rb
185
+ - bitstamp/lib/bitstamp/collection.rb
186
+ - bitstamp/lib/bitstamp/helper.rb
187
+ - bitstamp/lib/bitstamp/model.rb
188
+ - bitstamp/lib/bitstamp/net.rb
189
+ - bitstamp/lib/bitstamp/orders.rb
190
+ - bitstamp/lib/bitstamp/ticker.rb
191
+ - bitstamp/lib/bitstamp/transactions.rb
192
+ - bitstamp/spec/bitstamp_spec.rb
193
+ - bitstamp/spec/collection_spec.rb
194
+ - bitstamp/spec/fixtures/vcr_cassettes/bitstamp/balance.yml
195
+ - bitstamp/spec/fixtures/vcr_cassettes/bitstamp/order_book.yml
196
+ - bitstamp/spec/fixtures/vcr_cassettes/bitstamp/orders/all.yml
197
+ - bitstamp/spec/fixtures/vcr_cassettes/bitstamp/orders/buy.yml
198
+ - bitstamp/spec/fixtures/vcr_cassettes/bitstamp/orders/sell/failure.yml
199
+ - bitstamp/spec/fixtures/vcr_cassettes/bitstamp/ticker.yml
200
+ - bitstamp/spec/fixtures/vcr_cassettes/bitstamp/transactions.yml
201
+ - bitstamp/spec/fixtures/vcr_cassettes/bitstamp/user_transactions/all.yml
202
+ - bitstamp/spec/orders_spec.rb
203
+ - bitstamp/spec/spec_helper.rb
204
+ - bitstamp/spec/support/bitstamp_setup.rb
205
+ - bitstamp/spec/support/vcr.rb
206
+ - bitstamp/spec/transactions_spec.rb
159
207
  - dummy_web_server.rb
160
208
  - lib/rbtc_arbitrage.rb
161
209
  - lib/rbtc_arbitrage/campbx.rb