cryptum 0.0.276 → 0.0.278

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: 289e6ff276b55bdc7ccb0c31829f8b1feaf2686492add253419711c18ec45f6e
4
- data.tar.gz: a3ad4fb287d349cf02d1448748479c69510ae94b793b0b4e47127be822ab174b
3
+ metadata.gz: 60041b70d1546198473f4cfef476cd56635ffa6d0de8581a6f051c48e837b2ef
4
+ data.tar.gz: 3c89c5fd826431cc5ee95ce5368238875fb5be4df2de38cc5cd7a9dc4d7b6e85
5
5
  SHA512:
6
- metadata.gz: 97ab7d98b9572561b0d20c4b2ba8c327b99d6b430ee3fcb5748cd7bb9450fb07549e2a00ae782b601558626687363096f060fdf7eed2887ffd21336ad91df38e
7
- data.tar.gz: e2354f2f11ed78d73d73b3897cf06e89210dcff2a55a4e9488d728304a57a5211baff213bbcd032f70774dbd7004c5d830815b57ea52e5ad55ed3d64342362a5
6
+ metadata.gz: d412ba56bd5bc779f923c921007730d4733adbb43c9ff8d5b94093c79e6a7538760e26c4dc7af03d753b39daca070448754d8e059d7a211e2caa9629a129a877
7
+ data.tar.gz: 39395c647bb87925cd64d74143e04c3e7b252922f7e06517692596c2945cc20d418800628204eb1bffc25774cfbc98067eceb5d373a257f30ad957230acddf8c
data/lib/cryptum/event.rb CHANGED
@@ -38,7 +38,7 @@ module Cryptum
38
38
  fiat_portfolio_file = "#{option_choice.repo_root}/order_books/#{fiat}_PORTFOLIO.json"
39
39
 
40
40
  # Determine if Summary UI needs updated data
41
- event_history = Cryptum::Portfolio::Balance.refresh(
41
+ Cryptum::Portfolio::Balance.refresh(
42
42
  env: env,
43
43
  option_choice: option_choice,
44
44
  terminal_win: terminal_win,
@@ -116,13 +116,17 @@ module Cryptum
116
116
  Cryptum::UI::OrderPlan.refresh(
117
117
  option_choice: option_choice,
118
118
  order_plan_win: terminal_win.order_plan_section,
119
+ env: env,
119
120
  event_history: event_history,
120
121
  key_press_event: terminal_win.key_press_event,
121
122
  indicator_status: indicator_status,
122
123
  bot_conf: bot_conf,
123
124
  fiat_portfolio_file: fiat_portfolio_file
124
125
  )
125
- # event_history.recalculate_order_plan = false
126
+ recalc_op = event_history.recalculate_order_plan
127
+ order_plan = event_history.order_book[:order_plan]
128
+ terminal_win.key_press_event.key_w = true if recalc_op || order_plan.empty?
129
+ event_history.recalculate_order_plan = false
126
130
  end
127
131
 
128
132
  if event_history.order_plan_details_win_active
@@ -135,7 +139,7 @@ module Cryptum
135
139
  end
136
140
 
137
141
  unless event_history.order_execute_details_win_active
138
- event_history = Cryptum::UI::OrderExecution.refresh(
142
+ Cryptum::UI::OrderExecution.refresh(
139
143
  option_choice: option_choice,
140
144
  order_execute_win: terminal_win.order_execute_section,
141
145
  env: env,
@@ -162,9 +166,9 @@ module Cryptum
162
166
  key_press_event: terminal_win.key_press_event
163
167
  )
164
168
 
165
- last_ticker_price = event_history.order_book[:ticker_price].to_f
166
- second_to_last_ticker_price = event_history.order_book[:ticker_price_second_to_last].to_f
167
- third_to_last_ticker_price = event_history.order_book[:ticker_price_third_to_last].to_f
169
+ # last_ticker_price = event_history.order_book[:ticker_price].to_f
170
+ # second_to_last_ticker_price = event_history.order_book[:ticker_price_second_to_last].to_f
171
+ # third_to_last_ticker_price = event_history.order_book[:ticker_price_third_to_last].to_f
168
172
 
169
173
  event_history
170
174
  rescue LoadError => e
@@ -74,9 +74,9 @@ module Cryptum
74
74
  # Only retain past 24 hours of
75
75
  # order history meta for bought, sold, and expired
76
76
  # keep open limit sell orders indefintely
77
- before_twenty_four_hrs_ago = Time.now - 86400
78
77
  order_history = event_history.order_book[:order_history]
79
78
  order_history_meta = event_history.order_book[:order_history_meta]
79
+ before_twenty_four_hrs_ago = Time.now - 86_400
80
80
  order_history_meta.delete_if do |ohm|
81
81
  next unless ohm[:done_at]
82
82
  Time.parse(ohm[:done_at]) < before_twenty_four_hrs_ago &&
@@ -21,9 +21,9 @@ module Cryptum
21
21
  order_meta_data = event_history.order_execute_selected_data
22
22
  tpm = order_meta_data[:tpm]
23
23
  autotrade_percent = order_meta_data[:autotrade_percent]
24
- order_color = order_meta_data[:color].to_sym
25
-
26
24
  order_plan_no = order_meta_data[:plan_no]
25
+
26
+ order_color = order_meta_data[:color].to_sym
27
27
  case order_color
28
28
  when :cyan, :red
29
29
  order_id = order_meta_data[:buy_order_id]
@@ -42,9 +42,9 @@ module Cryptum
42
42
  end
43
43
 
44
44
  if order_history_arr.empty? && order_color == :yellow
45
+ order_meta_data.delete(:sell_order_id)
45
46
  order_id = order_meta_data[:buy_order_id]
46
47
  order_meta_data[:color] = :cyan
47
- order_meta_data[:sell_order_id] = nil
48
48
  order_history_arr = event_history.order_book[:order_history].select do |order|
49
49
  order if order[:id] == order_id
50
50
  end
@@ -521,8 +521,6 @@ module Cryptum
521
521
 
522
522
  # Reset Order Ready Boolean
523
523
  event_history.order_ready = false
524
-
525
- event_history
526
524
  rescue Interrupt
527
525
  # Exit Gracefully if CTRL+C is Pressed During Session
528
526
  Cryptum.exit_gracefully(which_self: self)
@@ -24,6 +24,8 @@ module Cryptum
24
24
  ticker_price = event_history.order_book[:ticker_price].to_f
25
25
  return unless ticker_price.positive?
26
26
 
27
+ market_trend_color = plan_color = :white
28
+
27
29
  this_product = event_history.order_book[:this_product]
28
30
  symbol_out = this_product[:id]
29
31
  quote_increment = this_product[:quote_increment]
@@ -153,13 +155,16 @@ module Cryptum
153
155
  order_slice[:invest] = format('%0.2f', fiat_investing)
154
156
  order_slice[:return] = format('%0.2f', fiat_returning)
155
157
  order_slice[:profit] = format('%0.2f', profit)
158
+ order_slice[:tpm] = tpm
159
+ order_slice[:autotrade_percent] = autotrade_percent
160
+ order_slice[:color] = plan_color
156
161
 
157
162
  order_plan.push(order_slice) unless event_history.recalculate_order_plan
158
163
  fiat_budget -= fiat_investing
159
164
  plan_no_slice += 1
160
165
  end
161
166
  event_history.order_book[:order_plan] = order_plan
162
- event_history.recalculate_order_plan = false
167
+ # event_history.recalculate_order_plan = false
163
168
  end
164
169
 
165
170
  red_pill_alert = '| RED PILL ALERT |'
@@ -322,7 +327,6 @@ module Cryptum
322
327
  )
323
328
  end
324
329
  else
325
- market_trend_color = plan_color = :white
326
330
  market_trend_color = indicator_status.market_trend[:color] if indicator_status.market_trend
327
331
  plan_color = :cyan if market_trend_color == :red
328
332
  plan_color = :green if market_trend_color == :green
@@ -344,8 +348,6 @@ module Cryptum
344
348
  if event_history.order_plan_row_to_select == current_line
345
349
  style = :highlight
346
350
  selected_order = order
347
- selected_order[:tpm] = tpm
348
- selected_order[:autotrade_percent] = autotrade_percent
349
351
  selected_order[:color] = plan_color
350
352
  end
351
353
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptum
4
- VERSION = '0.0.276'
4
+ VERSION = '0.0.278'
5
5
  end
@@ -212,11 +212,12 @@ module Cryptum
212
212
  # Ready to Submit a BUY order
213
213
  event_history.order_ready = true
214
214
 
215
- # Reload Bot Conf (i.e. Risk Allocation)
215
+ # Reload Bot Conf (i.e. Risk Allocation),
216
+ # Recalculate Order Plan, and Write to File
216
217
  terminal_win.key_press_event.key_r = true
217
218
 
218
219
  # Write Order Book to Disk
219
- terminal_win.key_press_event.key_w = true
220
+ # terminal_win.key_press_event.key_w = true
220
221
  end
221
222
  end
222
223
 
@@ -227,11 +228,15 @@ module Cryptum
227
228
  event_history: event_history,
228
229
  bot_conf: bot_conf
229
230
  )
231
+
230
232
  # Reload Bot Conf (i.e. Risk Allocation)
233
+ # Recalculate Order Plan, and Write to File
231
234
  terminal_win.key_press_event.key_r = true
232
-
233
- # Write Order Book to Disk
234
- terminal_win.key_press_event.key_w = true
235
+ # IMPORTANT:
236
+ # Wait for Order Plan recalculation to occur
237
+ # once Cryptum::UI::OrderPlan is refreshed
238
+ # in Cryptum::Event _BEFORE_ writing the order
239
+ # book to file.
235
240
  end
236
241
  end
237
242
  rescue Faye::WebSocket::API::ErrorEvent,
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.276
4
+ version: 0.0.278
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.