rbtc_arbitrage 2.4.0 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -3
- data/Gemfile.lock +11 -13
- data/lib/rbtc_arbitrage.rb +1 -0
- data/lib/rbtc_arbitrage/trader/notifier.rb +15 -6
- data/lib/rbtc_arbitrage/version.rb +1 -1
- data/rbtc_arbitrage.gemspec +2 -19
- data/spec/trader_spec.rb +22 -0
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03b66ab3de075bae1123b2cce6336a6720dd3475
|
4
|
+
data.tar.gz: b401cd2f50df7ae33d765763de06bca04a23a2db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8646a751732d8a0f990f2672514c0f7eca6d6e6492f1d6cdc8b8dd4b02c6083dacec28c837df6a233ab088b9a8e3701058777b249e2d75da3a57df4ceafde96
|
7
|
+
data.tar.gz: e3e38b866e6ff157944ab080061a1720db9ecdac316c397ce22b9a13c94d707f1e28d6d4d10c164ccef350a4a198afbaf5c1dd1a15f8b2553c8cebe2d7b8c25e
|
data/Gemfile
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
# Specify your gem's dependencies in rbtc_arbitrage.gemspec
|
4
3
|
gemspec
|
5
4
|
group :development do
|
6
5
|
gem 'rspec'
|
@@ -8,7 +7,6 @@ group :development do
|
|
8
7
|
gem "activesupport", ">= 3.1"
|
9
8
|
gem 'guard'
|
10
9
|
gem 'ruby_gntp'
|
11
|
-
# gem 'awesome_print'
|
12
10
|
gem 'guard-rspec'
|
13
11
|
gem 'simplecov'
|
14
12
|
gem 'coveralls', require: false
|
@@ -17,5 +15,4 @@ group :development do
|
|
17
15
|
gem 'codeclimate-test-reporter'
|
18
16
|
gem 'hashie'
|
19
17
|
gem 'sinatra'
|
20
|
-
gem 'bitstamp', github: 'kojnapp/bitstamp', ref: 'aa6d572d1796a9fdae49220304c5cad9c4d058ee'
|
21
18
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,26 +1,17 @@
|
|
1
|
-
GIT
|
2
|
-
remote: git://github.com/kojnapp/bitstamp.git
|
3
|
-
revision: aa6d572d1796a9fdae49220304c5cad9c4d058ee
|
4
|
-
ref: aa6d572d1796a9fdae49220304c5cad9c4d058ee
|
5
|
-
specs:
|
6
|
-
bitstamp (0.4.0)
|
7
|
-
activemodel (>= 3.1)
|
8
|
-
activesupport (>= 3.1)
|
9
|
-
curb (> 0.8.1)
|
10
|
-
ruby-hmac (= 0.4.0)
|
11
|
-
|
12
1
|
PATH
|
13
2
|
remote: .
|
14
3
|
specs:
|
15
|
-
rbtc_arbitrage (2.4.
|
4
|
+
rbtc_arbitrage (2.4.1)
|
16
5
|
activemodel (>= 3.1)
|
17
6
|
activesupport (>= 3.1)
|
7
|
+
bitstamp-rbtc-arbitrage
|
18
8
|
btce (= 0.2.4)
|
19
9
|
bundler (~> 1.3)
|
20
10
|
coinbase (= 2.1.0)
|
21
11
|
faraday (= 0.8.8)
|
22
12
|
pony
|
23
13
|
rake (= 10.1.1)
|
14
|
+
stathat
|
24
15
|
tco (= 0.1.0)
|
25
16
|
thor
|
26
17
|
|
@@ -38,6 +29,13 @@ GEM
|
|
38
29
|
tzinfo (~> 0.3.37)
|
39
30
|
addressable (2.3.5)
|
40
31
|
atomic (1.1.16)
|
32
|
+
bitstamp-rbtc-arbitrage (0.4.0)
|
33
|
+
activemodel (>= 3.1)
|
34
|
+
activesupport
|
35
|
+
curb (> 0.8.1)
|
36
|
+
i18n (= 0.6.9)
|
37
|
+
ruby-hmac (= 0.4.0)
|
38
|
+
tzinfo
|
41
39
|
btce (0.2.4)
|
42
40
|
monkey-patch
|
43
41
|
builder (3.1.4)
|
@@ -149,6 +147,7 @@ GEM
|
|
149
147
|
rack-protection (~> 1.4)
|
150
148
|
tilt (~> 1.3, >= 1.3.4)
|
151
149
|
slop (3.4.7)
|
150
|
+
stathat (0.1.7)
|
152
151
|
tco (0.1.0)
|
153
152
|
term-ansicolor (1.2.2)
|
154
153
|
tins (~> 0.8)
|
@@ -170,7 +169,6 @@ PLATFORMS
|
|
170
169
|
DEPENDENCIES
|
171
170
|
activemodel (>= 3.1)
|
172
171
|
activesupport (>= 3.1)
|
173
|
-
bitstamp!
|
174
172
|
codeclimate-test-reporter
|
175
173
|
coveralls
|
176
174
|
guard
|
data/lib/rbtc_arbitrage.rb
CHANGED
@@ -9,6 +9,7 @@ require 'btce'
|
|
9
9
|
require 'coinbase'
|
10
10
|
require 'pony'
|
11
11
|
require 'tco'
|
12
|
+
require 'stathat'
|
12
13
|
require_relative 'rbtc_arbitrage/client.rb'
|
13
14
|
Dir["#{File.dirname(__FILE__)}/rbtc_arbitrage/trader/*.rb"].each { |f| require(f) }
|
14
15
|
Dir["#{File.dirname(__FILE__)}/rbtc_arbitrage/**/*.rb"].each { |f| require(f) }
|
@@ -4,13 +4,22 @@ module RbtcArbitrage
|
|
4
4
|
def notify
|
5
5
|
return false unless options[:notify]
|
6
6
|
return false unless @percent > options[:cutoff]
|
7
|
-
setup_pony
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
if (sendgrid_email = ENV['SENDGRID_EMAIL']).present?
|
9
|
+
setup_pony
|
10
|
+
options[:logger].info "Sending email to #{sendgrid_email}"
|
11
|
+
Pony.mail({
|
12
|
+
body: notification,
|
13
|
+
to: sendgrid_email,
|
14
|
+
})
|
15
|
+
end
|
16
|
+
|
17
|
+
if (stathat_api_key = ENV['STATHAT_API_KEY']).present?
|
18
|
+
options[:logger].info "Notifying #{ stathat_api_key } via stathat"
|
19
|
+
|
20
|
+
StatHat::SyncAPI.ez_post_value("#{@buy_client.exchange}_to_#{@sell_client.exchange}_percent", stathat_api_key, @percent)
|
21
|
+
StatHat::SyncAPI.ez_post_value("#{@buy_client.exchange}_to_#{@sell_client.exchange}_profit", stathat_api_key, @received - @paid)
|
22
|
+
end
|
14
23
|
end
|
15
24
|
|
16
25
|
def setup_pony
|
data/rbtc_arbitrage.gemspec
CHANGED
@@ -14,25 +14,6 @@ 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
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
38
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
@@ -47,7 +28,9 @@ Gem::Specification.new do |spec|
|
|
47
28
|
spec.add_dependency "activesupport", ">= 3.1"
|
48
29
|
spec.add_dependency "thor"
|
49
30
|
spec.add_dependency "btce", '0.2.4'
|
31
|
+
spec.add_dependency "stathat"
|
50
32
|
spec.add_dependency "coinbase", '2.1.0'
|
51
33
|
spec.add_dependency "pony"
|
52
34
|
spec.add_dependency "tco", "0.1.0"
|
35
|
+
spec.add_dependency "bitstamp-rbtc-arbitrage"
|
53
36
|
end
|
data/spec/trader_spec.rb
CHANGED
@@ -274,6 +274,9 @@ describe RbtcArbitrage::Trader do
|
|
274
274
|
trader.buyer[:price] = 1
|
275
275
|
trader.seller[:price] = 1
|
276
276
|
|
277
|
+
ENV['SENDGRID_EMAIL'] ||= 'something'
|
278
|
+
ENV['STATHAT_API_KEY'] = nil
|
279
|
+
|
277
280
|
trader.options[:logger].should_receive(:info)
|
278
281
|
Pony.should_receive(:mail).with({
|
279
282
|
to: ENV['SENDGRID_EMAIL'],
|
@@ -282,6 +285,25 @@ describe RbtcArbitrage::Trader do
|
|
282
285
|
|
283
286
|
trader.notify
|
284
287
|
end
|
288
|
+
|
289
|
+
it 'calls StatHat when notify == true' do
|
290
|
+
trader.options[:notify] = true
|
291
|
+
trader.instance_variable_set :@percent, 3
|
292
|
+
trader.instance_variable_set :@paid, 5
|
293
|
+
trader.instance_variable_set :@received, 6
|
294
|
+
trader.buyer[:price] = 1
|
295
|
+
trader.seller[:price] = 1
|
296
|
+
|
297
|
+
ENV['STATHAT_API_KEY'] = '1234'
|
298
|
+
ENV['SENDGRID_EMAIL'] = nil
|
299
|
+
|
300
|
+
trader.options[:logger].should_receive(:info)
|
301
|
+
StatHat::SyncAPI.should_receive(:ez_post_value).with("#{trader.buy_client.exchange}_to_#{trader.sell_client.exchange}_percent", ENV['STATHAT_API_KEY'], 3).ordered
|
302
|
+
StatHat::SyncAPI.should_receive(:ez_post_value).with("#{trader.buy_client.exchange}_to_#{trader.sell_client.exchange}_profit", ENV['STATHAT_API_KEY'], 1).ordered
|
303
|
+
|
304
|
+
trader.notify
|
305
|
+
end
|
306
|
+
|
285
307
|
end
|
286
308
|
|
287
309
|
describe "#setup_pony" do
|
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.4.
|
4
|
+
version: 2.4.1
|
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-
|
11
|
+
date: 2014-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - '='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 0.2.4
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: stathat
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: coinbase
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,6 +164,20 @@ dependencies:
|
|
150
164
|
- - '='
|
151
165
|
- !ruby/object:Gem::Version
|
152
166
|
version: 0.1.0
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: bitstamp-rbtc-arbitrage
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - '>='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
153
181
|
description: A gem for conducting arbitrage with Bitcoin.
|
154
182
|
email:
|
155
183
|
- hstove@gmail.com
|