bin/cryptum in cryptum-0.0.386 vs bin/cryptum in cryptum-0.0.387
- old
+ new
@@ -2,76 +2,59 @@
# frozen_string_literal: true
require 'cryptum'
-begin
- start_time = Time.now.strftime('%Y-%m-%d %H:%M:%S%z')
- # Initialize Driver Name & Parse cryptum Flags
- driver_name = File.basename($PROGRAM_NAME)
- option_choice = Cryptum::Option::Parser.get(driver_name: driver_name)
+start_time = Time.now.strftime('%Y-%m-%d %H:%M:%S%z')
+# Initialize Driver Name & Parse cryptum Flags
+driver_name = File.basename($PROGRAM_NAME)
+option_choice = Cryptum::Option::Parser.get(driver_name: driver_name)
- # Initialize the Respective Environment / API Authentication Artifacts
- env = Cryptum::Option::Environment.get(option_choice: option_choice)
+# Initialize the Respective Environment / API Authentication Artifacts
+env = Cryptum::Option::Environment.get(option_choice: option_choice)
- # Dump out supported products if --list-products flag is passed and exit
- if option_choice.list_products
- Cryptum::API::Products.list_and_exit(
- option_choice: option_choice,
- env: env
- )
- end
-
- # Instantiate Our Status Indicators & History Objects
- indicator_status = Cryptum::OrderBook::Indicator.new
-
- # Initialize Curses UI
- terminal_win = Cryptum::UI.init
-
- # Generate an Order Book for Session Tracking
- # Load previous order_book_justification from
- # Order Book File (if it exists)
- event_history = Cryptum::OrderBook::Generate.new(
- start_time: start_time,
+# Dump out supported products if --list-products flag is passed and exit
+if option_choice.list_products
+ Cryptum::API::Products.list_and_exit(
option_choice: option_choice,
env: env
)
- terminal_win.key_press_event.key_w = true if option_choice.reset_session_countdown
+end
- # Automatically Create Bot Confs if they don't
- # Exist and Initialize Automated Trading Parameters
- bot_conf = Cryptum::BotConf.read(
- option_choice: option_choice,
- event_history: event_history
- )
+# Instantiate Our Status Indicators & History Objects
+indicator_status = Cryptum::OrderBook::Indicator.new
- # Connect to WebSocket
- # Trigger Events as Event Data
- # Generated via Coinbase Pro
- # Web Socket HTTP Responses
- # Refresh UI with Event Data
- # Update "Status Indicators"
- # Leverage "Status Indicators" to Initiate Actions
- Cryptum::WebSock::EventMachine.run(
- option_choice: option_choice,
- env: env,
- terminal_win: terminal_win,
- event_history: event_history,
- indicator_status: indicator_status,
- bot_conf: bot_conf
- )
-rescue Interrupt
- # Exit Gracefully if CTRL+C is Pressed During Session
- puts 'CTRL+C Detected...Good Bye.'
- Cryptum::UI::Exit.gracefully(event_history: event_history)
-rescue StandardError => e
- # Produce a Stacktrace for anything else
- Curses.close_screen
- raise e
- # TODO: everything should be returned to this
- # single ensure block for exiting gracefully,
- # however, that means event_history will need
- # to be returned back to this driver prior to
- # exit.
- # ensure
- # Cryptum::UI::Exit.gracefully(event_history: event_history)
-end
+# Initialize Curses UI
+terminal_win = Cryptum::UI.init
+
+# Generate an Order Book for Session Tracking
+# Load previous order_book_justification from
+# Order Book File (if it exists)
+event_history = Cryptum::OrderBook::Generate.new(
+ start_time: start_time,
+ option_choice: option_choice,
+ env: env
+)
+terminal_win.key_press_event.key_w = true if option_choice.reset_session_countdown
+
+# Automatically Create Bot Confs if they don't
+# Exist and Initialize Automated Trading Parameters
+bot_conf = Cryptum::BotConf.read(
+ option_choice: option_choice,
+ event_history: event_history
+)
+
+# Connect to WebSocket
+# Trigger Events as Event Data
+# Generated via Coinbase Pro
+# Web Socket HTTP Responses
+# Refresh UI with Event Data
+# Update "Status Indicators"
+# Leverage "Status Indicators" to Initiate Actions
+Cryptum::WebSock::EventMachine.run(
+ option_choice: option_choice,
+ env: env,
+ terminal_win: terminal_win,
+ event_history: event_history,
+ indicator_status: indicator_status,
+ bot_conf: bot_conf
+)