cryptum 0.0.388 → 0.0.389

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: a96ddf613cdc94e4883151dd4f6a79e409a0c3fe6b39d8ffc7b8518d3e29215c
4
- data.tar.gz: b899801924f9c55990902dbd9977a1b42876d4bc241b6736532d285bc9f078ee
3
+ metadata.gz: 0d3009461c0a539d8bdd7ca40e6223558e174880f62cd66ff7ad4a0c14ee932b
4
+ data.tar.gz: 56780f30a968d75a4db3ec5aecb7b0e664f3595f8f06f5a876e78a83a6ed230d
5
5
  SHA512:
6
- metadata.gz: 7809bad411a8b2ff88376b9dde60351a922f8d1668531a1703b3bd7889b6117767e9beafc501b4bd90ba36ba2f5a959c43578f2b253e4a7a3eeb7df9e9c60b61
7
- data.tar.gz: e33718bd1a1a52e925e7930d66ce0bfd19ada6510a06a143ef142fe641b2430170a953994a9cf716f35c4bacdbafcaeef34b82126e0eedff1c9fdd398441f64f
6
+ metadata.gz: d2cb84edbd025ea4c5b0bc3cc4e394bba84b90055c590a12e0a0415e56b8f1f7ea7eabab6eff34e7499d5432c65875f0691f54f5d2fed97d74ab8b745e5fb622
7
+ data.tar.gz: 967f8c3f94a945f267d5e3802980aa2a00a05ca0b84d6503c8759be8b5852d7ed8854322c9e215452e7ae93efd1958183f6acb89a143b68371bd34e7bc3fc386
data/README.md CHANGED
@@ -108,9 +108,9 @@ If you choose a lower value than the default, the target profit margin's (i.e. T
108
108
 
109
109
  Another option (particularly useful with smaller balances) is bumping the market trend reset to 604800 (i.e. 1 week) which will immediately increase the TPM %'s. The downside to this approach is trading volume is reduced, resulting in higher maker & taker fee tiers (i.e. higher cost / trade).
110
110
 
111
- From an logging perspective, they can be monitored via:
111
+ From a monitoring perspective, logs can be monitored via:
112
112
  ```
113
- tail -f /tmp/cryptum.log
113
+ $ tail -f /tmp/cryptum.log
114
114
  ```
115
115
 
116
116
  ### **Contributing** ###
data/bin/cryptum CHANGED
@@ -22,9 +22,6 @@ end
22
22
  # Instantiate Our Status Indicators & History Objects
23
23
  indicator_status = Cryptum::OrderBook::Indicator.new
24
24
 
25
- # Initialize Curses UI
26
- terminal_win = Cryptum::UI.init
27
-
28
25
  # Generate an Order Book for Session Tracking
29
26
  # Load previous order_book_justification from
30
27
  # Order Book File (if it exists)
@@ -32,6 +29,9 @@ event_history = Cryptum::OrderBook::Generate.new(
32
29
  option_choice: option_choice,
33
30
  env: env
34
31
  )
32
+
33
+ # Initialize Curses UI
34
+ terminal_win = Cryptum::UI.init(event_history: event_history)
35
35
  terminal_win.key_press_event.key_w = true if option_choice.reset_session_countdown
36
36
 
37
37
  # Automatically Create Bot Confs if they don't
data/lib/cryptum/log.rb CHANGED
@@ -7,27 +7,31 @@ module Cryptum
7
7
  # Cryptum::Log.create(
8
8
  # )
9
9
  public_class_method def self.append(opts = {})
10
+ level = opts[:level].to_s.downcase.to_sym
11
+ msg = opts[:msg]
12
+ which_self = opts[:which_self].to_s
13
+ event_history = opts[:event_history]
14
+
15
+ # Always append to log file
16
+ log_file = File.open('/tmp/cryptum.log', 'a')
17
+
10
18
  # Leave 10 "old" log files where
11
19
  # each file is ~ 1,024,000 bytes
12
- log_file = File.open('/tmp/cryptum.log', 'a')
13
20
  logger = Logger.new(
14
21
  log_file,
15
22
  10,
16
23
  1_024_000
17
24
  )
18
- level = opts[:level].to_s.downcase.to_sym
19
- msg = opts[:msg]
20
- which_self = opts[:which_self].to_s
21
- event_history = opts[:event_history]
22
25
 
26
+ # Only attempt to exit gracefully if level == :error
23
27
  exit_gracefully = false
24
28
 
25
29
  case level
26
30
  when :debug
27
31
  logger.level = Logger::DEBUG
28
32
  when :error
29
- logger.level = Logger::ERROR
30
33
  exit_gracefully = true
34
+ logger.level = Logger::ERROR
31
35
  when :fatal
32
36
  # This is reserved for:
33
37
  # Cryptum::UI::Exit
@@ -46,12 +50,16 @@ module Cryptum
46
50
  end
47
51
 
48
52
  logger.datetime_format = '%Y-%m-%d %H:%M:%S.%N'
53
+ log_event = ''
54
+ log_event = event_history.order_book[:path] if event_history.respond_to?('order_book')
49
55
  if msg.instance_of?(Interrupt)
50
- logger.add(logger.level, 'CTRL+C Detected...Ended Session.', which_self)
56
+ log_event += ' => CTRL+C Detected...Exiting Session.'
51
57
  else
52
- logger.add(logger.level, msg, which_self)
58
+ log_event += " => #{msg}"
53
59
  end
54
60
 
61
+ logger.add(logger.level, log_event, which_self)
62
+
55
63
  Cryptum::UI::Exit.gracefully(event_history: event_history) if exit_gracefully
56
64
  rescue Interrupt, StandardError => e
57
65
  raise e
@@ -8,6 +8,9 @@ module Cryptum
8
8
  event_history = opts[:event_history]
9
9
 
10
10
  Curses.close_screen
11
+ msg = event_history.order_book[:path] if event_history.respond_to?('order_book')
12
+ msg += ' => Session Gracefully Terminated.'
13
+ Cryptum::Log.append(level: :info, msg: msg, which_self: self)
11
14
 
12
15
  exit 0
13
16
  rescue Interrupt, StandardError => e
data/lib/cryptum/ui.rb CHANGED
@@ -16,7 +16,12 @@ module Cryptum
16
16
  require 'cryptum/ui/ticker'
17
17
 
18
18
  # Initialize the UI
19
- public_class_method def self.init
19
+ public_class_method def self.init(opts = {})
20
+ event_history = opts[:event_history]
21
+ msg = event_history.order_book[:path] if event_history.respond_to?('order_book')
22
+ msg += ' => Session Started.'
23
+ Cryptum::Log.append(level: :info, msg: msg, which_self: self)
24
+
20
25
  # Initialize curses Screen
21
26
  Curses.init_screen
22
27
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptum
4
- VERSION = '0.0.388'
4
+ VERSION = '0.0.389'
5
5
  end
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.388
4
+ version: 0.0.389
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.