cryptum 0.0.269 → 0.0.270
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 +3 -3
- data/lib/cryptum/ui/order_execute_details.rb +2 -2
- data/lib/cryptum/ui/order_plan.rb +11 -7
- data/lib/cryptum/ui/order_plan_details.rb +81 -22
- data/lib/cryptum/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f112246033a05eecb95d6b71d0ce96e7206d9aaef1cf7b675ddd453baafd8de
|
4
|
+
data.tar.gz: 399946d0c1100458ef8adcf300c190271af2cd936181c5f259153310c52e1eff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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:
|
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:
|
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:
|
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]}
|
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:
|
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:
|
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
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
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
|
-
|
81
|
-
|
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
|
-
|
84
|
-
|
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
|
-
|
87
|
-
|
88
|
-
|
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
|
-
|
96
|
-
|
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
|
-
|
99
|
-
|
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:
|
164
|
+
string: profit.ljust(col_just1, ' ')
|
106
165
|
)
|
107
166
|
|
108
167
|
# Clear to OK ROW
|
data/lib/cryptum/version.rb
CHANGED