cryptum 0.0.242 → 0.0.243

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58239e6d710cb64870c47caa59a8c48cbef1b5dc008c6cb4b8307108ef75791a
4
- data.tar.gz: ef6e609003c09ee228fbaee253a362a74ef866939fc96073ab2b02b2688e59b0
3
+ metadata.gz: 34234cf305eba8ee2363618c20b754da0c0bee7f7b180c83377c685b03fa4e9f
4
+ data.tar.gz: 92de156f6662d680730da5af3bd34e338e3d8347b0fb300f9cc25f474949693f
5
5
  SHA512:
6
- metadata.gz: 1f1d21f9b7449bdfbf351c437223c4c359496d922dc569005bde20a98c339c1419db58a0206ddb44186ceea7d431984b4095bcd8ab6ece7db49a88f9dcb10156
7
- data.tar.gz: 874d6e04dad3e6ff8fc555160eda33d0ba3b391df5a6dbfb0c069bf034d2105ceb6adc622c18a5400662d9dddf5aaf744cd78d196f4f08b17d28f2149cf20a7d
6
+ metadata.gz: efb9ae98726c5f4f0a892444b383fb307bb99854606842b24338c43cb71855333213c381c60a9bee119f6864975fa34622bfbb2551335f7ebef8aaf07bf44e36
7
+ data.tar.gz: adccf3ccb4a357f0cfd37da4d61724089c00e16eebd28eee36fb8bb76fc61fa837e33b59815c1ccbdbe59dfe7a7c357f09f6129864b5d2f82afc5e1f7d9029fb
data/.rubocop_todo.yml CHANGED
@@ -1,21 +1,13 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2021-12-01 19:12:53 UTC using RuboCop version 1.23.0.
3
+ # on 2022-07-05 23:36:07 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
- # Cop supports --auto-correct.
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,56 +15,66 @@ Layout/ArgumentAlignment:
23
15
  - 'lib/cryptum/ui/order_execution.rb'
24
16
 
25
17
  # Offense count: 1
26
- # Cop supports --auto-correct.
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
23
  # Offense count: 1
32
- # Cop supports --auto-correct.
24
+ # This cop supports safe autocorrection (--autocorrect).
25
+ # Configuration parameters: AllowForAlignment.
33
26
  Layout/CommentIndentation:
34
27
  Exclude:
35
28
  - 'lib/cryptum/api.rb'
36
29
 
37
30
  # Offense count: 4
38
- # Cop supports --auto-correct.
31
+ # This cop supports safe autocorrection (--autocorrect).
39
32
  Layout/EmptyLineAfterGuardClause:
40
33
  Exclude:
41
34
  - 'lib/cryptum/order_book/market_trend.rb'
42
35
  - 'lib/cryptum/ui/order_execution.rb'
43
36
 
44
37
  # Offense count: 2
45
- # Cop supports --auto-correct.
38
+ # This cop supports safe autocorrection (--autocorrect).
46
39
  Layout/EmptyLines:
47
40
  Exclude:
48
41
  - 'lib/cryptum/api.rb'
49
42
  - 'lib/cryptum/ui/order_execution.rb'
50
43
 
51
44
  # Offense count: 1
52
- # Cop supports --auto-correct.
45
+ # This cop supports safe autocorrection (--autocorrect).
53
46
  # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
54
47
  Layout/ExtraSpacing:
55
48
  Exclude:
56
49
  - 'lib/cryptum/ui/order_plan.rb'
57
50
 
58
- # Offense count: 1
59
- # Cop supports --auto-correct.
51
+ # Offense count: 2
52
+ # This cop supports safe autocorrection (--autocorrect).
60
53
  # Configuration parameters: EnforcedStyle, IndentationWidth.
61
54
  # SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
62
55
  Layout/FirstArgumentIndentation:
63
56
  Exclude:
64
57
  - 'lib/cryptum/ui/order_execution.rb'
65
58
 
66
- # Offense count: 1
67
- # Cop supports --auto-correct.
59
+ # Offense count: 2
60
+ # This cop supports safe autocorrection (--autocorrect).
68
61
  # Configuration parameters: EnforcedStyle.
69
62
  # SupportedStyles: normal, indented_internal_methods
70
63
  Layout/IndentationConsistency:
71
64
  Exclude:
72
65
  - 'lib/cryptum/api.rb'
66
+ - 'lib/cryptum/ui/order_execution.rb'
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'
73
75
 
74
76
  # Offense count: 6
75
- # Cop supports --auto-correct.
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
- # Cop supports --auto-correct.
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
- # Cop supports --auto-correct.
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: 54
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: 373
126
+ Max: 370
125
127
 
126
- # Offense count: 6
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: 5
134
+ # Offense count: 3
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: 71
142
+ Max: 69
141
143
 
142
144
  # Offense count: 56
143
145
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
144
146
  Metrics/MethodLength:
145
- Max: 341
147
+ Max: 343
146
148
 
147
149
  # Offense count: 15
148
150
  # Configuration parameters: CountComments, CountAsOne.
149
151
  Metrics/ModuleLength:
150
- Max: 542
152
+ Max: 538
151
153
 
152
154
  # Offense count: 16
153
155
  # Configuration parameters: IgnoredMethods.
154
156
  Metrics/PerceivedComplexity:
155
- Max: 74
157
+ Max: 72
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
- # Cop supports --auto-correct.
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
- # Cop supports --auto-correct.
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
- # Cop supports --auto-correct.
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
- # Cop supports --auto-correct.
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
- # Cop supports --auto-correct.
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
- # Cop supports --auto-correct.
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
- # Cop supports --auto-correct.
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
- # Cop supports --auto-correct.
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
- # Cop supports --auto-correct.
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
- # Cop supports --auto-correct.
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
- # Cop supports --auto-correct.
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
- # Cop supports --auto-correct.
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/lib/cryptum/api.rb CHANGED
@@ -246,12 +246,8 @@ module Cryptum
246
246
  product_id = option_choice.symbol.to_s.gsub('_', '-').upcase
247
247
 
248
248
  this_product = event_history.order_book[:this_product]
249
- # base_min_size = this_product[:base_min_size]
250
- min_market_funds = this_product[:min_market_funds]
251
249
  base_increment = this_product[:base_increment]
252
250
  quote_increment = this_product[:quote_increment]
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
255
251
  crypto_smallest_decimal = base_increment.to_s.split('.')[-1].length
256
252
  fiat_smallest_decimal = quote_increment.to_s.split('.')[-1].length
257
253
 
@@ -331,12 +327,8 @@ module Cryptum
331
327
  product_id = option_choice.symbol.to_s.gsub('_', '-').upcase
332
328
 
333
329
  this_product = event_history.order_book[:this_product]
334
- # base_min_size = this_product[:base_min_size]
335
- min_market_funds = this_product[:min_market_funds]
336
330
  base_increment = this_product[:base_increment]
337
331
  quote_increment = this_product[:quote_increment]
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
340
332
  crypto_smallest_decimal = base_increment.to_s.split('.')[-1].length
341
333
  fiat_smallest_decimal = quote_increment.to_s.split('.')[-1].length
342
334
 
@@ -34,9 +34,13 @@ module Cryptum
34
34
  base_increment = this_product[:base_increment]
35
35
  quote_increment = this_product[:quote_increment]
36
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
38
37
  crypto_smallest_decimal = base_increment.to_s.split('.')[-1].length
39
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
40
44
 
41
45
  last_three_prices_arr = []
42
46
  last_ticker_price = event_history.order_book[:ticker_price].to_f
@@ -97,10 +101,9 @@ module Cryptum
97
101
  )
98
102
 
99
103
  # size = size.to_i.floor if base_increment.to_i >= 1
100
- size = size.to_i.floor if min_market_funds.to_i >= 1
101
104
 
102
105
  # 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
106
+ # size = min_market_funds if size.to_f < min_market_funds.to_f
104
107
 
105
108
  fiat_invested_this_order = size.to_f * price.to_f
106
109
 
@@ -100,14 +100,18 @@ module Cryptum
100
100
  allocation_decimal = 0.0
101
101
  risk_target = fiat_budget * autotrade_cast_as_decimal
102
102
  risk_alloc = risk_target
103
- # while order_plan.map { |op| op[:invest].to_f }.sum < risk_target
103
+
104
104
  loop do
105
105
  # Calculate min order size
106
106
  allocation_decimal += 0.0001
107
+ # allocation_decimal += base_increment.to_f
107
108
  fiat_investing = risk_alloc * allocation_decimal
108
109
 
109
110
  next unless fiat_investing >= min_market_funds.to_f
110
111
 
112
+ # fiat_investing = min_market_funds.to_f
113
+ # allocation_decimal = fiat_investing / ticker_price
114
+
111
115
  risk_alloc = fiat_budget * autotrade_cast_as_decimal
112
116
  allocation_percent = allocation_decimal * 100
113
117
  fiat_returning = fiat_investing + (
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptum
4
- VERSION = '0.0.242'
4
+ VERSION = '0.0.243'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.242
4
+ version: 0.0.243
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
@@ -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.16
455
+ rubygems_version: 3.3.17
456
456
  signing_key:
457
457
  specification_version: 4
458
458
  summary: Coinbase Pro High-Frequency Trading Bot