cryptum 0.0.387 → 0.0.389
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +2 -2
 - data/bin/cryptum +3 -5
 - data/lib/cryptum/event/history.rb +1 -2
 - data/lib/cryptum/log.rb +16 -8
 - data/lib/cryptum/order_book/generate.rb +0 -2
 - 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
    
    | 
         @@ -4,7 +4,6 @@ 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            require 'cryptum'
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
            start_time = Time.now.strftime('%Y-%m-%d %H:%M:%S%z')
         
     | 
| 
       8 
7 
     | 
    
         
             
            # Initialize Driver Name & Parse cryptum Flags
         
     | 
| 
       9 
8 
     | 
    
         
             
            driver_name = File.basename($PROGRAM_NAME)
         
     | 
| 
       10 
9 
     | 
    
         
             
            option_choice = Cryptum::Option::Parser.get(driver_name: driver_name)
         
     | 
| 
         @@ -23,17 +22,16 @@ end 
     | 
|
| 
       23 
22 
     | 
    
         
             
            # Instantiate Our Status Indicators & History Objects
         
     | 
| 
       24 
23 
     | 
    
         
             
            indicator_status = Cryptum::OrderBook::Indicator.new
         
     | 
| 
       25 
24 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
            # Initialize Curses UI
         
     | 
| 
       27 
     | 
    
         
            -
            terminal_win = Cryptum::UI.init
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
25 
     | 
    
         
             
            # Generate an Order Book for Session Tracking
         
     | 
| 
       30 
26 
     | 
    
         
             
            # Load previous order_book_justification from
         
     | 
| 
       31 
27 
     | 
    
         
             
            # Order Book File (if it exists)
         
     | 
| 
       32 
28 
     | 
    
         
             
            event_history = Cryptum::OrderBook::Generate.new(
         
     | 
| 
       33 
     | 
    
         
            -
              start_time: start_time,
         
     | 
| 
       34 
29 
     | 
    
         
             
              option_choice: option_choice,
         
     | 
| 
       35 
30 
     | 
    
         
             
              env: env
         
     | 
| 
       36 
31 
     | 
    
         
             
            )
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            # Initialize Curses UI
         
     | 
| 
      
 34 
     | 
    
         
            +
            terminal_win = Cryptum::UI.init(event_history: event_history)
         
     | 
| 
       37 
35 
     | 
    
         
             
            terminal_win.key_press_event.key_w = true if option_choice.reset_session_countdown
         
     | 
| 
       38 
36 
     | 
    
         | 
| 
       39 
37 
     | 
    
         
             
            # Automatically Create Bot Confs if they don't
         
     | 
| 
         @@ -45,7 +45,6 @@ module Cryptum 
     | 
|
| 
       45 
45 
     | 
    
         | 
| 
       46 
46 
     | 
    
         
             
                  def initialize(opts = {})
         
     | 
| 
       47 
47 
     | 
    
         
             
                    option_choice = opts[:option_choice]
         
     | 
| 
       48 
     | 
    
         
            -
                    start_time = opts[:start_time]
         
     | 
| 
       49 
48 
     | 
    
         
             
                    order_book = opts[:order_book]
         
     | 
| 
       50 
49 
     | 
    
         | 
| 
       51 
50 
     | 
    
         
             
                    self.bullish_trend = true
         
     | 
| 
         @@ -75,7 +74,7 @@ module Cryptum 
     | 
|
| 
       75 
74 
     | 
    
         
             
                    self.reconnected = false
         
     | 
| 
       76 
75 
     | 
    
         
             
                    self.red_pill = false
         
     | 
| 
       77 
76 
     | 
    
         
             
                    self.recalculate_order_plan = false
         
     | 
| 
       78 
     | 
    
         
            -
                    self.start_time =  
     | 
| 
      
 77 
     | 
    
         
            +
                    self.start_time = Time.now.strftime('%Y-%m-%d %H:%M:%S%z')
         
     | 
| 
       79 
78 
     | 
    
         | 
| 
       80 
79 
     | 
    
         
             
                    # -------------------------------------------------- #
         
     | 
| 
       81 
80 
     | 
    
         
             
                    # SAUCE 3 (SAUCE 4 RELATES TO SAUCE 3)
         
     | 
    
        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
         
     | 
| 
         @@ -11,7 +11,6 @@ module Cryptum 
     | 
|
| 
       11 
11 
     | 
    
         
             
                  # )
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
                  public_class_method def self.new(opts = {})
         
     | 
| 
       14 
     | 
    
         
            -
                    start_time = opts[:start_time]
         
     | 
| 
       15 
14 
     | 
    
         
             
                    option_choice = opts[:option_choice]
         
     | 
| 
       16 
15 
     | 
    
         
             
                    env = opts[:env]
         
     | 
| 
       17 
16 
     | 
    
         | 
| 
         @@ -65,7 +64,6 @@ module Cryptum 
     | 
|
| 
       65 
64 
     | 
    
         
             
                    # are Parsed.
         
     | 
| 
       66 
65 
     | 
    
         
             
                    event_history = Cryptum::Event::History.new(
         
     | 
| 
       67 
66 
     | 
    
         
             
                      option_choice: option_choice,
         
     | 
| 
       68 
     | 
    
         
            -
                      start_time: start_time,
         
     | 
| 
       69 
67 
     | 
    
         
             
                      order_book: order_book
         
     | 
| 
       70 
68 
     | 
    
         
             
                    )
         
     | 
| 
       71 
69 
     | 
    
         | 
    
        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