rbtc_arbitrage_simple 2.0.1 → 2.1.0

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: f4cfee1b5de308aa0ec6007b8173a7220b4d4501
4
- data.tar.gz: b67691a517aa55e2d8fe337f493acc172de76f68
3
+ metadata.gz: da49f9da8dfe5c0dfd0dbbee9c0fe4b786c6ed7a
4
+ data.tar.gz: f3d4ca3472d67d874c8b0be6e14b696bae0e02c6
5
5
  SHA512:
6
- metadata.gz: 827f92b92f8728f3802e0a8c341d5f2d0958a3b659841934cd1c15f790ea5dd9ddc1130831af239fa44d1f9e6b06564e680c922894cb12f9a60f2ef69e269aaa
7
- data.tar.gz: 303826e5db0cf919370ed927c60930747b99b6d00962d18547a465743a819c8b38d72907d532f22ff783dc1e88c4b66fdcc8f8e4bb03c1147f246c2fbdd36557
6
+ metadata.gz: b2d2c0d10e0baceee598e75dd2466ead8d3ca27e17a1d20d9f913451da871e9ad26c119912e1ee62c7ba27aa4768e0ed7f0b9b867173684922d9df696aa5654d
7
+ data.tar.gz: 97f25973f0dc1df551d0fd0763e6fbea8cc7c5a5b1f00c7b6cc270f6be4af5666cfa13315f836e091ad024a2c4c752ccf1cbc6d1dff1dac816442e1950946a7b
@@ -1,13 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rbtc_arbitrage_simple (2.0.1)
4
+ rbtc_arbitrage_simple (2.1.0)
5
5
  activemodel (>= 3.1)
6
6
  activesupport (>= 3.1)
7
7
  btce (= 0.2.4)
8
8
  coinbase (= 1.2.6)
9
9
  faraday (= 0.8.8)
10
10
  pony
11
+ tco (= 0.1.0)
11
12
  thor
12
13
 
13
14
  GEM
@@ -125,6 +126,7 @@ GEM
125
126
  rack-protection (~> 1.4)
126
127
  tilt (~> 1.3, >= 1.3.4)
127
128
  slop (3.4.7)
129
+ tco (0.1.0)
128
130
  term-ansicolor (1.2.2)
129
131
  tins (~> 0.8)
130
132
  thor (0.18.1)
@@ -5,6 +5,7 @@ require_relative 'rbtc_arbitrage/campbx.rb'
5
5
  require 'btce'
6
6
  require 'coinbase'
7
7
  require 'pony'
8
+ require 'tco'
8
9
  require_relative 'rbtc_arbitrage/client.rb'
9
10
  Dir["#{File.dirname(__FILE__)}/rbtc_arbitrage/trader/*.rb"].each { |f| require(f) }
10
11
  Dir["#{File.dirname(__FILE__)}/rbtc_arbitrage/**/*.rb"].each { |f| require(f) }
@@ -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", higher_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.1"
2
+ VERSION = "2.1.0"
3
3
  end
@@ -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"]
@@ -28,4 +48,5 @@ Gem::Specification.new do |spec|
28
48
  spec.add_dependency "btce", '0.2.4'
29
49
  spec.add_dependency "coinbase", '1.2.6'
30
50
  spec.add_dependency "pony"
51
+ spec.add_dependency "tco", "0.1.0"
31
52
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbtc_arbitrage_simple
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
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