cryptum 0.0.273 → 0.0.275
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cryptum/order_book/market_trend.rb +3 -3
- data/lib/cryptum/ui/order_execute_details.rb +40 -14
- data/lib/cryptum/ui/order_execution.rb +3 -3
- data/lib/cryptum/ui/order_plan.rb +4 -4
- data/lib/cryptum/ui/order_plan_details.rb +36 -10
- data/lib/cryptum/ui.rb +6 -2
- 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: bfa0e97a03d33ebdf5f3b3cdf06bc5b80a6315380a25ee3bf472777387e05852
|
4
|
+
data.tar.gz: 7b677b783b0beb34c32f6dd48dc5198c807f5123b30ee741252f16e1f8905221
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8666c51fbc50b5910334fda2c8f0faacf8b636e647f671cf604d28a5b503de97e93708f7a3dae34729a28f4180ee2faf53f767a1bcfb9c98cd6343b0c003d02f
|
7
|
+
data.tar.gz: ab5539626474fc75d0a72eac9d9046697f1dfcdb356a6cd83b6cb1d895151483917624c791e36eadcf58e6a40f9da5ffdaaebad5536892b85149831fe54bb282
|
@@ -72,7 +72,7 @@ module Cryptum
|
|
72
72
|
gross_tpm = bot_conf[:target_profit_margin_percent].to_f
|
73
73
|
|
74
74
|
# Only retain past 24 hours of
|
75
|
-
# order history meta for
|
75
|
+
# order history meta for bought, sold, and expired
|
76
76
|
# keep open limit sell orders indefintely
|
77
77
|
before_twenty_four_hrs_ago = Time.now - 86400
|
78
78
|
order_history = event_history.order_book[:order_history]
|
@@ -81,7 +81,7 @@ module Cryptum
|
|
81
81
|
next unless ohm[:done_at]
|
82
82
|
Time.parse(ohm[:done_at]) < before_twenty_four_hrs_ago &&
|
83
83
|
(
|
84
|
-
ohm[:color].to_sym == :
|
84
|
+
ohm[:color].to_sym == :white ||
|
85
85
|
ohm[:color].to_sym == :green ||
|
86
86
|
ohm[:color].to_sym == :cyan ||
|
87
87
|
ohm[:color].to_sym == :red
|
@@ -95,7 +95,7 @@ module Cryptum
|
|
95
95
|
order_history.find do |oh|
|
96
96
|
oh[:id] == ohm[:buy_order_id] ||
|
97
97
|
oh[:id] == ohm[:sell_order_id] ||
|
98
|
-
ohm[:color].to_sym == :
|
98
|
+
ohm[:color].to_sym == :white ||
|
99
99
|
ohm[:color].to_sym == :green
|
100
100
|
end
|
101
101
|
end
|
@@ -29,7 +29,7 @@ module Cryptum
|
|
29
29
|
order_id = order_meta_data[:buy_order_id]
|
30
30
|
when :green, :magenta, :yellow
|
31
31
|
order_id = order_meta_data[:sell_order_id]
|
32
|
-
when :
|
32
|
+
when :white
|
33
33
|
order_id = 'Expired'
|
34
34
|
else
|
35
35
|
order_id = 'N/A'
|
@@ -41,33 +41,59 @@ module Cryptum
|
|
41
41
|
order if order[:id] == order_id
|
42
42
|
end
|
43
43
|
|
44
|
+
if order_history_arr.empty? && order_color == :yellow
|
45
|
+
order_id = order_meta_data[:buy_order_id]
|
46
|
+
order_meta_data[:color] = :cyan
|
47
|
+
order_meta_data[:sell_order_id] = nil
|
48
|
+
order_history_arr = event_history.order_book[:order_history].select do |order|
|
49
|
+
order if order[:id] == order_id
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
44
53
|
order_type_ln = '- Type: N/A'
|
45
54
|
order_status_ln = '- Status: N/A'
|
46
|
-
|
47
|
-
|
55
|
+
fill_fees = 'N/A'
|
56
|
+
fill_size = 'N/A'
|
57
|
+
executed_value = 'N/A'
|
58
|
+
market_type = 'N/A'
|
59
|
+
settled = 'N/A'
|
48
60
|
if order_history_arr.any?
|
49
61
|
order_history = order_history_arr.first
|
50
62
|
order_type = order_history[:type].capitalize
|
51
63
|
time_in_force = order_history[:time_in_force].upcase
|
52
64
|
order_status = order_history[:status].upcase
|
53
65
|
created_at = order_history[:created_at]
|
54
|
-
|
66
|
+
fill_fees = order_history[:fill_fees]
|
67
|
+
fill_size = order_history[:filled_size]
|
68
|
+
executed_value = order_history[:executed_value]
|
69
|
+
market_type = order_history[:market_type]
|
70
|
+
settled = order_history[:settled]
|
55
71
|
|
56
72
|
order_side = order_history[:side].capitalize
|
57
73
|
case order_side.to_sym
|
58
74
|
when :Buy
|
59
75
|
expire_time = order_history[:expire_time]
|
60
76
|
done_at = order_history[:done_at]
|
61
|
-
|
77
|
+
order_meta_data[:color] = :cyan if done_at
|
62
78
|
when :Sell
|
63
79
|
done_at = order_history[:done_at]
|
64
80
|
end
|
65
|
-
order_hist_finished_ln = "- Finished Date: #{done_at}" if done_at
|
66
81
|
|
67
82
|
order_type_ln = "- Type: #{order_type} #{order_side} #{time_in_force}"
|
83
|
+
order_type_ln = "- Type: #{order_type} #{order_side} #{time_in_force} 1m" if time_in_force == 'GTT'
|
68
84
|
order_status_ln = "- Status: #{order_status}"
|
69
85
|
end
|
70
86
|
|
87
|
+
if created_at && (!expire_time || !done_at)
|
88
|
+
order_hist_created_finished_ln = "- Creation Date: #{created_at} | Finished Date: N/A"
|
89
|
+
elsif created_at && expire_time && !done_at
|
90
|
+
order_hist_created_finished_ln = "- Creation Date: #{created_at} | Expiring Date: #{expire_time}"
|
91
|
+
elsif created_at && done_at
|
92
|
+
order_hist_created_finished_ln = "- Creation Date: #{created_at} | Finished Date: #{done_at}"
|
93
|
+
else
|
94
|
+
order_hist_created_finished_ln = '- Creation Date: N/A | Finished Date: N/A'
|
95
|
+
end
|
96
|
+
|
71
97
|
risk_alloc_out = Cryptum.beautify_large_number(
|
72
98
|
value: order_meta_data[:risk_alloc]
|
73
99
|
)
|
@@ -93,11 +119,11 @@ module Cryptum
|
|
93
119
|
size = "*#{size_out} + "
|
94
120
|
tpm_out = "#{order_meta_data[:tpm]}% = "
|
95
121
|
targ_tick = "$#{target_price_out}"
|
96
|
-
profit = "|Profit: $#{order_meta_data[:profit]}"
|
122
|
+
profit = " | Profit: $#{order_meta_data[:profit]}"
|
97
123
|
|
98
|
-
|
99
|
-
|
100
|
-
|
124
|
+
details_ln1 = "- Slice Plan: #{invest}#{tick}#{size}#{tpm_out}#{targ_tick}#{profit}"
|
125
|
+
details_ln2 = "- Fees: $#{fill_fees} | Fill Size: *#{fill_size}"
|
126
|
+
details_ln3 = "- Executed Value: $#{executed_value} | Market Type: #{market_type} | Settled: #{settled}"
|
101
127
|
|
102
128
|
# UI
|
103
129
|
col_just1 = (Curses.cols - Cryptum::UI.col_first) - 1
|
@@ -187,7 +213,7 @@ module Cryptum
|
|
187
213
|
ui_win: order_execute_details_win,
|
188
214
|
color: order_color,
|
189
215
|
style: style,
|
190
|
-
string:
|
216
|
+
string: order_hist_created_finished_ln.ljust(col_just1, ' ')
|
191
217
|
)
|
192
218
|
|
193
219
|
# ROW 7
|
@@ -199,7 +225,7 @@ module Cryptum
|
|
199
225
|
ui_win: order_execute_details_win,
|
200
226
|
color: order_color,
|
201
227
|
style: style,
|
202
|
-
string:
|
228
|
+
string: details_ln1.ljust(col_just1, ' ')
|
203
229
|
)
|
204
230
|
|
205
231
|
# ROW 8
|
@@ -211,7 +237,7 @@ module Cryptum
|
|
211
237
|
ui_win: order_execute_details_win,
|
212
238
|
color: order_color,
|
213
239
|
style: style,
|
214
|
-
string:
|
240
|
+
string: details_ln2.ljust(col_just1, ' ')
|
215
241
|
)
|
216
242
|
|
217
243
|
# ROW 9
|
@@ -223,7 +249,7 @@ module Cryptum
|
|
223
249
|
ui_win: order_execute_details_win,
|
224
250
|
color: order_color,
|
225
251
|
style: style,
|
226
|
-
string:
|
252
|
+
string: details_ln3.ljust(col_just1, ' ')
|
227
253
|
)
|
228
254
|
|
229
255
|
# Clear to OK ROW
|
@@ -215,7 +215,7 @@ module Cryptum
|
|
215
215
|
oh[:id] == meta[:buy_order_id]
|
216
216
|
end
|
217
217
|
meta[:done_at] = Time.now.strftime('%Y-%m-%d %H:%M:%S.%N%z')
|
218
|
-
meta[:color] = :
|
218
|
+
meta[:color] = :white
|
219
219
|
end
|
220
220
|
end
|
221
221
|
|
@@ -291,7 +291,7 @@ module Cryptum
|
|
291
291
|
|
292
292
|
# Reinitiate GTFO if the previous GTFO Order Expires.
|
293
293
|
terminal_win.key_press_event.key_g = true if meta[:color] == :magenta
|
294
|
-
meta[:color] = :
|
294
|
+
meta[:color] = :white
|
295
295
|
end
|
296
296
|
end
|
297
297
|
|
@@ -332,7 +332,7 @@ module Cryptum
|
|
332
332
|
|
333
333
|
# Snag all expired orders
|
334
334
|
oh_meta_expired_arr = order_history_meta.select do |ohm|
|
335
|
-
ohm[:color].to_sym == :
|
335
|
+
ohm[:color].to_sym == :white && ohm.key?(:done_at)
|
336
336
|
end
|
337
337
|
|
338
338
|
# Snag all expired orders within past 24 hrs
|
@@ -322,10 +322,10 @@ module Cryptum
|
|
322
322
|
)
|
323
323
|
end
|
324
324
|
else
|
325
|
-
|
326
|
-
|
327
|
-
plan_color = :cyan if
|
328
|
-
plan_color = :green if
|
325
|
+
market_trend_color = plan_color = :white
|
326
|
+
market_trend_color = indicator_status.market_trend[:color] if indicator_status.market_trend
|
327
|
+
plan_color = :cyan if market_trend_color == :red
|
328
|
+
plan_color = :green if market_trend_color == :green
|
329
329
|
|
330
330
|
first_row = event_history.order_plan_index_offset
|
331
331
|
last_row = first_row + event_history.order_plan_max_rows_to_display
|
@@ -42,11 +42,13 @@ module Cryptum
|
|
42
42
|
return_out = Cryptum.beautify_large_number(
|
43
43
|
value: order[:return]
|
44
44
|
)
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
autotrade_ln1_details = "1. Autotrade is set to #{autotrade_percent}% of $#{fiat_avail_out}, making $#{risk_alloc_out} available for this slice in"
|
46
|
+
autotrade_ln2_details = ' the order plan.'
|
47
|
+
slice_alloc_ln1_details = "2. With $#{risk_alloc_out} available and a slice allocation of #{order[:allocation_percent]}%, $#{slice_alloc_out} OR AN ORDER MINIMUM"
|
48
|
+
slice_alloc_ln2_details = " of $#{invest_out} will be allocated for this slice (whichever is highest)."
|
49
|
+
profit_ln1_details = "3. With a slice allocation of $#{invest_out}, plus a TPM equal to #{tpm_out}%, $#{return_out} will be returned"
|
50
|
+
profit_ln2_details = " once sold. With $#{invest_out} invested, the gross profit equals $#{profit_out}, minus any Maker &"
|
51
|
+
profit_ln3_details = ' Taker (transaction) fees.'
|
50
52
|
|
51
53
|
# UI
|
52
54
|
col_just1 = (Curses.cols - Cryptum::UI.col_first) - 1
|
@@ -100,7 +102,19 @@ module Cryptum
|
|
100
102
|
ui_win: order_plan_details_win,
|
101
103
|
color: order_color,
|
102
104
|
style: style,
|
103
|
-
string:
|
105
|
+
string: autotrade_ln1_details.ljust(col_just1, ' ')
|
106
|
+
)
|
107
|
+
|
108
|
+
# ROW 4
|
109
|
+
out_line_no += 1
|
110
|
+
order_plan_details_win.setpos(out_line_no, Cryptum::UI.col_first)
|
111
|
+
order_plan_details_win.clrtoeol
|
112
|
+
|
113
|
+
Cryptum::UI.colorize(
|
114
|
+
ui_win: order_plan_details_win,
|
115
|
+
color: order_color,
|
116
|
+
style: style,
|
117
|
+
string: autotrade_ln2_details.ljust(col_just1, ' ')
|
104
118
|
)
|
105
119
|
|
106
120
|
# ROW 5
|
@@ -112,7 +126,7 @@ module Cryptum
|
|
112
126
|
ui_win: order_plan_details_win,
|
113
127
|
color: order_color,
|
114
128
|
style: style,
|
115
|
-
string:
|
129
|
+
string: slice_alloc_ln1_details.ljust(col_just1, ' ')
|
116
130
|
)
|
117
131
|
|
118
132
|
# ROW 6
|
@@ -124,7 +138,7 @@ module Cryptum
|
|
124
138
|
ui_win: order_plan_details_win,
|
125
139
|
color: order_color,
|
126
140
|
style: style,
|
127
|
-
string:
|
141
|
+
string: slice_alloc_ln2_details.ljust(col_just1, ' ')
|
128
142
|
)
|
129
143
|
|
130
144
|
# ROW 7
|
@@ -136,7 +150,7 @@ module Cryptum
|
|
136
150
|
ui_win: order_plan_details_win,
|
137
151
|
color: order_color,
|
138
152
|
style: style,
|
139
|
-
string:
|
153
|
+
string: profit_ln1_details.ljust(col_just1, ' ')
|
140
154
|
)
|
141
155
|
|
142
156
|
# ROW 8
|
@@ -148,7 +162,19 @@ module Cryptum
|
|
148
162
|
ui_win: order_plan_details_win,
|
149
163
|
color: order_color,
|
150
164
|
style: style,
|
151
|
-
string:
|
165
|
+
string: profit_ln2_details.ljust(col_just1, ' ')
|
166
|
+
)
|
167
|
+
|
168
|
+
# ROW 9
|
169
|
+
out_line_no += 1
|
170
|
+
order_plan_details_win.setpos(out_line_no, Cryptum::UI.col_first)
|
171
|
+
order_plan_details_win.clrtoeol
|
172
|
+
|
173
|
+
Cryptum::UI.colorize(
|
174
|
+
ui_win: order_plan_details_win,
|
175
|
+
color: order_color,
|
176
|
+
style: style,
|
177
|
+
string: profit_ln3_details.ljust(col_just1, ' ')
|
152
178
|
)
|
153
179
|
|
154
180
|
# Clear to OK ROW
|
data/lib/cryptum/ui.rb
CHANGED
@@ -129,8 +129,12 @@ module Cryptum
|
|
129
129
|
|
130
130
|
case color
|
131
131
|
when :black
|
132
|
-
|
133
|
-
|
132
|
+
# It's more Gray than Black
|
133
|
+
# color_id = 0
|
134
|
+
# color_fg = Curses::COLOR_BLACK
|
135
|
+
color_id = 256
|
136
|
+
Curses.init_color(color_id, 0, 0, 500)
|
137
|
+
color_fg = color_id
|
134
138
|
color_bg = bg
|
135
139
|
when :red
|
136
140
|
color_id = 1
|
data/lib/cryptum/version.rb
CHANGED