cryptum 0.0.269 → 0.0.270

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d40a387e6624886030d8bdaf44ffc1fe19d7d776810f6b369d4e0bc06f658b36
4
- data.tar.gz: 26f2281e64fbfac162390bcc25be978e7e58498dd7fb4c6fa67e0e7c1d0f4e5e
3
+ metadata.gz: 1f112246033a05eecb95d6b71d0ce96e7206d9aaef1cf7b675ddd453baafd8de
4
+ data.tar.gz: 399946d0c1100458ef8adcf300c190271af2cd936181c5f259153310c52e1eff
5
5
  SHA512:
6
- metadata.gz: 62511617e610526d54b285f2fb8ae2b450ed9042c382edfcb7eaea4e88b60ea346c7401ba5ecba563b12e48cfba63ac51c6cbdede6097c67d78abf0c672369d9
7
- data.tar.gz: f31542bfaa39f3a6d8c16b0362285bfc9cd79f6f36deec22957c1774348660f4a8a4cc8d6981b6490970403e4032bec28e82bf470c5d28129934f4fb4dcc6164
6
+ metadata.gz: d6d3a544bcbca635371547cf272a051f24585c0d8530f7356c5c466fb5202ca2c03cd75fde6ca42baafd410fd03c1ebc6f315e4666942cab00769e5982f568e9
7
+ data.tar.gz: af57efd0263bb5ead63ddb9a8e5b5c9e289d234a71183a727ee56f10cbb2139df62df7858335379f487208dd7a5d8a5f8d0d5b1b345d9efc2ce73b6d07550b72
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-12-05 19:21:30 UTC using RuboCop version 1.39.0.
3
+ # on 2022-12-05 22:19:37 UTC using RuboCop version 1.39.0.
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
@@ -217,9 +217,9 @@ Style/TrailingCommaInArrayLiteral:
217
217
  Exclude:
218
218
  - 'lib/cryptum/matrix.rb'
219
219
 
220
- # Offense count: 18
220
+ # Offense count: 21
221
221
  # This cop supports safe autocorrection (--autocorrect).
222
222
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
223
223
  # URISchemes: http, https
224
224
  Layout/LineLength:
225
- Max: 216
225
+ Max: 221
@@ -53,7 +53,7 @@ module Cryptum
53
53
  string: ''.ljust(col_just1, ' ')
54
54
  )
55
55
 
56
- header_str = "- ##{order[:plan_no]} ORDER HISTORY DETAILS -"
56
+ header_str = "- ORDER ##{order[:plan_no]} DETAILS -"
57
57
  order_execute_details_win.setpos(
58
58
  out_line_no,
59
59
  Cryptum::UI.col_center(str: header_str)
@@ -62,7 +62,7 @@ module Cryptum
62
62
  Cryptum::UI.colorize(
63
63
  ui_win: order_execute_details_win,
64
64
  color: order_color,
65
- style: :bold,
65
+ style: header_style,
66
66
  string: header_str
67
67
  )
68
68
 
@@ -109,9 +109,6 @@ module Cryptum
109
109
 
110
110
  next unless fiat_investing > min_market_funds.to_f
111
111
 
112
- # fiat_investing = min_market_funds.to_f
113
- # allocation_decimal = fiat_investing / ticker_price
114
-
115
112
  risk_alloc = fiat_budget * autotrade_cast_as_decimal
116
113
  allocation_percent = allocation_decimal * 100
117
114
  fiat_returning = fiat_investing + (
@@ -119,12 +116,14 @@ module Cryptum
119
116
  )
120
117
  profit = fiat_returning - fiat_investing
121
118
 
122
- # Implemented a bugfix here to avoid a bogus single order when Tradeable
123
- # Balances are low. Ensure everything still works as expected when
124
- # balances are higher.
125
119
  break if order_plan.map { |op| op[:invest].to_f }.sum > risk_target ||
126
120
  allocation_percent > 100
127
121
 
122
+ # Avoid a bogus single order at the end when tradeable balances are low.
123
+ # TODO: Add remaining amount to last order
124
+ next unless fiat_budget >= min_market_funds.to_f
125
+
126
+ slice_alloc = risk_alloc * allocation_decimal
128
127
  order_slice = {}
129
128
  order_slice[:plan_no] = "#{plan_no}.#{plan_no_slice}"
130
129
  order_slice[:fiat_available] = format('%0.2f', fiat_budget)
@@ -137,6 +136,8 @@ module Cryptum
137
136
  '%0.2f',
138
137
  allocation_percent
139
138
  )
139
+ order_slice[:slice_alloc] = format('%0.2f', slice_alloc)
140
+ order_slice[:risk_target] = format('%0.2f', risk_target)
140
141
  order_slice[:invest] = format('%0.2f', fiat_investing)
141
142
  order_slice[:return] = format('%0.2f', fiat_returning)
142
143
  order_slice[:profit] = format('%0.2f', profit)
@@ -341,6 +342,9 @@ module Cryptum
341
342
  risk_alloc_out = Cryptum.beautify_large_number(
342
343
  value: order[:risk_alloc]
343
344
  )
345
+ slice_alloc_out = Cryptum.beautify_large_number(
346
+ value: order[:slice_alloc]
347
+ )
344
348
  invest_out = Cryptum.beautify_large_number(
345
349
  value: order[:invest]
346
350
  )
@@ -354,7 +358,7 @@ module Cryptum
354
358
  plan_no = "#{order[:plan_no]}|"
355
359
  fiat = "#{autotrade_percent}% of $#{fiat_avail_out} = "
356
360
  alloc = "$#{risk_alloc_out} @ #{order[:allocation_percent]}% = "
357
- invest = "$#{invest_out} + #{tpm_out}% = "
361
+ invest = "$#{slice_alloc_out} OR MIN OF $#{invest_out} + #{tpm_out}% = "
358
362
 
359
363
  returns = "$#{return_out}|"
360
364
  profit = "Profit: $#{profit_out}"
@@ -23,6 +23,32 @@ module Cryptum
23
23
  autotrade_percent = order[:autotrade_percent]
24
24
  order_color = order[:color]
25
25
 
26
+ fiat_avail_out = Cryptum.beautify_large_number(
27
+ value: order[:fiat_available]
28
+ )
29
+ risk_alloc_out = Cryptum.beautify_large_number(
30
+ value: order[:risk_alloc]
31
+ )
32
+ slice_alloc_out = Cryptum.beautify_large_number(
33
+ value: order[:slice_alloc]
34
+ )
35
+ invest_out = Cryptum.beautify_large_number(
36
+ value: order[:invest]
37
+ )
38
+ profit_out = Cryptum.beautify_large_number(
39
+ value: order[:profit]
40
+ )
41
+ tpm_out = format('%0.2f', tpm)
42
+ return_out = Cryptum.beautify_large_number(
43
+ value: order[:return]
44
+ )
45
+ autotrade_details = "1. bot_conf[:autotrade_portfolio_percent] is set to #{autotrade_percent}% of $#{fiat_avail_out},"
46
+ risk_alloc_details = " making $#{risk_alloc_out} available for this slice in the order plan cycle."
47
+ slice_alloc_details = "2. With $#{risk_alloc_out} available and a slice allocation of #{order[:allocation_percent]}%, $#{slice_alloc_out} OR AN ORDER MINIMUM"
48
+ invest_details = " of $#{invest_out} will be allocated for this slice (whichever is highest)."
49
+ tpm_details = "3. With a slice allocation of $#{invest_out} plus bot_conf[:target_profit_margin_percent] (TPM)"
50
+ profit = " equal to #{tpm_out}% $#{return_out} will be returned. With $#{invest_out} invested the profit equals $#{profit_out}."
51
+
26
52
  # UI
27
53
  col_just1 = (Curses.cols - Cryptum::UI.col_first) - 1
28
54
  col_just3 = (Curses.cols - Cryptum::UI.col_third) - 1
@@ -62,7 +88,7 @@ module Cryptum
62
88
  Cryptum::UI.colorize(
63
89
  ui_win: order_plan_details_win,
64
90
  color: order_color,
65
- style: :bold,
91
+ style: header_style,
66
92
  string: header_str
67
93
  )
68
94
 
@@ -71,38 +97,71 @@ module Cryptum
71
97
  order_plan_details_win.setpos(out_line_no, Cryptum::UI.col_first)
72
98
  order_plan_details_win.clrtoeol
73
99
 
74
- fiat_avail_out = Cryptum.beautify_large_number(
75
- value: order[:fiat_available]
76
- )
77
- risk_alloc_out = Cryptum.beautify_large_number(
78
- value: order[:risk_alloc]
100
+ Cryptum::UI.colorize(
101
+ ui_win: order_plan_details_win,
102
+ color: order_color,
103
+ style: style,
104
+ string: autotrade_details.ljust(col_just1, ' ')
79
105
  )
80
- invest_out = Cryptum.beautify_large_number(
81
- value: order[:invest]
106
+
107
+ # ROW 4
108
+ out_line_no += 1
109
+ order_plan_details_win.setpos(out_line_no, Cryptum::UI.col_first)
110
+ order_plan_details_win.clrtoeol
111
+
112
+ Cryptum::UI.colorize(
113
+ ui_win: order_plan_details_win,
114
+ color: order_color,
115
+ style: style,
116
+ string: risk_alloc_details.ljust(col_just1, ' ')
82
117
  )
83
- profit_out = Cryptum.beautify_large_number(
84
- value: order[:profit]
118
+
119
+ # ROW 5
120
+ out_line_no += 1
121
+ order_plan_details_win.setpos(out_line_no, Cryptum::UI.col_first)
122
+ order_plan_details_win.clrtoeol
123
+
124
+ Cryptum::UI.colorize(
125
+ ui_win: order_plan_details_win,
126
+ color: order_color,
127
+ style: style,
128
+ string: slice_alloc_details.ljust(col_just1, ' ')
85
129
  )
86
- tpm_out = format('%0.2f', tpm)
87
- return_out = Cryptum.beautify_large_number(
88
- value: order[:return]
130
+
131
+ # ROW 6
132
+ out_line_no += 1
133
+ order_plan_details_win.setpos(out_line_no, Cryptum::UI.col_first)
134
+ order_plan_details_win.clrtoeol
135
+
136
+ Cryptum::UI.colorize(
137
+ ui_win: order_plan_details_win,
138
+ color: order_color,
139
+ style: style,
140
+ string: invest_details.ljust(col_just1, ' ')
89
141
  )
90
- plan_no = "#{order[:plan_no]}|"
91
- fiat = "#{autotrade_percent}% of $#{fiat_avail_out} = "
92
- alloc = "$#{risk_alloc_out} @ #{order[:allocation_percent]}% = "
93
- invest = "$#{invest_out} + #{tpm_out}% = "
94
142
 
95
- returns = "$#{return_out}|"
96
- profit = "Profit: $#{profit_out}"
143
+ # ROW 7
144
+ out_line_no += 1
145
+ order_plan_details_win.setpos(out_line_no, Cryptum::UI.col_first)
146
+ order_plan_details_win.clrtoeol
147
+
148
+ Cryptum::UI.colorize(
149
+ ui_win: order_plan_details_win,
150
+ color: order_color,
151
+ style: style,
152
+ string: tpm_details.ljust(col_just1, ' ')
153
+ )
97
154
 
98
- order_plan_invest = "#{plan_no}#{fiat}#{alloc}#{invest}"
99
- order_plan_return = "#{returns}#{profit}"
155
+ # ROW 8
156
+ out_line_no += 1
157
+ order_plan_details_win.setpos(out_line_no, Cryptum::UI.col_first)
158
+ order_plan_details_win.clrtoeol
100
159
 
101
160
  Cryptum::UI.colorize(
102
161
  ui_win: order_plan_details_win,
103
162
  color: order_color,
104
163
  style: style,
105
- string: "#{order_plan_invest}#{order_plan_return}".ljust(col_just1, '.')
164
+ string: profit.ljust(col_just1, ' ')
106
165
  )
107
166
 
108
167
  # Clear to OK ROW
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptum
4
- VERSION = '0.0.269'
4
+ VERSION = '0.0.270'
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.269
4
+ version: 0.0.270
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.