cryptum 0.0.303 → 0.0.305
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 +4 -3
- data/bin/cryptum-forecast +8 -8
- data/lib/cryptum/api.rb +1 -1
- data/lib/cryptum/event/buy.rb +2 -2
- data/lib/cryptum/event.rb +11 -11
- data/lib/cryptum/order_book/generate.rb +1 -1
- data/lib/cryptum/order_book/market_trend.rb +3 -3
- data/lib/cryptum/ui/market_trend.rb +7 -7
- data/lib/cryptum/ui/order_execute_details.rb +15 -15
- data/lib/cryptum/ui/order_execution.rb +24 -26
- data/lib/cryptum/ui/order_plan.rb +20 -22
- data/lib/cryptum/ui/order_plan_details.rb +5 -5
- data/lib/cryptum/ui/order_timer.rb +1 -1
- data/lib/cryptum/ui/portfolio.rb +6 -6
- data/lib/cryptum/ui/signal_engine.rb +7 -7
- data/lib/cryptum/ui/ticker.rb +3 -3
- data/lib/cryptum/version.rb +1 -1
- data/lib/cryptum.rb +4 -2
- metadata +2 -3
- data/lib/cryptum/order_execute_details.rb +0 -56
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fa6bd3369a06dd9f5d410955b8aca61eb26e5fb0f5a1c348d661fc95e9320dc0
|
|
4
|
+
data.tar.gz: 9f8b723a28035a27169b68938714ababac1c458cd54920eae44bb01be9819479
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 72773efa80c1b5f21afbfee9eeaaf336320c05ec880390ea50ba909515423f21cbca47ee76c33dc634b7c37c37a2a8241d11f7dd381d98cb16086b27be7ecaf5
|
|
7
|
+
data.tar.gz: 6a9de02de4f2eb3dbb3ab41f85f7e7e7fa07fd6404eea20a87e46c39d10d4c57908190914355487540ff52e2ad94d8b2b439faf76c584761847743fe72e8badd
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2022-12-
|
|
3
|
+
# on 2022-12-09 23:10:15 UTC using RuboCop version 1.40.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
|
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
8
8
|
|
|
9
|
-
# Offense count:
|
|
9
|
+
# Offense count: 5
|
|
10
10
|
Lint/UselessAssignment:
|
|
11
|
-
|
|
11
|
+
Exclude:
|
|
12
|
+
- 'lib/cryptum/api.rb'
|
|
12
13
|
|
|
13
14
|
# Offense count: 5
|
|
14
15
|
# This cop supports safe autocorrection (--autocorrect).
|
data/bin/cryptum-forecast
CHANGED
|
@@ -123,17 +123,17 @@ begin
|
|
|
123
123
|
env: env
|
|
124
124
|
)
|
|
125
125
|
|
|
126
|
-
crypto = products.last[:base_currency]
|
|
126
|
+
# crypto = products.last[:base_currency]
|
|
127
127
|
fiat = products.last[:quote_currency]
|
|
128
128
|
fiat_portfolio_file = "#{option_choice.repo_root}/order_books/#{fiat}_PORTFOLIO.json"
|
|
129
129
|
|
|
130
|
-
portfolio = Cryptum::API.get_portfolio(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
)
|
|
130
|
+
# portfolio = Cryptum::API.get_portfolio(
|
|
131
|
+
# option_choice: option_choice,
|
|
132
|
+
# env: env,
|
|
133
|
+
# crypto: crypto,
|
|
134
|
+
# fiat: fiat,
|
|
135
|
+
# fiat_portfolio_file: fiat_portfolio_file
|
|
136
|
+
# )
|
|
137
137
|
|
|
138
138
|
fiat_portfolio = JSON.parse(
|
|
139
139
|
File.read(fiat_portfolio_file),
|
data/lib/cryptum/api.rb
CHANGED
|
@@ -248,7 +248,7 @@ module Cryptum
|
|
|
248
248
|
this_product = event_history.order_book[:this_product]
|
|
249
249
|
base_increment = this_product[:base_increment]
|
|
250
250
|
quote_increment = this_product[:quote_increment]
|
|
251
|
-
crypto_smallest_decimal = base_increment.to_s.split('.')[-1].length
|
|
251
|
+
# crypto_smallest_decimal = base_increment.to_s.split('.')[-1].length
|
|
252
252
|
fiat_smallest_decimal = quote_increment.to_s.split('.')[-1].length
|
|
253
253
|
|
|
254
254
|
order_hash = {}
|
data/lib/cryptum/event/buy.rb
CHANGED
|
@@ -16,7 +16,7 @@ module Cryptum
|
|
|
16
16
|
event_history = opts[:event_history]
|
|
17
17
|
order_type = opts[:order_type]
|
|
18
18
|
fiat_smallest_decimal = opts[:fiat_smallest_decimal]
|
|
19
|
-
fiat_portfolio_file = opts[:fiat_portfolio_file]
|
|
19
|
+
# fiat_portfolio_file = opts[:fiat_portfolio_file]
|
|
20
20
|
order_history = opts[:order_history]
|
|
21
21
|
crypto_smallest_decimal = opts[:crypto_smallest_decimal]
|
|
22
22
|
# base_min_size = opts[:base_min_size]
|
|
@@ -26,7 +26,7 @@ module Cryptum
|
|
|
26
26
|
# Initialize some bot_conf variables
|
|
27
27
|
pie_in_sky_buy_percent = bot_conf[:pie_in_sky_buy_percent].to_f
|
|
28
28
|
autotrade_portfolio_percent = bot_conf[:autotrade_portfolio_percent].to_f
|
|
29
|
-
target_profit_margin_percent = bot_conf[:target_profit_margin_percent].to_f
|
|
29
|
+
# target_profit_margin_percent = bot_conf[:target_profit_margin_percent].to_f
|
|
30
30
|
|
|
31
31
|
crypto_currency = option_choice.symbol.to_s.upcase.split('_').first
|
|
32
32
|
portfolio = event_history.order_book[:portfolio]
|
data/lib/cryptum/event.rb
CHANGED
|
@@ -27,12 +27,12 @@ module Cryptum
|
|
|
27
27
|
terminal_win = opts[:terminal_win]
|
|
28
28
|
event_history = opts[:event_history]
|
|
29
29
|
indicator_status = opts[:indicator_status]
|
|
30
|
-
indicator_history = opts[:indicator_history]
|
|
30
|
+
# indicator_history = opts[:indicator_history]
|
|
31
31
|
bot_conf = opts[:bot_conf]
|
|
32
|
-
ai_enabled = opts[:ai_enabled]
|
|
32
|
+
# ai_enabled = opts[:ai_enabled]
|
|
33
33
|
|
|
34
|
-
candles = event_history.order_book[:candles]
|
|
35
|
-
order_history = event_history.order_book[:order_history]
|
|
34
|
+
# candles = event_history.order_book[:candles]
|
|
35
|
+
# order_history = event_history.order_book[:order_history]
|
|
36
36
|
this_product = event_history.order_book[:this_product]
|
|
37
37
|
fiat = this_product[:quote_currency]
|
|
38
38
|
fiat_portfolio_file = "#{option_choice.repo_root}/order_books/#{fiat}_PORTFOLIO.json"
|
|
@@ -78,13 +78,13 @@ module Cryptum
|
|
|
78
78
|
)
|
|
79
79
|
end
|
|
80
80
|
|
|
81
|
-
order_countdown = Cryptum::UI::OrderTimer.refresh(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
)
|
|
81
|
+
# order_countdown = Cryptum::UI::OrderTimer.refresh(
|
|
82
|
+
# option_choice: option_choice,
|
|
83
|
+
# event_history: event_history,
|
|
84
|
+
# order_timer_win: terminal_win.order_timer_section,
|
|
85
|
+
# indicator_status: indicator_status,
|
|
86
|
+
# key_press_event: terminal_win.key_press_event
|
|
87
|
+
# )
|
|
88
88
|
|
|
89
89
|
if event_history.event_type == :l2update ||
|
|
90
90
|
terminal_win.market_trend_ui_resize
|
|
@@ -19,7 +19,7 @@ module Cryptum
|
|
|
19
19
|
start_time = opts[:start_time]
|
|
20
20
|
option_choice = opts[:option_choice]
|
|
21
21
|
env = opts[:env]
|
|
22
|
-
bot_conf = opts[:bot_conf]
|
|
22
|
+
# bot_conf = opts[:bot_conf]
|
|
23
23
|
|
|
24
24
|
order_book_file = "#{option_choice.repo_root}/order_books/#{option_choice.symbol}.ORDER_BOOK.json"
|
|
25
25
|
|
|
@@ -66,14 +66,14 @@ module Cryptum
|
|
|
66
66
|
# IT IS ABSOLUTELY CRITICAL THIS METHOD IS AS FAST AS POSSIBLE
|
|
67
67
|
# TO AVOID TICKER PRICE SYNCING ISSUES.
|
|
68
68
|
option_choice = opts[:option_choice]
|
|
69
|
-
terminal_win = opts[:terminal_win]
|
|
69
|
+
# terminal_win = opts[:terminal_win]
|
|
70
70
|
event_history = opts[:event_history]
|
|
71
71
|
bot_conf = opts[:bot_conf]
|
|
72
72
|
|
|
73
73
|
ai_enabled = bot_conf[:artifical_intelligence]
|
|
74
74
|
gross_tpm = bot_conf[:target_profit_margin_percent].to_f
|
|
75
|
-
order_history = event_history.order_book[:order_history]
|
|
76
|
-
order_history_meta = event_history.order_book[:order_history_meta]
|
|
75
|
+
# order_history = event_history.order_book[:order_history]
|
|
76
|
+
# order_history_meta = event_history.order_book[:order_history_meta]
|
|
77
77
|
|
|
78
78
|
# Only retain past 24 hours of
|
|
79
79
|
# order history meta for bought, sold, and expired
|
|
@@ -13,14 +13,14 @@ module Cryptum
|
|
|
13
13
|
# )
|
|
14
14
|
|
|
15
15
|
public_class_method def self.refresh(opts = {})
|
|
16
|
-
option_choice = opts[:option_choice]
|
|
16
|
+
# option_choice = opts[:option_choice]
|
|
17
17
|
market_trend_win = opts[:market_trend_win]
|
|
18
18
|
event_history = opts[:event_history]
|
|
19
|
-
key_press_event = opts[:key_press_event]
|
|
19
|
+
# key_press_event = opts[:key_press_event]
|
|
20
20
|
event = opts[:event]
|
|
21
21
|
indicator_status = opts[:indicator_status]
|
|
22
|
-
bot_conf = opts[:bot_conf]
|
|
23
|
-
reset_counter = opts[:reset_counter]
|
|
22
|
+
# bot_conf = opts[:bot_conf]
|
|
23
|
+
# reset_counter = opts[:reset_counter]
|
|
24
24
|
|
|
25
25
|
indicator_hash = Cryptum::OrderBook::MarketTrend.status(
|
|
26
26
|
event_history: event_history,
|
|
@@ -48,9 +48,9 @@ module Cryptum
|
|
|
48
48
|
# UI
|
|
49
49
|
# col_just1 = 12
|
|
50
50
|
col_just1 = (Curses.cols - Cryptum::UI.col_first) - 1
|
|
51
|
-
col_just2 = 14
|
|
52
|
-
col_just3 = 21
|
|
53
|
-
col_just3_alt = (Curses.cols - Cryptum::UI.col_third) - 1
|
|
51
|
+
# col_just2 = 14
|
|
52
|
+
# col_just3 = 21
|
|
53
|
+
# col_just3_alt = (Curses.cols - Cryptum::UI.col_third) - 1
|
|
54
54
|
col_just4 = Curses.cols - Cryptum::UI.col_fourth
|
|
55
55
|
|
|
56
56
|
# ROW 1
|
|
@@ -12,16 +12,16 @@ module Cryptum
|
|
|
12
12
|
# )
|
|
13
13
|
|
|
14
14
|
public_class_method def self.refresh(opts = {})
|
|
15
|
-
option_choice = opts[:option_choice]
|
|
15
|
+
# option_choice = opts[:option_choice]
|
|
16
16
|
event_history = opts[:event_history]
|
|
17
17
|
order_execute_details_win = opts[:order_execute_details_win]
|
|
18
|
-
indicator_status = opts[:indicator_status]
|
|
19
|
-
key_press_event = opts[:key_press_event]
|
|
18
|
+
# indicator_status = opts[:indicator_status]
|
|
19
|
+
# key_press_event = opts[:key_press_event]
|
|
20
20
|
|
|
21
21
|
order_meta_data = event_history.order_execute_selected_data
|
|
22
|
-
tpm = order_meta_data[:tpm]
|
|
23
|
-
autotrade_percent = order_meta_data[:autotrade_percent]
|
|
24
|
-
order_plan_no = order_meta_data[:plan_no]
|
|
22
|
+
# tpm = order_meta_data[:tpm]
|
|
23
|
+
# autotrade_percent = order_meta_data[:autotrade_percent]
|
|
24
|
+
# order_plan_no = order_meta_data[:plan_no]
|
|
25
25
|
|
|
26
26
|
order_color = order_meta_data[:color].to_sym
|
|
27
27
|
case order_color
|
|
@@ -94,9 +94,9 @@ module Cryptum
|
|
|
94
94
|
order_hist_created_finished_ln = '- Creation Date: N/A | Finished Date: N/A'
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
-
risk_alloc_out = Cryptum.beautify_large_number(
|
|
98
|
-
|
|
99
|
-
)
|
|
97
|
+
# risk_alloc_out = Cryptum.beautify_large_number(
|
|
98
|
+
# value: order_meta_data[:risk_alloc]
|
|
99
|
+
# )
|
|
100
100
|
invest_out = Cryptum.beautify_large_number(
|
|
101
101
|
value: order_meta_data[:invest]
|
|
102
102
|
)
|
|
@@ -109,10 +109,10 @@ module Cryptum
|
|
|
109
109
|
target_price_out = Cryptum.beautify_large_number(
|
|
110
110
|
value: order_meta_data[:target_price]
|
|
111
111
|
)
|
|
112
|
-
profit_out = Cryptum.beautify_large_number(
|
|
113
|
-
|
|
114
|
-
)
|
|
115
|
-
plan_no = "#{order_meta_data[:plan_no]}|"
|
|
112
|
+
# profit_out = Cryptum.beautify_large_number(
|
|
113
|
+
# value: order_meta_data[:profit]
|
|
114
|
+
# )
|
|
115
|
+
# plan_no = "#{order_meta_data[:plan_no]}|"
|
|
116
116
|
|
|
117
117
|
invest = "$#{invest_out} @ "
|
|
118
118
|
tick = "$#{price_out} = "
|
|
@@ -127,8 +127,8 @@ module Cryptum
|
|
|
127
127
|
|
|
128
128
|
# UI
|
|
129
129
|
col_just1 = (Curses.cols - Cryptum::UI.col_first) - 1
|
|
130
|
-
col_just3 = (Curses.cols - Cryptum::UI.col_third) - 1
|
|
131
|
-
col_just4 = Curses.cols - Cryptum::UI.col_fourth
|
|
130
|
+
# col_just3 = (Curses.cols - Cryptum::UI.col_third) - 1
|
|
131
|
+
# col_just4 = Curses.cols - Cryptum::UI.col_fourth
|
|
132
132
|
|
|
133
133
|
# ROW 1
|
|
134
134
|
out_line_no = 0
|
|
@@ -17,10 +17,10 @@ module Cryptum
|
|
|
17
17
|
order_execute_win = opts[:order_execute_win]
|
|
18
18
|
env = opts[:env]
|
|
19
19
|
event_history = opts[:event_history]
|
|
20
|
-
key_press_event = opts[:key_press_event]
|
|
20
|
+
# key_press_event = opts[:key_press_event]
|
|
21
21
|
indicator_status = opts[:indicator_status]
|
|
22
22
|
bot_conf = opts[:bot_conf]
|
|
23
|
-
fiat_portfolio_file = opts[:fiat_portfolio_file]
|
|
23
|
+
# fiat_portfolio_file = opts[:fiat_portfolio_file]
|
|
24
24
|
|
|
25
25
|
event_type = event_history.event_type if option_choice.autotrade
|
|
26
26
|
event_side = event_history.event[:side].to_s.to_sym if option_choice.autotrade
|
|
@@ -115,7 +115,7 @@ module Cryptum
|
|
|
115
115
|
fiat_invested_this_order = size.to_f * price.to_f
|
|
116
116
|
|
|
117
117
|
fiat_portfolio = event_history.order_book[:fiat_portfolio]
|
|
118
|
-
fiat_balance = format('%0.2f', fiat_portfolio.first[:balance])
|
|
118
|
+
# fiat_balance = format('%0.2f', fiat_portfolio.first[:balance])
|
|
119
119
|
fiat_avail_for_trade = format('%0.2f', fiat_portfolio.first[:available])
|
|
120
120
|
|
|
121
121
|
event_history.red_pill = true if fiat_invested_this_order > fiat_avail_for_trade.to_f
|
|
@@ -211,9 +211,9 @@ module Cryptum
|
|
|
211
211
|
order_history_meta.each do |meta|
|
|
212
212
|
next unless meta[:buy_order_id] == buy_order_id
|
|
213
213
|
|
|
214
|
-
buy_done_at_hash_arr = order_history.select do |oh|
|
|
215
|
-
|
|
216
|
-
end
|
|
214
|
+
# buy_done_at_hash_arr = order_history.select do |oh|
|
|
215
|
+
# oh[:id] == meta[:buy_order_id]
|
|
216
|
+
# end
|
|
217
217
|
meta[:done_at] = Time.now.strftime('%Y-%m-%d %H:%M:%S.%N%z')
|
|
218
218
|
meta[:color] = :white
|
|
219
219
|
end
|
|
@@ -283,9 +283,9 @@ module Cryptum
|
|
|
283
283
|
order_history_meta.each do |meta|
|
|
284
284
|
next unless meta[:sell_order_id] == sell_order_id
|
|
285
285
|
|
|
286
|
-
sell_done_at_hash_arr = order_history.select do |oh|
|
|
287
|
-
|
|
288
|
-
end
|
|
286
|
+
# sell_done_at_hash_arr = order_history.select do |oh|
|
|
287
|
+
# oh[:id] == meta[:sell_order_id]
|
|
288
|
+
# end
|
|
289
289
|
meta[:done_at] = Time.now.strftime('%Y-%m-%d %H:%M:%S.%N%z')
|
|
290
290
|
|
|
291
291
|
# TODO: Retry sell order if the original sell order expires.
|
|
@@ -306,9 +306,9 @@ module Cryptum
|
|
|
306
306
|
order_history_meta.each do |meta|
|
|
307
307
|
next unless meta[:sell_order_id] == sell_order_id
|
|
308
308
|
|
|
309
|
-
sell_done_at_hash_arr = order_history.select do |oh|
|
|
310
|
-
|
|
311
|
-
end
|
|
309
|
+
# sell_done_at_hash_arr = order_history.select do |oh|
|
|
310
|
+
# oh[:id] == meta[:sell_order_id]
|
|
311
|
+
# end
|
|
312
312
|
meta[:done_at] = Time.now.strftime('%Y-%m-%d %H:%M:%S.%N%z')
|
|
313
313
|
# meta[:done_at] = sell_done_at_hash_arr.first[:done_at] unless sell_done_at_hash_arr.empty?
|
|
314
314
|
meta[:color] = :green
|
|
@@ -367,8 +367,8 @@ module Cryptum
|
|
|
367
367
|
|
|
368
368
|
# UI
|
|
369
369
|
col_just1 = (Curses.cols - Cryptum::UI.col_first) - 1
|
|
370
|
-
col_just3 = (Curses.cols - Cryptum::UI.col_third) - 1
|
|
371
|
-
col_just4 = Curses.cols - Cryptum::UI.col_fourth
|
|
370
|
+
# col_just3 = (Curses.cols - Cryptum::UI.col_third) - 1
|
|
371
|
+
# col_just4 = Curses.cols - Cryptum::UI.col_fourth
|
|
372
372
|
|
|
373
373
|
# ROW 1
|
|
374
374
|
out_line_no = 0
|
|
@@ -413,20 +413,18 @@ module Cryptum
|
|
|
413
413
|
)
|
|
414
414
|
|
|
415
415
|
# ROWS 3-10
|
|
416
|
+
remaining_blank_rows = 0
|
|
417
|
+
remaining_blank_rows = max_rows_to_display if order_history_meta.empty?
|
|
416
418
|
max_rows_to_display = event_history.order_execute_max_rows_to_display
|
|
417
|
-
max_records_available_to_display = event_history.order_execute_max_records_available_to_display
|
|
418
419
|
first_row = event_history.order_execute_index_offset
|
|
419
420
|
last_row = first_row + max_rows_to_display
|
|
420
|
-
remaining_blank_rows = 0
|
|
421
421
|
if last_row >= order_history_meta.length
|
|
422
422
|
last_row = order_history_meta.length - 1
|
|
423
423
|
event_history.order_execute_max_records_available_to_display = last_row if last_row < max_rows_to_display
|
|
424
|
-
first_row = event_history.order_execute_max_records_available_to_display
|
|
425
|
-
# event_history.order_execute_index_offset = first_row
|
|
424
|
+
first_row = last_row - event_history.order_execute_max_records_available_to_display
|
|
426
425
|
event_history.order_execute_index_offset = first_row
|
|
427
426
|
remaining_blank_rows = max_rows_to_display - last_row
|
|
428
427
|
end
|
|
429
|
-
remaining_blank_rows = max_rows_to_display if order_history_meta.empty?
|
|
430
428
|
|
|
431
429
|
if order_history_meta.any?
|
|
432
430
|
selected_order = event_history.order_execute_selected_data
|
|
@@ -441,9 +439,9 @@ module Cryptum
|
|
|
441
439
|
selected_order[:color] = meta[:color]
|
|
442
440
|
end
|
|
443
441
|
|
|
444
|
-
risk_alloc_out = Cryptum.beautify_large_number(
|
|
445
|
-
|
|
446
|
-
)
|
|
442
|
+
# risk_alloc_out = Cryptum.beautify_large_number(
|
|
443
|
+
# value: meta[:risk_alloc]
|
|
444
|
+
# )
|
|
447
445
|
invest_out = Cryptum.beautify_large_number(
|
|
448
446
|
value: meta[:invest]
|
|
449
447
|
)
|
|
@@ -456,9 +454,9 @@ module Cryptum
|
|
|
456
454
|
target_price_out = Cryptum.beautify_large_number(
|
|
457
455
|
value: meta[:target_price]
|
|
458
456
|
)
|
|
459
|
-
profit_out = Cryptum.beautify_large_number(
|
|
460
|
-
|
|
461
|
-
)
|
|
457
|
+
# profit_out = Cryptum.beautify_large_number(
|
|
458
|
+
# value: meta[:profit]
|
|
459
|
+
# )
|
|
462
460
|
plan_no = meta[:plan_no]
|
|
463
461
|
|
|
464
462
|
buy_created_at_hash_arr = order_history.select do |oh|
|
|
@@ -495,7 +493,7 @@ module Cryptum
|
|
|
495
493
|
|
|
496
494
|
# Clear to SUMMARY
|
|
497
495
|
# (Only Applicable if order_book[:order_history_meta] < max_rows_to_display)
|
|
498
|
-
out_line_no += 1
|
|
496
|
+
# out_line_no += 1
|
|
499
497
|
rows_to_blank = (out_line_no + remaining_blank_rows) - 1
|
|
500
498
|
(out_line_no..rows_to_blank).each do |clr_line|
|
|
501
499
|
out_line_no = clr_line
|
|
@@ -16,10 +16,10 @@ module Cryptum
|
|
|
16
16
|
option_choice = opts[:option_choice]
|
|
17
17
|
order_plan_win = opts[:order_plan_win]
|
|
18
18
|
event_history = opts[:event_history]
|
|
19
|
-
key_press_event = opts[:key_press_event]
|
|
19
|
+
# key_press_event = opts[:key_press_event]
|
|
20
20
|
indicator_status = opts[:indicator_status]
|
|
21
21
|
bot_conf = opts[:bot_conf]
|
|
22
|
-
fiat_portfolio_file = opts[:fiat_portfolio_file]
|
|
22
|
+
# fiat_portfolio_file = opts[:fiat_portfolio_file]
|
|
23
23
|
|
|
24
24
|
ticker_price = event_history.order_book[:ticker_price].to_f
|
|
25
25
|
return event_history unless ticker_price.positive?
|
|
@@ -27,13 +27,13 @@ module Cryptum
|
|
|
27
27
|
market_trend_color = plan_color = :white
|
|
28
28
|
|
|
29
29
|
this_product = event_history.order_book[:this_product]
|
|
30
|
-
symbol_out = this_product[:id]
|
|
31
|
-
quote_increment = this_product[:quote_increment]
|
|
30
|
+
# symbol_out = this_product[:id]
|
|
31
|
+
# quote_increment = this_product[:quote_increment]
|
|
32
32
|
base_increment = this_product[:base_increment]
|
|
33
33
|
# base_min_size = this_product[:base_min_size].to_f
|
|
34
34
|
min_market_funds = this_product[:min_market_funds]
|
|
35
35
|
|
|
36
|
-
fiat_smallest_decimal = quote_increment.to_s.split('.')[-1].length
|
|
36
|
+
# fiat_smallest_decimal = quote_increment.to_s.split('.')[-1].length
|
|
37
37
|
crypto_smallest_decimal = base_increment.to_s.split('.')[-1].length
|
|
38
38
|
|
|
39
39
|
autotrade_percent = bot_conf[:autotrade_portfolio_percent].to_f
|
|
@@ -50,23 +50,23 @@ module Cryptum
|
|
|
50
50
|
raise "ID for Crypto Currency, #{crypto_currency} Not Found" if this_account.empty?
|
|
51
51
|
|
|
52
52
|
balance = format("%0.#{crypto_smallest_decimal}f", this_account.first[:balance])
|
|
53
|
-
avail_for_trade = format("%0.#{crypto_smallest_decimal}f", this_account.first[:available])
|
|
53
|
+
# avail_for_trade = format("%0.#{crypto_smallest_decimal}f", this_account.first[:available])
|
|
54
54
|
|
|
55
55
|
fiat_portfolio = event_history.order_book[:fiat_portfolio]
|
|
56
56
|
total_holdings = format('%0.2f', fiat_portfolio.first[:total_holdings])
|
|
57
|
-
fiat_balance = format('%0.2f', fiat_portfolio.first[:balance])
|
|
57
|
+
# fiat_balance = format('%0.2f', fiat_portfolio.first[:balance])
|
|
58
58
|
fiat_avail_for_trade = format('%0.2f', fiat_portfolio.first[:available])
|
|
59
59
|
|
|
60
60
|
fiat_budget = fiat_avail_for_trade.to_f
|
|
61
|
-
current_fiat_invested_percent = (
|
|
62
|
-
|
|
63
|
-
) * 100
|
|
61
|
+
# current_fiat_invested_percent = (
|
|
62
|
+
# 1 - (fiat_budget / total_holdings.to_f)
|
|
63
|
+
# ) * 100
|
|
64
64
|
|
|
65
|
-
order_history = event_history.order_book[:order_history]
|
|
66
|
-
open_orders = order_history.select do |order|
|
|
67
|
-
|
|
68
|
-
end
|
|
69
|
-
total_open_orders = open_orders.length
|
|
65
|
+
# order_history = event_history.order_book[:order_history]
|
|
66
|
+
# open_orders = order_history.select do |order|
|
|
67
|
+
# order[:status] == 'open'
|
|
68
|
+
# end
|
|
69
|
+
# total_open_orders = open_orders.length
|
|
70
70
|
|
|
71
71
|
order_plan = event_history.order_book[:order_plan]
|
|
72
72
|
|
|
@@ -213,7 +213,7 @@ module Cryptum
|
|
|
213
213
|
|
|
214
214
|
# UI
|
|
215
215
|
col_just1 = (Curses.cols - Cryptum::UI.col_first) - 1
|
|
216
|
-
col_just3 = (Curses.cols - Cryptum::UI.col_third) - 1
|
|
216
|
+
# col_just3 = (Curses.cols - Cryptum::UI.col_third) - 1
|
|
217
217
|
col_just4 = Curses.cols - Cryptum::UI.col_fourth
|
|
218
218
|
|
|
219
219
|
# ROW 1
|
|
@@ -259,6 +259,8 @@ module Cryptum
|
|
|
259
259
|
)
|
|
260
260
|
|
|
261
261
|
# ROWS 3-10
|
|
262
|
+
remaining_blank_rows = 0
|
|
263
|
+
remaining_blank_rows = max_rows_to_display if order_plan.empty?
|
|
262
264
|
if event_history.red_pill
|
|
263
265
|
out_line_no += 1
|
|
264
266
|
order_plan_win.setpos(out_line_no, Cryptum::UI.col_first)
|
|
@@ -337,19 +339,15 @@ module Cryptum
|
|
|
337
339
|
|
|
338
340
|
# ROWS 3-10
|
|
339
341
|
max_rows_to_display = event_history.order_plan_max_rows_to_display
|
|
340
|
-
max_records_available_to_display = event_history.order_plan_max_records_available_to_display
|
|
341
342
|
first_row = event_history.order_plan_index_offset
|
|
342
343
|
last_row = first_row + max_rows_to_display
|
|
343
|
-
remaining_blank_rows = 0
|
|
344
344
|
if last_row >= order_plan.length
|
|
345
345
|
last_row = order_plan.length - 1
|
|
346
346
|
event_history.order_plan_max_records_available_to_display = last_row if last_row < max_rows_to_display
|
|
347
347
|
first_row = last_row - event_history.order_plan_max_records_available_to_display
|
|
348
348
|
event_history.order_plan_index_offset = first_row
|
|
349
|
-
event_history.order_plan_index_offset = first_row
|
|
350
349
|
remaining_blank_rows = max_rows_to_display - last_row
|
|
351
350
|
end
|
|
352
|
-
remaining_blank_rows = max_rows_to_display if order_plan.empty?
|
|
353
351
|
|
|
354
352
|
selected_order = event_history.order_plan_selected_data
|
|
355
353
|
order_plan[first_row..last_row].each do |order|
|
|
@@ -416,11 +414,12 @@ module Cryptum
|
|
|
416
414
|
|
|
417
415
|
# Clear to SUMMARY
|
|
418
416
|
# (Only Applicable if order_book[:order_plan] < max_rows_to_display)
|
|
419
|
-
out_line_no += 1
|
|
417
|
+
# out_line_no += 1
|
|
420
418
|
rows_to_blank = (out_line_no + remaining_blank_rows) - 1
|
|
421
419
|
(out_line_no..rows_to_blank).each do |clr_line|
|
|
422
420
|
out_line_no = clr_line
|
|
423
421
|
order_plan_win.setpos(clr_line, Cryptum::UI.col_first)
|
|
422
|
+
order_plan_win.clrtoeol
|
|
424
423
|
Cryptum::UI.colorize(
|
|
425
424
|
ui_win: order_plan_win,
|
|
426
425
|
color: :white,
|
|
@@ -430,7 +429,6 @@ module Cryptum
|
|
|
430
429
|
end
|
|
431
430
|
|
|
432
431
|
# ROW 10
|
|
433
|
-
# out_line_no += 1
|
|
434
432
|
order_plan_win.setpos(out_line_no, Cryptum::UI.col_first)
|
|
435
433
|
order_plan_win.clrtoeol
|
|
436
434
|
Cryptum::UI.colorize(
|
|
@@ -12,11 +12,11 @@ module Cryptum
|
|
|
12
12
|
# )
|
|
13
13
|
|
|
14
14
|
public_class_method def self.refresh(opts = {})
|
|
15
|
-
option_choice = opts[:option_choice]
|
|
15
|
+
# option_choice = opts[:option_choice]
|
|
16
16
|
event_history = opts[:event_history]
|
|
17
17
|
order_plan_details_win = opts[:order_plan_details_win]
|
|
18
|
-
indicator_status = opts[:indicator_status]
|
|
19
|
-
key_press_event = opts[:key_press_event]
|
|
18
|
+
# indicator_status = opts[:indicator_status]
|
|
19
|
+
# key_press_event = opts[:key_press_event]
|
|
20
20
|
|
|
21
21
|
order = event_history.order_plan_selected_data
|
|
22
22
|
tpm = order[:tpm]
|
|
@@ -52,8 +52,8 @@ module Cryptum
|
|
|
52
52
|
|
|
53
53
|
# UI
|
|
54
54
|
col_just1 = (Curses.cols - Cryptum::UI.col_first) - 1
|
|
55
|
-
col_just3 = (Curses.cols - Cryptum::UI.col_third) - 1
|
|
56
|
-
col_just4 = Curses.cols - Cryptum::UI.col_fourth
|
|
55
|
+
# col_just3 = (Curses.cols - Cryptum::UI.col_third) - 1
|
|
56
|
+
# col_just4 = Curses.cols - Cryptum::UI.col_fourth
|
|
57
57
|
|
|
58
58
|
# ROW 1
|
|
59
59
|
out_line_no = 0
|
|
@@ -15,7 +15,7 @@ module Cryptum
|
|
|
15
15
|
event_history = opts[:event_history]
|
|
16
16
|
order_timer_win = opts[:order_timer_win]
|
|
17
17
|
indicator_status = opts[:indicator_status]
|
|
18
|
-
key_press_event = opts[:key_press_event]
|
|
18
|
+
# key_press_event = opts[:key_press_event]
|
|
19
19
|
|
|
20
20
|
last_trend_reset_time = event_history.order_book[:last_trend_reset]
|
|
21
21
|
last_order_exec_time = event_history.order_book[:last_order_exec]
|
data/lib/cryptum/ui/portfolio.rb
CHANGED
|
@@ -16,18 +16,18 @@ module Cryptum
|
|
|
16
16
|
option_choice = opts[:option_choice]
|
|
17
17
|
portfolio_win = opts[:portfolio_win]
|
|
18
18
|
event_history = opts[:event_history]
|
|
19
|
-
key_press_event = opts[:key_press_event]
|
|
20
|
-
indicator_status = opts[:indicator_status]
|
|
19
|
+
# key_press_event = opts[:key_press_event]
|
|
20
|
+
# indicator_status = opts[:indicator_status]
|
|
21
21
|
bot_conf = opts[:bot_conf]
|
|
22
|
-
fiat_portfolio_file = opts[:fiat_portfolio_file]
|
|
22
|
+
# fiat_portfolio_file = opts[:fiat_portfolio_file]
|
|
23
23
|
|
|
24
24
|
ticker_price = event_history.order_book[:ticker_price].to_f
|
|
25
25
|
this_product = event_history.order_book[:this_product]
|
|
26
26
|
symbol_out = this_product[:id]
|
|
27
|
-
quote_increment = this_product[:quote_increment]
|
|
27
|
+
# quote_increment = this_product[:quote_increment]
|
|
28
28
|
base_increment = this_product[:base_increment]
|
|
29
29
|
|
|
30
|
-
fiat_smallest_decimal = quote_increment.to_s.split('.')[-1].length
|
|
30
|
+
# fiat_smallest_decimal = quote_increment.to_s.split('.')[-1].length
|
|
31
31
|
crypto_smallest_decimal = base_increment.to_s.split('.')[-1].length
|
|
32
32
|
|
|
33
33
|
autotrade_percent = format(
|
|
@@ -40,7 +40,7 @@ module Cryptum
|
|
|
40
40
|
bot_conf[:target_profit_margin_percent]
|
|
41
41
|
)
|
|
42
42
|
|
|
43
|
-
tpm_cast_as_decimal = tpm.to_f / 100
|
|
43
|
+
# tpm_cast_as_decimal = tpm.to_f / 100
|
|
44
44
|
|
|
45
45
|
crypto_currency = option_choice.symbol.to_s.upcase.split('_').first.to_sym
|
|
46
46
|
portfolio = event_history.order_book[:portfolio]
|
|
@@ -13,13 +13,13 @@ module Cryptum
|
|
|
13
13
|
# )
|
|
14
14
|
|
|
15
15
|
public_class_method def self.refresh(opts = {})
|
|
16
|
-
option_choice = opts[:option_choice]
|
|
16
|
+
# option_choice = opts[:option_choice]
|
|
17
17
|
signal_engine_win = opts[:signal_engine_win]
|
|
18
|
-
event_history = opts[:event_history]
|
|
19
|
-
key_press_event = opts[:key_press_event]
|
|
18
|
+
# event_history = opts[:event_history]
|
|
19
|
+
# key_press_event = opts[:key_press_event]
|
|
20
20
|
indicator_status = opts[:indicator_status]
|
|
21
|
-
bot_conf = opts[:bot_conf]
|
|
22
|
-
fiat_portfolio_file = opts[:fiat_portfolio_file]
|
|
21
|
+
# bot_conf = opts[:bot_conf]
|
|
22
|
+
# fiat_portfolio_file = opts[:fiat_portfolio_file]
|
|
23
23
|
|
|
24
24
|
color = :white
|
|
25
25
|
color = indicator_status.market_trend[:color] if indicator_status.market_trend
|
|
@@ -47,8 +47,8 @@ module Cryptum
|
|
|
47
47
|
# UI
|
|
48
48
|
col_just1 = (Curses.cols - Cryptum::UI.col_first) - 1
|
|
49
49
|
# col_just1 = 12
|
|
50
|
-
col_just2 = 14
|
|
51
|
-
col_just3 = (Curses.cols - Cryptum::UI.col_third) - 1
|
|
50
|
+
# col_just2 = 14
|
|
51
|
+
# col_just3 = (Curses.cols - Cryptum::UI.col_third) - 1
|
|
52
52
|
col_just4 = Curses.cols - Cryptum::UI.col_fourth
|
|
53
53
|
|
|
54
54
|
# ROW 1
|
data/lib/cryptum/ui/ticker.rb
CHANGED
|
@@ -7,10 +7,10 @@ module Cryptum
|
|
|
7
7
|
module UI
|
|
8
8
|
module Ticker
|
|
9
9
|
public_class_method def self.refresh(opts = {})
|
|
10
|
-
option_choice = opts[:option_choice]
|
|
10
|
+
# option_choice = opts[:option_choice]
|
|
11
11
|
start_time = opts[:start_time]
|
|
12
12
|
ticker_win = opts[:ticker_win]
|
|
13
|
-
key_press_event = opts[:key_press_event]
|
|
13
|
+
# key_press_event = opts[:key_press_event]
|
|
14
14
|
order_book = opts[:order_book]
|
|
15
15
|
event = opts[:event]
|
|
16
16
|
|
|
@@ -111,7 +111,7 @@ module Cryptum
|
|
|
111
111
|
margin_percent_open_24h_out = "#{Cryptum.flat_arrow} #{beautify_margin_percent_open_24h}% (#{trend})"
|
|
112
112
|
end
|
|
113
113
|
|
|
114
|
-
current_time_out = Time.now.strftime('%Y-%m-%d %H:%M:%S%z')
|
|
114
|
+
# current_time_out = Time.now.strftime('%Y-%m-%d %H:%M:%S%z')
|
|
115
115
|
|
|
116
116
|
order_history = order_book[:order_history]
|
|
117
117
|
open_sell_orders = order_history.select do |order|
|
data/lib/cryptum/version.rb
CHANGED
data/lib/cryptum.rb
CHANGED
|
@@ -137,6 +137,8 @@ module Cryptum
|
|
|
137
137
|
beautify_whole = whole_num.reverse.scan(/.{1,3}/).join(',').reverse
|
|
138
138
|
beautify_num = "#{beautify_whole}.#{fraction}" unless is_negative
|
|
139
139
|
beautify_num = "-#{beautify_whole}.#{fraction}" if is_negative
|
|
140
|
+
|
|
141
|
+
beautify_num
|
|
140
142
|
rescue Interrupt
|
|
141
143
|
# Exit Gracefully if CTRL+C is Pressed During Session
|
|
142
144
|
Cryptum.exit_gracefully(which_self: self)
|
|
@@ -149,8 +151,8 @@ module Cryptum
|
|
|
149
151
|
public_class_method def self.exit_gracefully(opts = {})
|
|
150
152
|
which_self = opts[:which_self]
|
|
151
153
|
event_history = opts[:event_history]
|
|
152
|
-
option_choice = opts[:option_choice]
|
|
153
|
-
env = opts[:env]
|
|
154
|
+
# option_choice = opts[:option_choice]
|
|
155
|
+
# env = opts[:env]
|
|
154
156
|
|
|
155
157
|
# Clear out candle data to ensure
|
|
156
158
|
# Cryptum Statistics Only Apply to
|
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.
|
|
4
|
+
version: 0.0.305
|
|
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-12-
|
|
11
|
+
date: 2022-12-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|
|
@@ -402,7 +402,6 @@ files:
|
|
|
402
402
|
- lib/cryptum/order_book/market_trend.rb
|
|
403
403
|
- lib/cryptum/order_book/profit_margin.rb
|
|
404
404
|
- lib/cryptum/order_book/weighted_avg.rb
|
|
405
|
-
- lib/cryptum/order_execute_details.rb
|
|
406
405
|
- lib/cryptum/portfolio.rb
|
|
407
406
|
- lib/cryptum/portfolio/balance.rb
|
|
408
407
|
- lib/cryptum/ui.rb
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'logger'
|
|
4
|
-
|
|
5
|
-
module Cryptum
|
|
6
|
-
module UI
|
|
7
|
-
# This plugin is used to Display Order Execute Details
|
|
8
|
-
# selected from the Order Execute Window Pane.
|
|
9
|
-
module OrderExecuteDetails
|
|
10
|
-
# Supported Method Parameters::
|
|
11
|
-
# Cryptum::UI::OrderExecuteDetails.refresh(
|
|
12
|
-
# )
|
|
13
|
-
|
|
14
|
-
public_class_method def self.refresh(opts = {})
|
|
15
|
-
option_choice = opts[:option_choice]
|
|
16
|
-
event_history = opts[:event_history]
|
|
17
|
-
order_execute_details_win = opts[:order_execute_details_win]
|
|
18
|
-
indicator_status = opts[:indicator_status]
|
|
19
|
-
key_press_event = opts[:key_press_event]
|
|
20
|
-
|
|
21
|
-
color = :white
|
|
22
|
-
|
|
23
|
-
# UI
|
|
24
|
-
col_just4 = (Curses.cols - Cryptum::UI.col_fourth) - 1
|
|
25
|
-
|
|
26
|
-
# ROW 1
|
|
27
|
-
# COLUMN 1
|
|
28
|
-
out_line_no = 0
|
|
29
|
-
order_execute_details_win.setpos(out_line_no, Cryptum::UI.col_first)
|
|
30
|
-
order_execute_details_win.clrtoeol
|
|
31
|
-
Cryptum::UI.colorize(
|
|
32
|
-
ui_win: order_execute_details_win,
|
|
33
|
-
color: :white,
|
|
34
|
-
style: :bold,
|
|
35
|
-
string: 'Order Details'
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
order_execute_details_win.refresh
|
|
39
|
-
rescue Interrupt
|
|
40
|
-
# Exit Gracefully if CTRL+C is Pressed During Session
|
|
41
|
-
Cryptum.exit_gracefully(which_self: self)
|
|
42
|
-
rescue StandardError => e
|
|
43
|
-
raise e
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
# Display Usage for this Module
|
|
47
|
-
|
|
48
|
-
public_class_method def self.help
|
|
49
|
-
puts "USAGE:
|
|
50
|
-
#{self}.refresh(
|
|
51
|
-
)
|
|
52
|
-
"
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|