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 +4 -4
- data/README.md +2 -2
- data/bin/cryptum +3 -3
- data/lib/cryptum/log.rb +16 -8
- data/lib/cryptum/ui/exit.rb +3 -0
- data/lib/cryptum/ui.rb +6 -1
- data/lib/cryptum/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d3009461c0a539d8bdd7ca40e6223558e174880f62cd66ff7ad4a0c14ee932b
|
4
|
+
data.tar.gz: 56780f30a968d75a4db3ec5aecb7b0e664f3595f8f06f5a876e78a83a6ed230d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
-
|
56
|
+
log_event += ' => CTRL+C Detected...Exiting Session.'
|
51
57
|
else
|
52
|
-
|
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
|
data/lib/cryptum/ui/exit.rb
CHANGED
@@ -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
|
|
data/lib/cryptum/version.rb
CHANGED