cryptum 0.0.304 → 0.0.306

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: b37f8bc5a291c5835e20e3aed98f9a335eec5205ccd33a300936d453c4551a82
4
- data.tar.gz: fbf92d12bf47308bbc4f3dd4ace134c6758a24e686777d7aa2c5ca86fe06e934
3
+ metadata.gz: 219457ec2de37938a864b65a951e81f8b52a095f0361991a0621355379f41801
4
+ data.tar.gz: f585c516dba1b148b9f7781942c62ce217d7b88b603cc5f005a165bc5a3fec4c
5
5
  SHA512:
6
- metadata.gz: 794d011d2d13d98cf16a80a403d331b5a812a24e5a3a4dad3beb23dffe2cb4c5da5b4b37ab93b1d08c2106c1b59c6858a0efec54ab55ca384e6cb7f5a051b960
7
- data.tar.gz: 66c6ddc051add4700c0917740aefe95a699ea8c1d1da72106410b7c1a65adce46497ffcc981ce9b018830b2a9e6d1bfc4ed23d915165a9d8779f01a152d82a13
6
+ metadata.gz: 706814ae44b2cd0c3abaf47067657cf98986121f1d417877909e2ccf852571e6a3f21606bd998a396e55db6b5e367ea76ad3a01f884d0f0c4022372675cf72d8
7
+ data.tar.gz: d207d9a246a8fb57e2dd0fe993217382b5e9c1157cfcc7bb275ac36aa8adb1811f8a37e84a8c62cfefbc9060e73a06b928b80a88ddd74926d0661702157e993b
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-08 23:59:51 UTC using RuboCop version 1.40.0.
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: 88
9
+ # Offense count: 5
10
10
  Lint/UselessAssignment:
11
- Enabled: false
11
+ Exclude:
12
+ - 'lib/cryptum/api.rb'
12
13
 
13
14
  # Offense count: 5
14
15
  # This cop supports safe autocorrection (--autocorrect).
@@ -20,15 +21,6 @@ Style/ConditionalAssignment:
20
21
  - 'lib/cryptum/option.rb'
21
22
  - 'lib/cryptum/ui/order_execute_details.rb'
22
23
 
23
- # Offense count: 2
24
- # This cop supports unsafe autocorrection (--autocorrect-all).
25
- # Configuration parameters: EnforcedStyle.
26
- # SupportedStyles: left_coerce, right_coerce, single_coerce, fdiv
27
- Style/FloatDivision:
28
- Exclude:
29
- - 'lib/cryptum/ui/order_plan.rb'
30
- - 'lib/cryptum/ui/portfolio.rb'
31
-
32
24
  # Offense count: 2
33
25
  # This cop supports safe autocorrection (--autocorrect).
34
26
  Style/RedundantAssignment:
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
- option_choice: option_choice,
132
- env: env,
133
- crypto: crypto,
134
- fiat: fiat,
135
- fiat_portfolio_file: fiat_portfolio_file
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 = {}
@@ -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
- 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
- )
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
- value: order_meta_data[:risk_alloc]
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
- value: order_meta_data[:profit]
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
- oh[:id] == meta[:buy_order_id]
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
- oh[:id] == meta[:sell_order_id]
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
- oh[:id] == meta[:sell_order_id]
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
@@ -416,14 +416,12 @@ module Cryptum
416
416
  remaining_blank_rows = 0
417
417
  remaining_blank_rows = max_rows_to_display if order_history_meta.empty?
418
418
  max_rows_to_display = event_history.order_execute_max_rows_to_display
419
- max_records_available_to_display = event_history.order_execute_max_records_available_to_display
420
419
  first_row = event_history.order_execute_index_offset
421
420
  last_row = first_row + max_rows_to_display
422
421
  if last_row >= order_history_meta.length
423
422
  last_row = order_history_meta.length - 1
424
423
  event_history.order_execute_max_records_available_to_display = last_row if last_row < max_rows_to_display
425
- first_row = event_history.order_execute_max_records_available_to_display - last_row
426
- # event_history.order_execute_index_offset = first_row
424
+ first_row = last_row - event_history.order_execute_max_records_available_to_display
427
425
  event_history.order_execute_index_offset = first_row
428
426
  remaining_blank_rows = max_rows_to_display - last_row
429
427
  end
@@ -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
- value: meta[:risk_alloc]
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
- value: meta[:profit]
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
- 1 - (fiat_budget / total_holdings.to_f)
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
- order[:status] == 'open'
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
 
@@ -75,9 +75,13 @@ module Cryptum
75
75
  balance.to_f * ticker_price
76
76
  )
77
77
 
78
+ # crypto_invested_percent = format(
79
+ # '%0.2f',
80
+ # (current_crypto_fiat_value.to_f / total_holdings.to_f) * 100
81
+ # )
78
82
  crypto_invested_percent = format(
79
83
  '%0.2f',
80
- (current_crypto_fiat_value.to_f / total_holdings.to_f) * 100
84
+ current_crypto_fiat_value.to_f.fdiv(total_holdings.to_f) * 100
81
85
  )
82
86
 
83
87
  event_history.red_pill = true if crypto_invested_percent.to_f > autotrade_percent
@@ -209,7 +213,7 @@ module Cryptum
209
213
 
210
214
  # UI
211
215
  col_just1 = (Curses.cols - Cryptum::UI.col_first) - 1
212
- col_just3 = (Curses.cols - Cryptum::UI.col_third) - 1
216
+ # col_just3 = (Curses.cols - Cryptum::UI.col_third) - 1
213
217
  col_just4 = Curses.cols - Cryptum::UI.col_fourth
214
218
 
215
219
  # ROW 1
@@ -256,7 +260,8 @@ module Cryptum
256
260
 
257
261
  # ROWS 3-10
258
262
  remaining_blank_rows = 0
259
- # remaining_blank_rows = max_rows_to_display if order_plan.empty?
263
+ max_rows_to_display = event_history.order_plan_max_rows_to_display
264
+ remaining_blank_rows = max_rows_to_display if order_plan.empty?
260
265
  if event_history.red_pill
261
266
  out_line_no += 1
262
267
  order_plan_win.setpos(out_line_no, Cryptum::UI.col_first)
@@ -335,7 +340,6 @@ module Cryptum
335
340
 
336
341
  # ROWS 3-10
337
342
  max_rows_to_display = event_history.order_plan_max_rows_to_display
338
- max_records_available_to_display = event_history.order_plan_max_records_available_to_display
339
343
  first_row = event_history.order_plan_index_offset
340
344
  last_row = first_row + max_rows_to_display
341
345
  if last_row >= order_plan.length
@@ -343,7 +347,6 @@ module Cryptum
343
347
  event_history.order_plan_max_records_available_to_display = last_row if last_row < max_rows_to_display
344
348
  first_row = last_row - event_history.order_plan_max_records_available_to_display
345
349
  event_history.order_plan_index_offset = first_row
346
- event_history.order_plan_index_offset = first_row
347
350
  remaining_blank_rows = max_rows_to_display - last_row
348
351
  end
349
352
 
@@ -412,11 +415,12 @@ module Cryptum
412
415
 
413
416
  # Clear to SUMMARY
414
417
  # (Only Applicable if order_book[:order_plan] < max_rows_to_display)
415
- out_line_no += 1
418
+ # out_line_no += 1
416
419
  rows_to_blank = (out_line_no + remaining_blank_rows) - 1
417
420
  (out_line_no..rows_to_blank).each do |clr_line|
418
421
  out_line_no = clr_line
419
422
  order_plan_win.setpos(clr_line, Cryptum::UI.col_first)
423
+ order_plan_win.clrtoeol
420
424
  Cryptum::UI.colorize(
421
425
  ui_win: order_plan_win,
422
426
  color: :white,
@@ -426,7 +430,6 @@ module Cryptum
426
430
  end
427
431
 
428
432
  # ROW 10
429
- # out_line_no += 1
430
433
  order_plan_win.setpos(out_line_no, Cryptum::UI.col_first)
431
434
  order_plan_win.clrtoeol
432
435
  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]
@@ -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]
@@ -95,9 +95,13 @@ module Cryptum
95
95
  (1 - (fiat_budget / total_holdings.to_f)) * 100
96
96
  )
97
97
 
98
+ # crypto_invested_percent = format(
99
+ # '%0.2f',
100
+ # (current_crypto_fiat_value.to_f / total_holdings.to_f) * 100
101
+ # )
98
102
  crypto_invested_percent = format(
99
103
  '%0.2f',
100
- (current_crypto_fiat_value.to_f / total_holdings.to_f) * 100
104
+ current_crypto_fiat_value.to_f.fdiv(total_holdings.to_f) * 100
101
105
  )
102
106
  # TODO: Everything Above this Line Needs to be Indicators ^
103
107
 
@@ -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
@@ -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|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptum
4
- VERSION = '0.0.304'
4
+ VERSION = '0.0.306'
5
5
  end
data/lib/cryptum.rb CHANGED
@@ -151,8 +151,8 @@ module Cryptum
151
151
  public_class_method def self.exit_gracefully(opts = {})
152
152
  which_self = opts[:which_self]
153
153
  event_history = opts[:event_history]
154
- option_choice = opts[:option_choice]
155
- env = opts[:env]
154
+ # option_choice = opts[:option_choice]
155
+ # env = opts[:env]
156
156
 
157
157
  # Clear out candle data to ensure
158
158
  # Cryptum Statistics Only Apply to
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.304
4
+ version: 0.0.306
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
@@ -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