cryptum 0.0.241 → 0.0.244
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 +4 -4
- data/.rubocop_todo.yml +45 -43
- data/Gemfile +3 -3
- data/lib/cryptum/api.rb +3 -5
- data/lib/cryptum/event/buy.rb +5 -4
- data/lib/cryptum/event/sell.rb +4 -3
- data/lib/cryptum/ui/order_execution.rb +21 -7
- data/lib/cryptum/ui/order_plan.rb +7 -4
- data/lib/cryptum/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 316f8062d1fe0f880fc55e430dadb73c7f152185d5d57b5c59fb3e2a8005434c
|
|
4
|
+
data.tar.gz: 6d5d3310379f9226d2f18dcd6856270885dbb5407156866b6d7ac5c1eb19b5d8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5a373bd8897d8fc93a458281b8837de8ab243e623318274291380d8faceb45dfd48bcfecb65dd691f0af9498d058ad8cbc26eaa71f04a0cfb7436cb0d9f56e7c
|
|
7
|
+
data.tar.gz: af648801b8e95de180eaded40a4cf43fff55c8e9fac70318c0c72222b07b50689e607752b7d12ef3039e6a77471bb1bad334ce3876b7c4b40aa4e43fd567e924
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on
|
|
3
|
+
# on 2022-07-06 00:27:10 UTC using RuboCop version 1.31.1.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
8
8
|
|
|
9
9
|
# Offense count: 1
|
|
10
|
-
#
|
|
11
|
-
# Configuration parameters: Include.
|
|
12
|
-
# Include: **/*.gemspec
|
|
13
|
-
Gemspec/RequireMFA:
|
|
14
|
-
Exclude:
|
|
15
|
-
- 'cryptum.gemspec'
|
|
16
|
-
|
|
17
|
-
# Offense count: 1
|
|
18
|
-
# Cop supports --auto-correct.
|
|
10
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
19
11
|
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
20
12
|
# SupportedStyles: with_first_argument, with_fixed_indentation
|
|
21
13
|
Layout/ArgumentAlignment:
|
|
@@ -23,40 +15,42 @@ Layout/ArgumentAlignment:
|
|
|
23
15
|
- 'lib/cryptum/ui/order_execution.rb'
|
|
24
16
|
|
|
25
17
|
# Offense count: 1
|
|
26
|
-
#
|
|
18
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
27
19
|
Layout/ClosingParenthesisIndentation:
|
|
28
20
|
Exclude:
|
|
29
21
|
- 'lib/cryptum/ui/order_execution.rb'
|
|
30
22
|
|
|
31
|
-
# Offense count:
|
|
32
|
-
#
|
|
23
|
+
# Offense count: 2
|
|
24
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
25
|
+
# Configuration parameters: AllowForAlignment.
|
|
33
26
|
Layout/CommentIndentation:
|
|
34
27
|
Exclude:
|
|
35
28
|
- 'lib/cryptum/api.rb'
|
|
29
|
+
- 'lib/cryptum/ui/order_execution.rb'
|
|
36
30
|
|
|
37
31
|
# Offense count: 4
|
|
38
|
-
#
|
|
32
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
39
33
|
Layout/EmptyLineAfterGuardClause:
|
|
40
34
|
Exclude:
|
|
41
35
|
- 'lib/cryptum/order_book/market_trend.rb'
|
|
42
36
|
- 'lib/cryptum/ui/order_execution.rb'
|
|
43
37
|
|
|
44
38
|
# Offense count: 2
|
|
45
|
-
#
|
|
39
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
46
40
|
Layout/EmptyLines:
|
|
47
41
|
Exclude:
|
|
48
42
|
- 'lib/cryptum/api.rb'
|
|
49
43
|
- 'lib/cryptum/ui/order_execution.rb'
|
|
50
44
|
|
|
51
45
|
# Offense count: 1
|
|
52
|
-
#
|
|
46
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
53
47
|
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
|
|
54
48
|
Layout/ExtraSpacing:
|
|
55
49
|
Exclude:
|
|
56
50
|
- 'lib/cryptum/ui/order_plan.rb'
|
|
57
51
|
|
|
58
52
|
# Offense count: 1
|
|
59
|
-
#
|
|
53
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
60
54
|
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
61
55
|
# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
|
|
62
56
|
Layout/FirstArgumentIndentation:
|
|
@@ -64,15 +58,23 @@ Layout/FirstArgumentIndentation:
|
|
|
64
58
|
- 'lib/cryptum/ui/order_execution.rb'
|
|
65
59
|
|
|
66
60
|
# Offense count: 1
|
|
67
|
-
#
|
|
61
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
68
62
|
# Configuration parameters: EnforcedStyle.
|
|
69
63
|
# SupportedStyles: normal, indented_internal_methods
|
|
70
64
|
Layout/IndentationConsistency:
|
|
71
65
|
Exclude:
|
|
72
66
|
- 'lib/cryptum/api.rb'
|
|
73
67
|
|
|
68
|
+
# Offense count: 1
|
|
69
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
70
|
+
# Configuration parameters: IndentationWidth, EnforcedStyle.
|
|
71
|
+
# SupportedStyles: spaces, tabs
|
|
72
|
+
Layout/IndentationStyle:
|
|
73
|
+
Exclude:
|
|
74
|
+
- 'lib/cryptum/ui/order_execution.rb'
|
|
75
|
+
|
|
74
76
|
# Offense count: 6
|
|
75
|
-
#
|
|
77
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
76
78
|
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
77
79
|
# SupportedStyles: aligned, indented
|
|
78
80
|
Layout/MultilineOperationIndentation:
|
|
@@ -82,7 +84,7 @@ Layout/MultilineOperationIndentation:
|
|
|
82
84
|
- 'lib/cryptum/ui/ticker.rb'
|
|
83
85
|
|
|
84
86
|
# Offense count: 1
|
|
85
|
-
#
|
|
87
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
86
88
|
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
|
|
87
89
|
# SupportedStylesForExponentOperator: space, no_space
|
|
88
90
|
Layout/SpaceAroundOperators:
|
|
@@ -90,7 +92,7 @@ Layout/SpaceAroundOperators:
|
|
|
90
92
|
- 'lib/cryptum/ui/order_plan.rb'
|
|
91
93
|
|
|
92
94
|
# Offense count: 11
|
|
93
|
-
#
|
|
95
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
94
96
|
# Configuration parameters: AllowInHeredoc.
|
|
95
97
|
Layout/TrailingWhitespace:
|
|
96
98
|
Exclude:
|
|
@@ -101,7 +103,7 @@ Layout/TrailingWhitespace:
|
|
|
101
103
|
- 'lib/cryptum/ui/order_plan.rb'
|
|
102
104
|
- 'lib/cryptum/ui/order_timer.rb'
|
|
103
105
|
|
|
104
|
-
# Offense count:
|
|
106
|
+
# Offense count: 51
|
|
105
107
|
Lint/UselessAssignment:
|
|
106
108
|
Exclude:
|
|
107
109
|
- 'bin/cryptum-forecast'
|
|
@@ -121,15 +123,15 @@ Lint/UselessAssignment:
|
|
|
121
123
|
# Offense count: 38
|
|
122
124
|
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
|
123
125
|
Metrics/AbcSize:
|
|
124
|
-
Max:
|
|
126
|
+
Max: 371
|
|
125
127
|
|
|
126
|
-
# Offense count:
|
|
128
|
+
# Offense count: 7
|
|
127
129
|
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
|
128
130
|
# IgnoredMethods: refine
|
|
129
131
|
Metrics/BlockLength:
|
|
130
132
|
Max: 84
|
|
131
133
|
|
|
132
|
-
# Offense count:
|
|
134
|
+
# Offense count: 4
|
|
133
135
|
# Configuration parameters: CountBlocks.
|
|
134
136
|
Metrics/BlockNesting:
|
|
135
137
|
Max: 4
|
|
@@ -137,22 +139,22 @@ Metrics/BlockNesting:
|
|
|
137
139
|
# Offense count: 15
|
|
138
140
|
# Configuration parameters: IgnoredMethods.
|
|
139
141
|
Metrics/CyclomaticComplexity:
|
|
140
|
-
Max:
|
|
142
|
+
Max: 70
|
|
141
143
|
|
|
142
144
|
# Offense count: 56
|
|
143
145
|
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
|
144
146
|
Metrics/MethodLength:
|
|
145
|
-
Max:
|
|
147
|
+
Max: 343
|
|
146
148
|
|
|
147
149
|
# Offense count: 15
|
|
148
150
|
# Configuration parameters: CountComments, CountAsOne.
|
|
149
151
|
Metrics/ModuleLength:
|
|
150
|
-
Max:
|
|
152
|
+
Max: 538
|
|
151
153
|
|
|
152
154
|
# Offense count: 16
|
|
153
155
|
# Configuration parameters: IgnoredMethods.
|
|
154
156
|
Metrics/PerceivedComplexity:
|
|
155
|
-
Max:
|
|
157
|
+
Max: 73
|
|
156
158
|
|
|
157
159
|
# Offense count: 1
|
|
158
160
|
# Configuration parameters: AllowedConstants.
|
|
@@ -163,7 +165,7 @@ Style/Documentation:
|
|
|
163
165
|
- 'bin/cryptum-forecast'
|
|
164
166
|
|
|
165
167
|
# Offense count: 2
|
|
166
|
-
#
|
|
168
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
167
169
|
# Configuration parameters: EnforcedStyle.
|
|
168
170
|
# SupportedStyles: left_coerce, right_coerce, single_coerce, fdiv
|
|
169
171
|
Style/FloatDivision:
|
|
@@ -172,7 +174,7 @@ Style/FloatDivision:
|
|
|
172
174
|
- 'lib/cryptum/ui/portfolio.rb'
|
|
173
175
|
|
|
174
176
|
# Offense count: 1
|
|
175
|
-
#
|
|
177
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
176
178
|
# Configuration parameters: EnforcedStyle, MinBodyLength.
|
|
177
179
|
# SupportedStyles: skip_modifier_ifs, always
|
|
178
180
|
Style/Next:
|
|
@@ -180,45 +182,45 @@ Style/Next:
|
|
|
180
182
|
- 'lib/cryptum/api.rb'
|
|
181
183
|
|
|
182
184
|
# Offense count: 4
|
|
183
|
-
#
|
|
184
|
-
# Configuration parameters: Strict.
|
|
185
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
186
|
+
# Configuration parameters: Strict, AllowedNumbers.
|
|
185
187
|
Style/NumericLiterals:
|
|
186
188
|
MinDigits: 7
|
|
187
189
|
|
|
188
190
|
# Offense count: 2
|
|
189
|
-
#
|
|
191
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
190
192
|
# Configuration parameters: Methods.
|
|
191
193
|
Style/RedundantArgument:
|
|
192
194
|
Exclude:
|
|
193
195
|
- 'lib/cryptum/ui/command.rb'
|
|
194
196
|
|
|
195
197
|
# Offense count: 2
|
|
196
|
-
#
|
|
198
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
197
199
|
Style/RedundantAssignment:
|
|
198
200
|
Exclude:
|
|
199
201
|
- 'lib/cryptum/api.rb'
|
|
200
202
|
|
|
201
203
|
# Offense count: 1
|
|
202
|
-
#
|
|
204
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
203
205
|
# Configuration parameters: AllowMultipleReturnValues.
|
|
204
206
|
Style/RedundantReturn:
|
|
205
207
|
Exclude:
|
|
206
208
|
- 'lib/cryptum.rb'
|
|
207
209
|
|
|
208
210
|
# Offense count: 2
|
|
209
|
-
#
|
|
211
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
210
212
|
Style/RedundantSelf:
|
|
211
213
|
Exclude:
|
|
212
214
|
- 'lib/cryptum/event/history.rb'
|
|
213
215
|
|
|
214
216
|
# Offense count: 1
|
|
215
|
-
#
|
|
217
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
216
218
|
Style/StringChars:
|
|
217
219
|
Exclude:
|
|
218
220
|
- 'lib/cryptum.rb'
|
|
219
221
|
|
|
220
222
|
# Offense count: 2
|
|
221
|
-
#
|
|
223
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
222
224
|
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
|
223
225
|
# SupportedStyles: single_quotes, double_quotes
|
|
224
226
|
Style/StringLiterals:
|
|
@@ -227,7 +229,7 @@ Style/StringLiterals:
|
|
|
227
229
|
- 'lib/cryptum/ui/portfolio.rb'
|
|
228
230
|
|
|
229
231
|
# Offense count: 2
|
|
230
|
-
#
|
|
232
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
231
233
|
# Configuration parameters: .
|
|
232
234
|
# SupportedStyles: percent, brackets
|
|
233
235
|
Style/SymbolArray:
|
|
@@ -235,7 +237,7 @@ Style/SymbolArray:
|
|
|
235
237
|
MinSize: 4
|
|
236
238
|
|
|
237
239
|
# Offense count: 1
|
|
238
|
-
#
|
|
240
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
239
241
|
# Configuration parameters: EnforcedStyleForMultiline.
|
|
240
242
|
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
|
241
243
|
Style/TrailingCommaInArrayLiteral:
|
|
@@ -243,8 +245,8 @@ Style/TrailingCommaInArrayLiteral:
|
|
|
243
245
|
- 'lib/cryptum/matrix.rb'
|
|
244
246
|
|
|
245
247
|
# Offense count: 10
|
|
246
|
-
#
|
|
247
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
|
248
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
249
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
|
|
248
250
|
# URISchemes: http, https
|
|
249
251
|
Layout/LineLength:
|
|
250
252
|
Max: 216
|
data/Gemfile
CHANGED
|
@@ -12,7 +12,7 @@ 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.
|
|
15
|
+
gem 'bundler', '>=2.3.17'
|
|
16
16
|
gem 'bundler-audit', '0.9.1'
|
|
17
17
|
gem 'curses', '1.4.4'
|
|
18
18
|
gem 'eventmachine', '1.2.7'
|
|
@@ -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/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,8 @@ 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]
|
|
248
249
|
base_increment = this_product[:base_increment]
|
|
249
250
|
quote_increment = this_product[:quote_increment]
|
|
250
|
-
crypto_smallest_size_to_buy = base_min_size.to_s.split('.')[-1].length
|
|
251
251
|
crypto_smallest_decimal = base_increment.to_s.split('.')[-1].length
|
|
252
252
|
fiat_smallest_decimal = quote_increment.to_s.split('.')[-1].length
|
|
253
253
|
|
|
@@ -327,10 +327,8 @@ module Cryptum
|
|
|
327
327
|
product_id = option_choice.symbol.to_s.gsub('_', '-').upcase
|
|
328
328
|
|
|
329
329
|
this_product = event_history.order_book[:this_product]
|
|
330
|
-
base_min_size = this_product[:base_min_size]
|
|
331
330
|
base_increment = this_product[:base_increment]
|
|
332
331
|
quote_increment = this_product[:quote_increment]
|
|
333
|
-
crypto_smallest_size_to_buy = base_min_size.to_s.split('.')[-1].length
|
|
334
332
|
crypto_smallest_decimal = base_increment.to_s.split('.')[-1].length
|
|
335
333
|
fiat_smallest_decimal = quote_increment.to_s.split('.')[-1].length
|
|
336
334
|
|
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,12 +29,18 @@ 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
|
|
36
37
|
crypto_smallest_decimal = base_increment.to_s.split('.')[-1].length
|
|
37
38
|
fiat_smallest_decimal = quote_increment.to_s.split('.')[-1].length
|
|
39
|
+
# crypto_smallest_size_to_buy = format(
|
|
40
|
+
# "%0.#{crypto_smallest_decimal}f",
|
|
41
|
+
# min_market_funds.to_f / ticker_price
|
|
42
|
+
# )
|
|
43
|
+
# crypto_smallest_size_to_buy = crypto_smallest_size_to_buy.to_s.split('.')[-1].length
|
|
38
44
|
|
|
39
45
|
last_three_prices_arr = []
|
|
40
46
|
last_ticker_price = event_history.order_book[:ticker_price].to_f
|
|
@@ -89,14 +95,22 @@ module Cryptum
|
|
|
89
95
|
limit_price
|
|
90
96
|
)
|
|
91
97
|
|
|
98
|
+
size = this_order[:invest].to_f / limit_price
|
|
99
|
+
|
|
100
|
+
loop do
|
|
101
|
+
size = size.to_f + base_increment.to_f
|
|
102
|
+
break if (size.to_f * price.to_f) > min_market_funds.to_f
|
|
103
|
+
end
|
|
104
|
+
|
|
92
105
|
size = format(
|
|
93
|
-
"%0.#{
|
|
94
|
-
|
|
106
|
+
"%0.#{crypto_smallest_decimal}f",
|
|
107
|
+
size
|
|
95
108
|
)
|
|
96
109
|
|
|
97
|
-
size = size.to_i.floor if base_increment.to_i >= 1
|
|
110
|
+
# size = size.to_i.floor if base_increment.to_i >= 1
|
|
98
111
|
|
|
99
|
-
size = base_min_size if size.to_f < base_min_size.to_f
|
|
112
|
+
# size = base_min_size if size.to_f < base_min_size.to_f
|
|
113
|
+
# size = min_market_funds if size.to_f < min_market_funds.to_f
|
|
100
114
|
|
|
101
115
|
fiat_invested_this_order = size.to_f * price.to_f
|
|
102
116
|
|
|
@@ -128,7 +142,7 @@ module Cryptum
|
|
|
128
142
|
|
|
129
143
|
this_order[:price] = limit_price.to_s
|
|
130
144
|
this_order[:size] = format(
|
|
131
|
-
"%0.#{
|
|
145
|
+
"%0.#{crypto_smallest_decimal}f",
|
|
132
146
|
this_order[:invest].to_f / limit_price
|
|
133
147
|
)
|
|
134
148
|
|
|
@@ -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,14 +100,16 @@ 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
|
-
|
|
103
|
+
|
|
103
104
|
loop do
|
|
104
105
|
# Calculate min order size
|
|
105
106
|
allocation_decimal += 0.0001
|
|
106
107
|
fiat_investing = risk_alloc * allocation_decimal
|
|
107
|
-
min_fiat_allowed_to_invest = base_min_size * ticker_price
|
|
108
108
|
|
|
109
|
-
next unless fiat_investing
|
|
109
|
+
next unless fiat_investing > min_market_funds.to_f
|
|
110
|
+
|
|
111
|
+
# fiat_investing = min_market_funds.to_f
|
|
112
|
+
# allocation_decimal = fiat_investing / ticker_price
|
|
110
113
|
|
|
111
114
|
risk_alloc = fiat_budget * autotrade_cast_as_decimal
|
|
112
115
|
allocation_percent = allocation_decimal * 100
|
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.244
|
|
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-06
|
|
11
|
+
date: 2022-07-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|
|
@@ -30,14 +30,14 @@ 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
|
|
@@ -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,7 +452,7 @@ 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.17
|
|
456
456
|
signing_key:
|
|
457
457
|
specification_version: 4
|
|
458
458
|
summary: Coinbase Pro High-Frequency Trading Bot
|