cryptum 0.0.239 → 0.0.242
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -4
- data/build_cryptum_gem.sh +6 -0
- data/cryptum.gemspec +0 -1
- data/lib/cryptum/api.rb +11 -5
- data/lib/cryptum/event/buy.rb +5 -4
- data/lib/cryptum/event/sell.rb +4 -3
- data/lib/cryptum/ui/order_execution.rb +8 -4
- data/lib/cryptum/ui/order_plan.rb +11 -4
- data/lib/cryptum/version.rb +1 -1
- metadata +12 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58239e6d710cb64870c47caa59a8c48cbef1b5dc008c6cb4b8307108ef75791a
|
4
|
+
data.tar.gz: ef6e609003c09ee228fbaee253a362a74ef866939fc96073ab2b02b2688e59b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f1d21f9b7449bdfbf351c437223c4c359496d922dc569005bde20a98c339c1419db58a0206ddb44186ceea7d431984b4095bcd8ab6ece7db49a88f9dcb10156
|
7
|
+
data.tar.gz: 874d6e04dad3e6ff8fc555160eda33d0ba3b391df5a6dbfb0c069bf034d2105ceb6adc622c18a5400662d9dddf5aaf744cd78d196f4f08b17d28f2149cf20a7d
|
data/Gemfile
CHANGED
@@ -12,8 +12,8 @@ gemspec
|
|
12
12
|
# to build appropriately. Defer to ./reinstall_coinbot_gemset.sh
|
13
13
|
# to review these custom flags
|
14
14
|
gem 'addressable', '2.8.0'
|
15
|
-
gem 'bundler', '>=2.3.
|
16
|
-
gem 'bundler-audit', '0.9.
|
15
|
+
gem 'bundler', '>=2.3.17'
|
16
|
+
gem 'bundler-audit', '0.9.1'
|
17
17
|
gem 'curses', '1.4.4'
|
18
18
|
gem 'eventmachine', '1.2.7'
|
19
19
|
gem 'faye-websocket', '0.11.1'
|
@@ -25,9 +25,9 @@ gem 'rdoc', '6.4.0'
|
|
25
25
|
gem 'require_all', '3.0.0'
|
26
26
|
gem 'rest-client', '2.1.0'
|
27
27
|
gem 'rspec', '3.11.0'
|
28
|
-
gem 'rubocop', '1.
|
28
|
+
gem 'rubocop', '1.31.1'
|
29
29
|
gem 'rubocop-rake', '0.6.0'
|
30
|
-
gem 'rubocop-rspec', '2.
|
30
|
+
gem 'rubocop-rspec', '2.12.1'
|
31
31
|
gem 'ruby-prof', '1.4.3'
|
32
32
|
gem 'rvm', '1.11.3.9'
|
33
33
|
gem 'sinatra', '2.2.0'
|
data/build_cryptum_gem.sh
CHANGED
@@ -38,6 +38,12 @@ if [[ $old_ruby_version == $new_ruby_version ]]; then
|
|
38
38
|
rvmsudo gem rdoc --rdoc --ri --overwrite -V cryptum
|
39
39
|
echo "Invoking bundle-audit Gemfile Scanner..."
|
40
40
|
rvmsudo bundle-audit
|
41
|
+
|
42
|
+
latest_gem=$(ls pkg/*.gem)
|
43
|
+
if [[ $latest_gem != "" ]]; then
|
44
|
+
echo "Pushing ${latest_gem} to RubyGems.org..."
|
45
|
+
rvmsudo gem push $latest_gem --debug
|
46
|
+
fi
|
41
47
|
else
|
42
48
|
cd $cryptum_root && ./upgrade_ruby.sh $new_ruby_version $old_ruby_version
|
43
49
|
fi
|
data/cryptum.gemspec
CHANGED
@@ -21,7 +21,6 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.files = `git ls-files -z`.split("\x0")
|
23
23
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
24
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
25
24
|
spec.require_paths = ['lib']
|
26
25
|
|
27
26
|
dev_dependency_arr = %i[
|
data/lib/cryptum/api.rb
CHANGED
@@ -85,8 +85,10 @@ module Cryptum
|
|
85
85
|
api_key = env[:api_key]
|
86
86
|
api_secret = env[:api_secret]
|
87
87
|
api_passphrase = env[:api_passphrase]
|
88
|
-
api_endpoint = 'https://api.
|
88
|
+
api_endpoint = 'https://api.exchange.coinbase.com'
|
89
89
|
api_endpoint = 'https://api-public.sandbox.pro.coinbase.com' if env[:env] == :sandbox
|
90
|
+
# api_endpoint = 'https://api.pro.coinbase.com'
|
91
|
+
# api_endpoint = 'https://api-public.sandbox.pro.coinbase.com' if env[:env] == :sandbox
|
90
92
|
api_endpoint = opts[:api_endpoint] if opts[:api_endpoint]
|
91
93
|
|
92
94
|
http_method = if opts[:http_method].nil?
|
@@ -244,10 +246,12 @@ module Cryptum
|
|
244
246
|
product_id = option_choice.symbol.to_s.gsub('_', '-').upcase
|
245
247
|
|
246
248
|
this_product = event_history.order_book[:this_product]
|
247
|
-
base_min_size = this_product[:base_min_size]
|
249
|
+
# base_min_size = this_product[:base_min_size]
|
250
|
+
min_market_funds = this_product[:min_market_funds]
|
248
251
|
base_increment = this_product[:base_increment]
|
249
252
|
quote_increment = this_product[:quote_increment]
|
250
|
-
crypto_smallest_size_to_buy = base_min_size.to_s.split('.')[-1].length
|
253
|
+
# crypto_smallest_size_to_buy = base_min_size.to_s.split('.')[-1].length
|
254
|
+
crypto_smallest_size_to_buy = min_market_funds.to_s.split('.')[-1].length
|
251
255
|
crypto_smallest_decimal = base_increment.to_s.split('.')[-1].length
|
252
256
|
fiat_smallest_decimal = quote_increment.to_s.split('.')[-1].length
|
253
257
|
|
@@ -327,10 +331,12 @@ module Cryptum
|
|
327
331
|
product_id = option_choice.symbol.to_s.gsub('_', '-').upcase
|
328
332
|
|
329
333
|
this_product = event_history.order_book[:this_product]
|
330
|
-
base_min_size = this_product[:base_min_size]
|
334
|
+
# base_min_size = this_product[:base_min_size]
|
335
|
+
min_market_funds = this_product[:min_market_funds]
|
331
336
|
base_increment = this_product[:base_increment]
|
332
337
|
quote_increment = this_product[:quote_increment]
|
333
|
-
crypto_smallest_size_to_buy = base_min_size.to_s.split('.')[-1].length
|
338
|
+
# crypto_smallest_size_to_buy = base_min_size.to_s.split('.')[-1].length
|
339
|
+
crypto_smallest_size_to_buy = min_market_funds.to_s.split('.')[-1].length
|
334
340
|
crypto_smallest_decimal = base_increment.to_s.split('.')[-1].length
|
335
341
|
fiat_smallest_decimal = quote_increment.to_s.split('.')[-1].length
|
336
342
|
|
data/lib/cryptum/event/buy.rb
CHANGED
@@ -19,7 +19,8 @@ module Cryptum
|
|
19
19
|
fiat_portfolio_file = opts[:fiat_portfolio_file]
|
20
20
|
order_history = opts[:order_history]
|
21
21
|
crypto_smallest_decimal = opts[:crypto_smallest_decimal]
|
22
|
-
base_min_size = opts[:base_min_size]
|
22
|
+
# base_min_size = opts[:base_min_size]
|
23
|
+
min_market_funds = this_product[:min_market_funds]
|
23
24
|
indicator_status = opts[:indicator_status]
|
24
25
|
|
25
26
|
# Initialize some bot_conf variables
|
@@ -103,13 +104,13 @@ module Cryptum
|
|
103
104
|
calc_fiat_to_buy - total_limit_buy_orders_open_size
|
104
105
|
)
|
105
106
|
|
106
|
-
if
|
107
|
+
if min_market_funds.to_i >= 1
|
107
108
|
size = (
|
108
|
-
(calc_fiat_to_buy - total_limit_buy_orders_open_size).to_i -
|
109
|
+
(calc_fiat_to_buy - total_limit_buy_orders_open_size).to_i - min_market_funds.to_i
|
109
110
|
).to_s
|
110
111
|
end
|
111
112
|
|
112
|
-
if size.to_f >=
|
113
|
+
if size.to_f >= min_market_funds.to_f &&
|
113
114
|
total_limit_buy_order_open_tot.zero? &&
|
114
115
|
price.to_f.positive?
|
115
116
|
# SUBMIT BUY ORDER
|
data/lib/cryptum/event/sell.rb
CHANGED
@@ -18,7 +18,8 @@ module Cryptum
|
|
18
18
|
order_type = opts[:order_type]
|
19
19
|
fiat_smallest_decimal = opts[:fiat_smallest_decimal]
|
20
20
|
crypto_smallest_decimal = opts[:crypto_smallest_decimal]
|
21
|
-
base_min_size = opts[:base_min_size]
|
21
|
+
# base_min_size = opts[:base_min_size]
|
22
|
+
min_market_funds = this_product[:min_market_funds]
|
22
23
|
indicator_status = opts[:indicator_status]
|
23
24
|
quote_increment = opts[:quote_increment]
|
24
25
|
|
@@ -83,9 +84,9 @@ module Cryptum
|
|
83
84
|
symbol_balance_available.floor(crypto_smallest_decimal)
|
84
85
|
)
|
85
86
|
|
86
|
-
size = symbol_balance_available if
|
87
|
+
size = symbol_balance_available if min_market_funds.to_i == 1
|
87
88
|
|
88
|
-
if size.to_f >=
|
89
|
+
if size.to_f >= min_market_funds.to_f &&
|
89
90
|
price.to_f.positive?
|
90
91
|
|
91
92
|
# SUBMIT SELL ORDER
|
@@ -29,10 +29,12 @@ module Cryptum
|
|
29
29
|
ticker_price = event_history.order_book[:ticker_price].to_f
|
30
30
|
open_24h = event_history.order_book[:open_24h].to_f
|
31
31
|
this_product = event_history.order_book[:this_product]
|
32
|
-
base_min_size = this_product[:base_min_size]
|
32
|
+
# base_min_size = this_product[:base_min_size]
|
33
|
+
min_market_funds = this_product[:min_market_funds]
|
33
34
|
base_increment = this_product[:base_increment]
|
34
35
|
quote_increment = this_product[:quote_increment]
|
35
|
-
crypto_smallest_size_to_buy = base_min_size.to_s.split('.')[-1].length
|
36
|
+
# crypto_smallest_size_to_buy = base_min_size.to_s.split('.')[-1].length
|
37
|
+
crypto_smallest_size_to_buy = min_market_funds.to_s.split('.')[-1].length
|
36
38
|
crypto_smallest_decimal = base_increment.to_s.split('.')[-1].length
|
37
39
|
fiat_smallest_decimal = quote_increment.to_s.split('.')[-1].length
|
38
40
|
|
@@ -94,9 +96,11 @@ module Cryptum
|
|
94
96
|
this_order[:invest].to_f / limit_price
|
95
97
|
)
|
96
98
|
|
97
|
-
size = size.to_i.floor if base_increment.to_i >= 1
|
99
|
+
# size = size.to_i.floor if base_increment.to_i >= 1
|
100
|
+
size = size.to_i.floor if min_market_funds.to_i >= 1
|
98
101
|
|
99
|
-
size = base_min_size if size.to_f < base_min_size.to_f
|
102
|
+
# size = base_min_size if size.to_f < base_min_size.to_f
|
103
|
+
size = min_market_funds if size.to_f < min_market_funds.to_f
|
100
104
|
|
101
105
|
fiat_invested_this_order = size.to_f * price.to_f
|
102
106
|
|
@@ -28,7 +28,8 @@ module Cryptum
|
|
28
28
|
symbol_out = this_product[:id]
|
29
29
|
quote_increment = this_product[:quote_increment]
|
30
30
|
base_increment = this_product[:base_increment]
|
31
|
-
base_min_size = this_product[:base_min_size].to_f
|
31
|
+
# base_min_size = this_product[:base_min_size].to_f
|
32
|
+
min_market_funds = this_product[:min_market_funds]
|
32
33
|
|
33
34
|
fiat_smallest_decimal = quote_increment.to_s.split('.')[-1].length
|
34
35
|
crypto_smallest_decimal = base_increment.to_s.split('.')[-1].length
|
@@ -99,13 +100,13 @@ module Cryptum
|
|
99
100
|
allocation_decimal = 0.0
|
100
101
|
risk_target = fiat_budget * autotrade_cast_as_decimal
|
101
102
|
risk_alloc = risk_target
|
102
|
-
while order_plan.map { |op| op[:invest].to_f }.sum < risk_target
|
103
|
+
# while order_plan.map { |op| op[:invest].to_f }.sum < risk_target
|
104
|
+
loop do
|
103
105
|
# Calculate min order size
|
104
106
|
allocation_decimal += 0.0001
|
105
107
|
fiat_investing = risk_alloc * allocation_decimal
|
106
|
-
min_fiat_allowed_to_invest = base_min_size * ticker_price
|
107
108
|
|
108
|
-
next unless fiat_investing >=
|
109
|
+
next unless fiat_investing >= min_market_funds.to_f
|
109
110
|
|
110
111
|
risk_alloc = fiat_budget * autotrade_cast_as_decimal
|
111
112
|
allocation_percent = allocation_decimal * 100
|
@@ -114,6 +115,12 @@ module Cryptum
|
|
114
115
|
)
|
115
116
|
profit = fiat_returning - fiat_investing
|
116
117
|
|
118
|
+
# Implemented a bugfix here to avoid a bogus single order when Tradeable
|
119
|
+
# Balances are low. Ensure everything still works as expected when
|
120
|
+
# balances are higher.
|
121
|
+
break if order_plan.map { |op| op[:invest].to_f }.sum > risk_target ||
|
122
|
+
allocation_percent > 100
|
123
|
+
|
117
124
|
order_slice = {}
|
118
125
|
order_slice[:plan_no] = "#{plan_no}.#{plan_no_slice}"
|
119
126
|
order_slice[:fiat_available] = format('%0.2f', fiat_budget)
|
data/lib/cryptum/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cryptum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.242
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 0day Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.3.
|
33
|
+
version: 2.3.17
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.3.
|
40
|
+
version: 2.3.17
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler-audit
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.9.
|
47
|
+
version: 0.9.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.9.
|
54
|
+
version: 0.9.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: curses
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,14 +212,14 @@ dependencies:
|
|
212
212
|
requirements:
|
213
213
|
- - '='
|
214
214
|
- !ruby/object:Gem::Version
|
215
|
-
version: 1.
|
215
|
+
version: 1.31.1
|
216
216
|
type: :runtime
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
220
|
- - '='
|
221
221
|
- !ruby/object:Gem::Version
|
222
|
-
version: 1.
|
222
|
+
version: 1.31.1
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
224
|
name: rubocop-rake
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
@@ -240,14 +240,14 @@ dependencies:
|
|
240
240
|
requirements:
|
241
241
|
- - '='
|
242
242
|
- !ruby/object:Gem::Version
|
243
|
-
version: 2.
|
243
|
+
version: 2.12.1
|
244
244
|
type: :runtime
|
245
245
|
prerelease: false
|
246
246
|
version_requirements: !ruby/object:Gem::Requirement
|
247
247
|
requirements:
|
248
248
|
- - '='
|
249
249
|
- !ruby/object:Gem::Version
|
250
|
-
version: 2.
|
250
|
+
version: 2.12.1
|
251
251
|
- !ruby/object:Gem::Dependency
|
252
252
|
name: ruby-prof
|
253
253
|
requirement: !ruby/object:Gem::Requirement
|
@@ -452,21 +452,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
452
452
|
- !ruby/object:Gem::Version
|
453
453
|
version: '0'
|
454
454
|
requirements: []
|
455
|
-
rubygems_version: 3.3.
|
455
|
+
rubygems_version: 3.3.16
|
456
456
|
signing_key:
|
457
457
|
specification_version: 4
|
458
458
|
summary: Coinbase Pro High-Frequency Trading Bot
|
459
|
-
test_files:
|
460
|
-
- spec/lib/cryptum/api_spec.rb
|
461
|
-
- spec/lib/cryptum/event_spec.rb
|
462
|
-
- spec/lib/cryptum/log_spec.rb
|
463
|
-
- spec/lib/cryptum/option_spec.rb
|
464
|
-
- spec/lib/cryptum/order_book/generate_spec.rb
|
465
|
-
- spec/lib/cryptum/order_book/market_trend_spec.rb
|
466
|
-
- spec/lib/cryptum/order_book_spec.rb
|
467
|
-
- spec/lib/cryptum/ui/command_spec.rb
|
468
|
-
- spec/lib/cryptum/ui/ticker_spec.rb
|
469
|
-
- spec/lib/cryptum/ui_spec.rb
|
470
|
-
- spec/lib/cryptum/web_sock_spec.rb
|
471
|
-
- spec/lib/cryptum_spec.rb
|
472
|
-
- spec/spec_helper.rb
|
459
|
+
test_files: []
|