cryptum 0.0.256 → 0.0.258

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: 2687c6be08b4b287a0f9ad8192708a0f862b526933614bcd440607fa667e6e06
4
- data.tar.gz: 00c9a699c865e8f91cdecafcc896e19a1481100c01e492c3bf53e15a22df9ee2
3
+ metadata.gz: 454825db36aecfdd354ab093bbc3f635fc48813e950bcc3a1b7792b8e1028646
4
+ data.tar.gz: 12d79a0af6469640bf933d3766a24c92d0986f2eebf352d9d8f87d48c6f833ef
5
5
  SHA512:
6
- metadata.gz: fd74b3c4bd968db4e24b1a3fae5802b86d356619909e0d32a45d9d246d38c81a1b91714b3691f3ff7a3d95e2d4fcd0b57bdb408bfb89030062e1c57379379b5c
7
- data.tar.gz: c2ec14727da1cfccc54afacb7760feb0062d640da5d7cc7e24189dcbad5c03c0e9aeacc339a619e53a192e236f43d98ddee672abc26349a20a2a630a48ae4a4d
6
+ metadata.gz: e08fb37dd973e62f0b068b66028a18c4cf1e9ecc8f212313fced489e685be3eb90fec26f5a29193686ff8c035fc870bfd1fecc7899c2f6be568407c0d68a5497
7
+ data.tar.gz: 3dd720c662229f86921f648e8adea5cf20ce10dfc2ce506413c6a1f26496133d333606a8cbc9364d868ad49d3f4d14a5a034bf6f63176b982779cfb763e89599
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-01 19:02:17 UTC using RuboCop version 1.39.0.
3
+ # on 2022-12-01 23:43:10 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
@@ -103,7 +103,7 @@ Layout/TrailingWhitespace:
103
103
  - 'lib/cryptum/ui/order_plan.rb'
104
104
  - 'lib/cryptum/ui/order_timer.rb'
105
105
 
106
- # Offense count: 51
106
+ # Offense count: 52
107
107
  Lint/UselessAssignment:
108
108
  Exclude:
109
109
  - 'bin/cryptum-forecast'
@@ -113,6 +113,7 @@ Lint/UselessAssignment:
113
113
  - 'lib/cryptum/event/buy.rb'
114
114
  - 'lib/cryptum/event/cancel.rb'
115
115
  - 'lib/cryptum/order_book/generate.rb'
116
+ - 'lib/cryptum/order_book/market_trend.rb'
116
117
  - 'lib/cryptum/ui/market_trend.rb'
117
118
  - 'lib/cryptum/ui/order_execution.rb'
118
119
  - 'lib/cryptum/ui/order_plan.rb'
@@ -123,13 +124,13 @@ Lint/UselessAssignment:
123
124
  # Offense count: 39
124
125
  # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
125
126
  Metrics/AbcSize:
126
- Max: 388
127
+ Max: 387
127
128
 
128
129
  # Offense count: 7
129
130
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
130
131
  # AllowedMethods: refine
131
132
  Metrics/BlockLength:
132
- Max: 135
133
+ Max: 141
133
134
 
134
135
  # Offense count: 4
135
136
  # Configuration parameters: CountBlocks.
@@ -207,12 +208,6 @@ Style/RedundantReturn:
207
208
  Exclude:
208
209
  - 'lib/cryptum.rb'
209
210
 
210
- # Offense count: 4
211
- # This cop supports safe autocorrection (--autocorrect).
212
- Style/RedundantSelf:
213
- Exclude:
214
- - 'lib/cryptum/event/history.rb'
215
-
216
211
  # Offense count: 1
217
212
  # This cop supports unsafe autocorrection (--autocorrect-all).
218
213
  Style/StringChars:
@@ -244,7 +239,7 @@ Style/TrailingCommaInArrayLiteral:
244
239
  Exclude:
245
240
  - 'lib/cryptum/matrix.rb'
246
241
 
247
- # Offense count: 16
242
+ # Offense count: 14
248
243
  # This cop supports safe autocorrection (--autocorrect).
249
244
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
250
245
  # URISchemes: http, https
@@ -18,7 +18,6 @@ module Cryptum
18
18
  :plan_no,
19
19
  :reconnected,
20
20
  :red_pill,
21
- :reset_market_trend,
22
21
  :start_time,
23
22
  :ticker_event,
24
23
  :time_between_orders,
@@ -49,22 +48,21 @@ module Cryptum
49
48
  self.start_time = start_time
50
49
  self.reconnected = false
51
50
  self.red_pill = false
52
- self.reset_market_trend = false
53
51
  self.order_plan_win_active = true
54
52
  self.order_plan_index_offset = 0
55
53
  self.order_plan_max_rows_to_display = 7
56
- self.order_plan_row_to_select = self.order_plan_index_offset
54
+ self.order_plan_row_to_select = order_plan_index_offset
57
55
  self.order_execute_win_active = false
58
56
  self.order_execute_index_offset = 0
59
57
  self.order_execute_max_rows_to_display = 6
60
- self.order_execute_row_to_select = self.order_execute_index_offset
58
+ self.order_execute_row_to_select = order_execute_index_offset
61
59
 
62
- # 10 minutes
60
+ # Default = 10 minutes
63
61
  self.time_between_orders = 600
64
- self.time_between_orders_reset = self.time_between_orders
62
+ self.time_between_orders_reset = time_between_orders
65
63
 
66
- # 24 hours
67
- self.time_between_orders_max = self.time_between_orders_reset * 144
64
+ # 1 hour
65
+ self.time_between_orders_max = 3_600
68
66
 
69
67
  # 5 seconds
70
68
  self.time_between_orders_min = 5
@@ -12,7 +12,8 @@ module Cryptum
12
12
  :repo_root,
13
13
  :sandbox,
14
14
  :symbol,
15
- :market_trend_reset
15
+ :market_trend_reset,
16
+ :market_trend_reset_label
16
17
 
17
18
  rescue Interrupt
18
19
  # Exit Gracefully if CTRL+C is Pressed During Session
@@ -95,6 +95,11 @@ module Cryptum
95
95
  reason = :market_trend_reset
96
96
  end
97
97
 
98
+ option_choice.market_trend_reset_label = option_choice.market_trend_reset
99
+ option_choice.market_trend_reset_label = 'D' if option_choice.market_trend_reset == 84_600
100
+ option_choice.market_trend_reset_label = '1h' if option_choice.market_trend_reset == 3_600
101
+ option_choice.market_trend_reset_label = '1m' if option_choice.market_trend_reset == 60
102
+
98
103
  if usage
99
104
  case reason
100
105
  when :symbol
@@ -14,15 +14,6 @@ module Cryptum
14
14
  event = opts[:event]
15
15
  indicator_status = opts[:indicator_status]
16
16
 
17
- # Decent for debugging.
18
- # puts event.inspect
19
-
20
- if event_history.reset_market_trend
21
- event_history.order_book[:market_trend][:buy] = 0
22
- event_history.order_book[:market_trend][:sell] = 0
23
- event_history.reset_market_trend = false
24
- end
25
-
26
17
  buy_or_sell = event[:changes].first[0].to_s.to_sym
27
18
  case buy_or_sell
28
19
  when :buy
@@ -134,17 +125,12 @@ module Cryptum
134
125
  )
135
126
  end
136
127
 
137
- # Reload Bot Conf (i.e. Risk Allocation)
138
- terminal_win.key_press_event.key_r = true
139
-
140
128
  # Reset Market Trend Counter
141
- event_history.reset_market_trend = true
129
+ event_history.order_book[:market_trend][:buy] = 0
130
+ event_history.order_book[:market_trend][:sell] = 0
142
131
  event_history.order_book[:last_trend_reset] = Time.now.strftime(
143
132
  '%Y-%m-%d %H:%M:%S.%N%z'
144
133
  )
145
-
146
- # Write Order Book to Disk
147
- terminal_win.key_press_event.key_w = true
148
134
  rescue StandardError => e
149
135
  raise e
150
136
  end
@@ -55,14 +55,10 @@ module Cryptum
55
55
  # Otherwise, intent should be something like, "- WAIT FOR MARKET TREND SHIFT -"
56
56
  intent = "- SEE LIMIT SELL ORDERS -"
57
57
  else
58
- trend = 'BEAR'
59
58
  speed = 'FAST'
60
- if event_history.bullish_trend
61
- trend = 'BULL'
62
- speed = 'SLOW'
63
- end
59
+ speed = 'SLOW' if event_history.bullish_trend
64
60
 
65
- intent = "#{trend} - #{speed} BUY: #{order_countdown} of #{time_between_order_exec_out}"
61
+ intent = "- #{speed} BUY: #{order_countdown} of #{time_between_order_exec_out} -"
66
62
  intent = '- BUYING PAUSED -' if event_history.red_pill
67
63
  end
68
64
 
@@ -18,7 +18,7 @@ module Cryptum
18
18
  quote_increment = this_product[:quote_increment]
19
19
  fiat_smallest_decimal = quote_increment.to_s.split('.')[-1].length
20
20
 
21
- symbol_out = "#{this_product[:id]}.#{option_choice.market_trend_reset}s"
21
+ symbol_out = "#{this_product[:id]}.#{option_choice.market_trend_reset_label}"
22
22
  fiat = this_product[:quote_currency].to_sym
23
23
  fiat_symbol = '?'
24
24
  fiat_symbol = '$' if fiat == :USD
@@ -98,14 +98,17 @@ module Cryptum
98
98
  )
99
99
  if margin_percent_open_24h.positive?
100
100
  margin_percent_open_24h_color = :green
101
- margin_percent_open_24h_out = "#{Cryptum.up_arrow} #{beautify_margin_percent_open_24h}%"
101
+ trend = 'BULL'
102
+ margin_percent_open_24h_out = "#{Cryptum.up_arrow} #{beautify_margin_percent_open_24h}% (#{trend})"
102
103
  elsif margin_percent_open_24h.negative?
103
104
  # Space removed to account for negative number.
104
105
  margin_percent_open_24h_color = :red
105
- margin_percent_open_24h_out = "#{Cryptum.down_arrow}#{beautify_margin_percent_open_24h}%"
106
+ trend = 'BEAR'
107
+ margin_percent_open_24h_out = "#{Cryptum.down_arrow}#{beautify_margin_percent_open_24h}% (#{trend})"
106
108
  else
109
+ trend = 'FLAT'
107
110
  margin_percent_open_24h_color = :yellow
108
- margin_percent_open_24h_out = "#{Cryptum.flat_arrow} #{beautify_margin_percent_open_24h}%"
111
+ margin_percent_open_24h_out = "#{Cryptum.flat_arrow} #{beautify_margin_percent_open_24h}% (#{trend})"
109
112
  end
110
113
 
111
114
  current_time_out = Time.now.strftime('%Y-%m-%d %H:%M:%S%z')
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptum
4
- VERSION = '0.0.256'
4
+ VERSION = '0.0.258'
5
5
  end
@@ -197,8 +197,18 @@ module Cryptum
197
197
  key_press_event: terminal_win.key_press_event
198
198
  )
199
199
 
200
- event_history.order_ready = true if order_countdown.zero? ||
201
- order_countdown.negative?
200
+ if order_countdown.zero? ||
201
+ order_countdown.negative?
202
+
203
+ # Ready to Submit a BUY order
204
+ event_history.order_ready = true
205
+
206
+ # Reload Bot Conf (i.e. Risk Allocation)
207
+ terminal_win.key_press_event.key_r = true
208
+
209
+ # Write Order Book to Disk
210
+ terminal_win.key_press_event.key_w = true
211
+ end
202
212
  end
203
213
 
204
214
  EM.add_periodic_timer(option_choice.market_trend_reset) do
@@ -208,6 +218,11 @@ module Cryptum
208
218
  event_history: event_history,
209
219
  bot_conf: bot_conf
210
220
  )
221
+ # Reload Bot Conf (i.e. Risk Allocation)
222
+ terminal_win.key_press_event.key_r = true
223
+
224
+ # Write Order Book to Disk
225
+ terminal_win.key_press_event.key_w = true
211
226
  end
212
227
  end
213
228
  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.256
4
+ version: 0.0.258
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.