cryptum 0.0.257 → 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: 700e1a1a2785e98e2ba35546de12c8920716951d891439f37ddb67d44d11ac45
4
- data.tar.gz: e0ba8ec4ce2dea089fe9e58aafc93258d02593029875636e20c0edee0f7a068d
3
+ metadata.gz: 454825db36aecfdd354ab093bbc3f635fc48813e950bcc3a1b7792b8e1028646
4
+ data.tar.gz: 12d79a0af6469640bf933d3766a24c92d0986f2eebf352d9d8f87d48c6f833ef
5
5
  SHA512:
6
- metadata.gz: 81f138f0d93da609436879479b61fb59750b2b6c013a921df87de1bbb566bb86e0a38f37067ecc3e8d4409c43db3102596afe17910b3770dcadaad8d0c66c04c
7
- data.tar.gz: a94ad89f104b2dab9d0cef42de733b0211271e9ef5bed7788949e203b3f44d85e859dd40c4598befb341bed192f336f8f50c4376f654f238ea9195545d3fcb45
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,19 +48,18 @@ 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
64
  # 1 hour
67
65
  self.time_between_orders_max = 3_600
@@ -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
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptum
4
- VERSION = '0.0.257'
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.257
4
+ version: 0.0.258
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.