cryptum 0.0.243 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34234cf305eba8ee2363618c20b754da0c0bee7f7b180c83377c685b03fa4e9f
4
- data.tar.gz: 92de156f6662d680730da5af3bd34e338e3d8347b0fb300f9cc25f474949693f
3
+ metadata.gz: 316f8062d1fe0f880fc55e430dadb73c7f152185d5d57b5c59fb3e2a8005434c
4
+ data.tar.gz: 6d5d3310379f9226d2f18dcd6856270885dbb5407156866b6d7ac5c1eb19b5d8
5
5
  SHA512:
6
- metadata.gz: efb9ae98726c5f4f0a892444b383fb307bb99854606842b24338c43cb71855333213c381c60a9bee119f6864975fa34622bfbb2551335f7ebef8aaf07bf44e36
7
- data.tar.gz: adccf3ccb4a357f0cfd37da4d61724089c00e16eebd28eee36fb8bb76fc61fa837e33b59815c1ccbdbe59dfe7a7c357f09f6129864b5d2f82afc5e1f7d9029fb
6
+ metadata.gz: 5a373bd8897d8fc93a458281b8837de8ab243e623318274291380d8faceb45dfd48bcfecb65dd691f0af9498d058ad8cbc26eaa71f04a0cfb7436cb0d9f56e7c
7
+ data.tar.gz: af648801b8e95de180eaded40a4cf43fff55c8e9fac70318c0c72222b07b50689e607752b7d12ef3039e6a77471bb1bad334ce3876b7c4b40aa4e43fd567e924
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2022-07-05 23:36:07 UTC using RuboCop version 1.31.1.
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
@@ -20,12 +20,13 @@ Layout/ClosingParenthesisIndentation:
20
20
  Exclude:
21
21
  - 'lib/cryptum/ui/order_execution.rb'
22
22
 
23
- # Offense count: 1
23
+ # Offense count: 2
24
24
  # This cop supports safe autocorrection (--autocorrect).
25
25
  # Configuration parameters: AllowForAlignment.
26
26
  Layout/CommentIndentation:
27
27
  Exclude:
28
28
  - 'lib/cryptum/api.rb'
29
+ - 'lib/cryptum/ui/order_execution.rb'
29
30
 
30
31
  # Offense count: 4
31
32
  # This cop supports safe autocorrection (--autocorrect).
@@ -48,7 +49,7 @@ Layout/ExtraSpacing:
48
49
  Exclude:
49
50
  - 'lib/cryptum/ui/order_plan.rb'
50
51
 
51
- # Offense count: 2
52
+ # Offense count: 1
52
53
  # This cop supports safe autocorrection (--autocorrect).
53
54
  # Configuration parameters: EnforcedStyle, IndentationWidth.
54
55
  # SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
@@ -56,14 +57,13 @@ Layout/FirstArgumentIndentation:
56
57
  Exclude:
57
58
  - 'lib/cryptum/ui/order_execution.rb'
58
59
 
59
- # Offense count: 2
60
+ # Offense count: 1
60
61
  # This cop supports safe autocorrection (--autocorrect).
61
62
  # Configuration parameters: EnforcedStyle.
62
63
  # SupportedStyles: normal, indented_internal_methods
63
64
  Layout/IndentationConsistency:
64
65
  Exclude:
65
66
  - 'lib/cryptum/api.rb'
66
- - 'lib/cryptum/ui/order_execution.rb'
67
67
 
68
68
  # Offense count: 1
69
69
  # This cop supports safe autocorrection (--autocorrect).
@@ -123,7 +123,7 @@ Lint/UselessAssignment:
123
123
  # Offense count: 38
124
124
  # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
125
125
  Metrics/AbcSize:
126
- Max: 370
126
+ Max: 371
127
127
 
128
128
  # Offense count: 7
129
129
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
@@ -131,7 +131,7 @@ Metrics/AbcSize:
131
131
  Metrics/BlockLength:
132
132
  Max: 84
133
133
 
134
- # Offense count: 3
134
+ # Offense count: 4
135
135
  # Configuration parameters: CountBlocks.
136
136
  Metrics/BlockNesting:
137
137
  Max: 4
@@ -139,7 +139,7 @@ Metrics/BlockNesting:
139
139
  # Offense count: 15
140
140
  # Configuration parameters: IgnoredMethods.
141
141
  Metrics/CyclomaticComplexity:
142
- Max: 69
142
+ Max: 70
143
143
 
144
144
  # Offense count: 56
145
145
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
@@ -154,7 +154,7 @@ Metrics/ModuleLength:
154
154
  # Offense count: 16
155
155
  # Configuration parameters: IgnoredMethods.
156
156
  Metrics/PerceivedComplexity:
157
- Max: 72
157
+ Max: 73
158
158
 
159
159
  # Offense count: 1
160
160
  # Configuration parameters: AllowedConstants.
@@ -36,11 +36,11 @@ module Cryptum
36
36
  # crypto_smallest_size_to_buy = base_min_size.to_s.split('.')[-1].length
37
37
  crypto_smallest_decimal = base_increment.to_s.split('.')[-1].length
38
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
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
44
44
 
45
45
  last_three_prices_arr = []
46
46
  last_ticker_price = event_history.order_book[:ticker_price].to_f
@@ -95,9 +95,16 @@ module Cryptum
95
95
  limit_price
96
96
  )
97
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
+
98
105
  size = format(
99
- "%0.#{crypto_smallest_size_to_buy}f",
100
- this_order[:invest].to_f / limit_price
106
+ "%0.#{crypto_smallest_decimal}f",
107
+ size
101
108
  )
102
109
 
103
110
  # size = size.to_i.floor if base_increment.to_i >= 1
@@ -135,7 +142,7 @@ module Cryptum
135
142
 
136
143
  this_order[:price] = limit_price.to_s
137
144
  this_order[:size] = format(
138
- "%0.#{crypto_smallest_size_to_buy}f",
145
+ "%0.#{crypto_smallest_decimal}f",
139
146
  this_order[:invest].to_f / limit_price
140
147
  )
141
148
 
@@ -104,10 +104,9 @@ module Cryptum
104
104
  loop do
105
105
  # Calculate min order size
106
106
  allocation_decimal += 0.0001
107
- # allocation_decimal += base_increment.to_f
108
107
  fiat_investing = risk_alloc * allocation_decimal
109
108
 
110
- next unless fiat_investing >= min_market_funds.to_f
109
+ next unless fiat_investing > min_market_funds.to_f
111
110
 
112
111
  # fiat_investing = min_market_funds.to_f
113
112
  # allocation_decimal = fiat_investing / ticker_price
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptum
4
- VERSION = '0.0.243'
4
+ VERSION = '0.0.244'
5
5
  end
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.243
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-07-05 00:00:00.000000000 Z
11
+ date: 2022-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable