cryptum 0.0.397 → 0.0.399
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -17
- data/.rubocop_todo.yml +0 -22
- data/lib/cryptum/api/orders.rb +3 -2
- data/lib/cryptum/event/bot_conf.rb +2 -1
- data/lib/cryptum/event/buy.rb +2 -3
- data/lib/cryptum/event/cancel.rb +2 -1
- data/lib/cryptum/event/exit.rb +2 -1
- data/lib/cryptum/event/gtfo.rb +2 -1
- data/lib/cryptum/event/history.rb +2 -2
- data/lib/cryptum/event/key_press.rb +2 -1
- data/lib/cryptum/event/order_book.rb +3 -2
- data/lib/cryptum/event/pane.rb +7 -12
- data/lib/cryptum/event/parse.rb +2 -1
- data/lib/cryptum/event/scroll.rb +3 -3
- data/lib/cryptum/event/sell.rb +2 -3
- data/lib/cryptum/log.rb +1 -1
- data/lib/cryptum/order_book/generate.rb +2 -1
- data/lib/cryptum/order_book/indicator.rb +2 -3
- data/lib/cryptum/order_book/market_trend.rb +2 -2
- data/lib/cryptum/order_book/profit_margin.rb +5 -5
- data/lib/cryptum/portfolio/balance.rb +1 -0
- data/lib/cryptum/ui/command.rb +3 -1
- data/lib/cryptum/ui/exit.rb +7 -1
- data/lib/cryptum/ui/key_press_event.rb +2 -0
- data/lib/cryptum/ui/market_trend.rb +3 -2
- data/lib/cryptum/ui/matrix.rb +2 -1
- data/lib/cryptum/ui/order/execute.rb +4 -3
- data/lib/cryptum/ui/order/execute_details.rb +23 -21
- data/lib/cryptum/ui/order/plan.rb +4 -2
- data/lib/cryptum/ui/order/plan_details.rb +4 -2
- data/lib/cryptum/ui/order/timer.rb +4 -4
- data/lib/cryptum/ui/order.rb +1 -0
- data/lib/cryptum/ui/portfolio.rb +3 -1
- data/lib/cryptum/ui/signal_engine.rb +3 -1
- data/lib/cryptum/ui/terminal_window.rb +2 -0
- data/lib/cryptum/ui/ticker.rb +3 -4
- data/lib/cryptum/ui.rb +4 -6
- 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: f571b7426e0de56f7674b3735c661cf48516c4b0b90079c68e0282e67a10c0e2
|
4
|
+
data.tar.gz: 6a2ae463a62d3f5422031af86133d71d55b046c9e5f1408c40fe7daaa31c2d71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9c95206532fc6b6cd7f8ff1f0f76433999e51bad199f040d837fb99313d16d36534cdd6cde3f4b55eaaa909caf0e0ddb0ac829a6ff03ebc00ce79ea6ad02df6
|
7
|
+
data.tar.gz: 6ed967babd35a1fe97703aadc70a0262c5c780f04d719ac44d299fc08abdaa27b705d522d8526e80d3b4e30343c72e5c5d9d7e2e2e38fa978da75d6b51cf25bf
|
data/.rubocop.yml
CHANGED
@@ -1,35 +1,27 @@
|
|
1
1
|
AllCops:
|
2
2
|
UseCache: false
|
3
3
|
NewCops: enable
|
4
|
-
Layout:
|
5
|
-
Max: 3000
|
6
4
|
Layout/LineLength:
|
7
|
-
Max:
|
5
|
+
Max: 250
|
8
6
|
Lint/UselessRescue:
|
9
7
|
Enabled: false
|
10
8
|
Metrics/AbcSize:
|
11
|
-
Max:
|
9
|
+
Max: 393
|
12
10
|
Metrics/BlockLength:
|
13
|
-
Max:
|
11
|
+
Max: 138
|
14
12
|
Metrics/BlockNesting:
|
15
|
-
Max:
|
13
|
+
Max: 3
|
16
14
|
Metrics/ClassLength:
|
17
|
-
Max: 512
|
18
|
-
Metrics/CyclomaticComplexity:
|
19
15
|
Max: 128
|
16
|
+
Metrics/CyclomaticComplexity:
|
17
|
+
Max: 75
|
20
18
|
Metrics/MethodLength:
|
21
|
-
Max:
|
19
|
+
Max: 397
|
22
20
|
Metrics/ModuleLength:
|
23
|
-
Max:
|
21
|
+
Max: 407
|
24
22
|
Metrics/PerceivedComplexity:
|
25
|
-
Max:
|
26
|
-
Style/HashEachMethods:
|
27
|
-
Enabled: true
|
23
|
+
Max: 75
|
28
24
|
Style/HashSyntax:
|
29
25
|
EnforcedShorthandSyntax: never
|
30
|
-
Style/HashTransformKeys:
|
31
|
-
Enabled: true
|
32
|
-
Style/HashTransformValues:
|
33
|
-
Enabled: true
|
34
26
|
|
35
27
|
inherit_from: .rubocop_todo.yml
|
data/.rubocop_todo.yml
CHANGED
@@ -1,22 +0,0 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on 2023-04-03 22:26:52 UTC using RuboCop version 1.49.0.
|
4
|
-
# The point is for the user to remove these configuration records
|
5
|
-
# one by one as the offenses are removed from the code base.
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
8
|
-
|
9
|
-
# Offense count: 5
|
10
|
-
# This cop supports safe autocorrection (--autocorrect).
|
11
|
-
# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
|
12
|
-
# SupportedStyles: assign_to_condition, assign_inside_condition
|
13
|
-
Style/ConditionalAssignment:
|
14
|
-
Exclude:
|
15
|
-
- 'lib/cryptum/event/pane.rb'
|
16
|
-
- 'lib/cryptum/log.rb'
|
17
|
-
- 'lib/cryptum/ui/order/execute_details.rb'
|
18
|
-
|
19
|
-
# Offense count: 28
|
20
|
-
# Configuration parameters: AllowedConstants.
|
21
|
-
Style/Documentation:
|
22
|
-
Enabled: false
|
data/lib/cryptum/api/orders.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
4
|
+
# Cryptum::API Namespace
|
5
5
|
module API
|
6
|
+
# This Module is used to interact with the Order APIs
|
6
7
|
module Orders
|
7
8
|
public_class_method def self.submit_limit(opts = {})
|
8
9
|
option_choice = opts[:option_choice]
|
@@ -158,7 +159,7 @@ module Cryptum
|
|
158
159
|
crypto_smallest_decimal = base_increment.to_s.split('.')[-1].length
|
159
160
|
fiat_smallest_decimal = quote_increment.to_s.split('.')[-1].length
|
160
161
|
|
161
|
-
#
|
162
|
+
# Calculate / Price / Size
|
162
163
|
last_three_prices_arr = []
|
163
164
|
last_ticker_price = event_history.order_book[:ticker_price].to_f
|
164
165
|
second_to_last_ticker_price = event_history.order_book[:ticker_price_second_to_last].to_f
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
4
|
+
# Cryptum::Event Namespace
|
5
5
|
module Event
|
6
|
+
# This Module is used to Reload the Bot Conf When the "r" Key is Pressed
|
6
7
|
module BotConf
|
7
8
|
# Supported Method Parameters::
|
8
9
|
# Cryptum::Event::BotConf.reload(
|
data/lib/cryptum/event/buy.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
5
|
-
# to Buy Crypto Currency
|
6
|
-
|
4
|
+
# Cryptum::Event Namespace
|
7
5
|
module Event
|
6
|
+
# This Module is used to Submit Limit Buy Orders
|
8
7
|
module Buy
|
9
8
|
# Supported Method Parameters::
|
10
9
|
# Cryptum::Event::Buy.crypto(
|
data/lib/cryptum/event/cancel.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
4
|
+
# Cryptum::Event Namespace
|
5
5
|
module Event
|
6
|
+
# This Module is used to Cancel Open Orders When the "C" Key is Pressed
|
6
7
|
module Cancel
|
7
8
|
# Supported Method Parameters::
|
8
9
|
# Cryptum::Event::Cancel.open_orders(
|
data/lib/cryptum/event/exit.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
4
|
+
# Cryptum::Event Namespace
|
5
5
|
module Event
|
6
|
+
# This Module is used to Exit Cryptum Gracefully When the "x" Key is Pressed
|
6
7
|
module Exit
|
7
8
|
# Supported Method Parameters::
|
8
9
|
# Cryptum::Event::Exit.gracefully(
|
data/lib/cryptum/event/gtfo.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
4
|
+
# Cryptum::Event Namespace
|
5
5
|
module Event
|
6
|
+
# This Modules is used to Get the F* Out (GTFO) when the "G" Key is Pressed
|
6
7
|
module GTFO
|
7
8
|
# Supported Method Parameters::
|
8
9
|
# Cryptum::Event::GTFO.now(
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
4
|
+
# Cryptum::Event Namespace
|
5
5
|
module Event
|
6
|
-
# Keep
|
6
|
+
# Class to Keep Track of Event History
|
7
7
|
class History
|
8
8
|
attr_accessor :bullish_trend,
|
9
9
|
:event,
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
4
|
+
# Cryptum::Event Namespace
|
5
5
|
module Event
|
6
|
+
# This Module is used to Detect when Keys are Pressed on the Keyboard
|
6
7
|
module KeyPress
|
7
8
|
# Supported Method Parameters::
|
8
9
|
# Cryptum::Event::KeyPress.detect(
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
5
|
-
# to File When the "w" Key is Pressed
|
4
|
+
# Cryptum::Event Namespace
|
6
5
|
module Event
|
6
|
+
# This Module is used to Write the Order Book from Memory
|
7
|
+
# to File When the "w" Key is Pressed
|
7
8
|
module OrderBook
|
8
9
|
# Supported Method Parameters::
|
9
10
|
# Cryptum::Event::OrderBook.write(
|
data/lib/cryptum/event/pane.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
5
|
-
# Window Panes when the TAB Key is Pressed.
|
4
|
+
# Cryptum::Event Namespace
|
6
5
|
module Event
|
6
|
+
# This Module is used to Switch through Order Plan / Order History
|
7
|
+
# Window Panes when the TAB Key is Pressed.
|
7
8
|
module Pane
|
8
9
|
# Supported Method Parameters::
|
9
10
|
# Cryptum::Event::Pane.switch(
|
@@ -36,18 +37,12 @@ module Cryptum
|
|
36
37
|
|
37
38
|
if event_history.order_plan_win_active
|
38
39
|
unless event_history.red_pill
|
39
|
-
|
40
|
-
|
41
|
-
else
|
42
|
-
event_history.order_plan_details_win_active = true
|
43
|
-
end
|
40
|
+
event_history.order_plan_details_win_active = true
|
41
|
+
event_history.order_plan_details_win_active = false if event_history.order_plan_details_win_active
|
44
42
|
end
|
45
43
|
elsif event_history.order_execute_win_active
|
46
|
-
|
47
|
-
|
48
|
-
else
|
49
|
-
event_history.order_execute_details_win_active = true
|
50
|
-
end
|
44
|
+
event_history.order_execute_details_win_active = true
|
45
|
+
event_history.order_execute_details_win_active = false if event_history.order_execute_details_win_active
|
51
46
|
end
|
52
47
|
rescue Interrupt, StandardError => e
|
53
48
|
Cryptum::Log.append(level: :error, msg: e, which_self: self, event_history: event_history)
|
data/lib/cryptum/event/parse.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
4
|
+
# Cryptum::Event Namespace
|
5
5
|
module Event
|
6
|
+
# This Module is used to parse message received by the Web Socket
|
6
7
|
module Parse
|
7
8
|
# Supported Method Parameters::
|
8
9
|
# Cryptum::Event::Parse.websocket_msg(
|
data/lib/cryptum/event/scroll.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
5
|
-
# Order Plan and Order History Window Panes
|
6
|
-
# to File When the "w" Key is Pressed
|
4
|
+
# Cryptum::Event Namespace
|
7
5
|
module Event
|
6
|
+
# This Module is used to Scroll through
|
7
|
+
# Order Plan and Order History Window Panes
|
8
8
|
module Scroll
|
9
9
|
# Supported Method Parameters::
|
10
10
|
# Cryptum::Event::Scroll.up(
|
data/lib/cryptum/event/sell.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
5
|
-
# to Sell Crypto Currency
|
6
|
-
|
4
|
+
# Crytpum::Event Namespace
|
7
5
|
module Event
|
6
|
+
# This Module is used to Submit Limit Sell Orders
|
8
7
|
module Sell
|
9
8
|
# Supported Method Parameters::
|
10
9
|
# Cryptum::Event::Sell.crypto(
|
data/lib/cryptum/log.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
4
|
+
# Cryptum::OrderBook Namespace
|
5
5
|
module OrderBook
|
6
|
+
# Load in Existing Order Book from File or Generate a New Order Book
|
6
7
|
module Generate
|
7
8
|
# Supported Method Parameters::
|
8
9
|
# Cryptum::OrderBook::Generate.new(
|
@@ -1,10 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
5
|
-
# Price of a Symbol over time.
|
6
|
-
|
4
|
+
# Cryptum::OrderBook Namespace
|
7
5
|
module OrderBook
|
6
|
+
# This class is used to track market indicators to drive decision making.
|
8
7
|
class Indicator
|
9
8
|
attr_accessor :market_trend,
|
10
9
|
:profit_margin,
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
5
|
-
|
4
|
+
# Cryptum::OrderBook Namespace
|
6
5
|
module OrderBook
|
6
|
+
# This Module is used for Market Trend Analysis
|
7
7
|
module MarketTrend
|
8
8
|
# Supported Method Parameters::
|
9
9
|
# Cryptum::OrderBook::OrderTrend.status(
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
5
|
-
# Projected Profit Margin is greater than
|
6
|
-
# the Target Profit Margin Outlined in the
|
7
|
-
# Respective Bot Conf
|
8
|
-
|
4
|
+
# Cryptum::OrderBook Namespace
|
9
5
|
module OrderBook
|
6
|
+
# This module is used to indicate if the
|
7
|
+
# Projected Profit Margin is greater than
|
8
|
+
# the Target Profit Margin Outlined in the
|
9
|
+
# Respective Bot Conf
|
10
10
|
module ProfitMargin
|
11
11
|
# Supported Method Parameters::
|
12
12
|
# Cryptum::OrderBook::ProfitMargin.status(
|
data/lib/cryptum/ui/command.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
+
# Cryptum::UI Module used for Presenting the
|
5
|
+
# Cryptum Curses Interface
|
4
6
|
module UI
|
5
|
-
#
|
7
|
+
# Update the Cryptum Command Section UI
|
6
8
|
module Command
|
7
9
|
# Supported Method Parameters::
|
8
10
|
# Cryptum::UI::Command.refresh(
|
data/lib/cryptum/ui/exit.rb
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
+
# Cryptum::UI Module used for Presenting the
|
5
|
+
# Cryptum Curses Interface
|
4
6
|
module UI
|
5
|
-
#
|
7
|
+
# Gracefully Exit the UI and Attempt to Save event_history to Order Book Session File.
|
6
8
|
module Exit
|
9
|
+
# Supported Method Parameters::
|
10
|
+
# Cryptum::UI::Exit.gracefully(
|
11
|
+
# event_history: 'optional - Pass in the event_history if available to save to order book'
|
12
|
+
# )
|
7
13
|
public_class_method def self.gracefully(opts = {})
|
8
14
|
event_history = opts[:event_history]
|
9
15
|
|
@@ -1,15 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
4
|
+
# Cryptum::UI Module used for Presenting the
|
5
|
+
# Cryptum Curses Interface
|
5
6
|
module UI
|
7
|
+
# Update the Cryptum MarketTrend Section UI
|
6
8
|
module MarketTrend
|
7
9
|
# Supported Method Parameters::
|
8
10
|
# Cryptum::UI::Candle.refresh(
|
9
11
|
# order_book: 'required - Order Book Data Structure',
|
10
12
|
# event: 'required - Event from Coinbase Web Socket'
|
11
13
|
# )
|
12
|
-
|
13
14
|
public_class_method def self.refresh(opts = {})
|
14
15
|
market_trend_win = opts[:market_trend_win]
|
15
16
|
event_history = opts[:event_history]
|
data/lib/cryptum/ui/matrix.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
4
|
+
# Cryptum::UI Module used for Presenting the
|
5
|
+
# Cryptum Curses Interface
|
5
6
|
module UI
|
6
7
|
# This plugin is used as a visual representation of being in a, "Red Pill" state
|
7
8
|
module Matrix
|
@@ -1,9 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
4
|
+
# Cryptum::UI Module used for Presenting the
|
5
|
+
# Cryptum Curses Interface
|
5
6
|
module UI
|
7
|
+
# Cryptum::UI::Order Namespace
|
6
8
|
module Order
|
9
|
+
# Update the Execute Section of the UI (When Active)
|
7
10
|
module Execute
|
8
11
|
# Supported Method Parameters::
|
9
12
|
# Cryptum::UI::Order::Execute.refresh(
|
@@ -222,8 +225,6 @@ module Cryptum
|
|
222
225
|
|
223
226
|
meta[:done_at] = Time.now.strftime('%Y-%m-%d %H:%M:%S.%N%z')
|
224
227
|
|
225
|
-
# TODO: Retry sell order if the original sell order expires.
|
226
|
-
|
227
228
|
# Reinitiate GTFO if the previous GTFO Order Expires.
|
228
229
|
terminal_win.key_press_event.key_g = true if meta[:color] == :magenta
|
229
230
|
meta[:color] = :white
|
@@ -1,10 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
+
# Cryptum::UI Module used for Presenting the
|
5
|
+
# Cryptum Curses Interface
|
4
6
|
module UI
|
5
|
-
#
|
6
|
-
# selected from the Order Execute Window Pane.
|
7
|
+
# Cryptum::UI::Order Namespace
|
7
8
|
module Order
|
9
|
+
# Update the ExecuteDetails Section of the UI (When Active)
|
8
10
|
module ExecuteDetails
|
9
11
|
# Supported Method Parameters::
|
10
12
|
# Cryptum::UI::Order::ExecuteDetails.refresh(
|
@@ -17,16 +19,16 @@ module Cryptum
|
|
17
19
|
order_meta_data = event_history.order_execute_selected_data
|
18
20
|
|
19
21
|
order_color = order_meta_data[:color].to_sym
|
20
|
-
case order_color
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
22
|
+
order_id = case order_color
|
23
|
+
when :cyan, :red
|
24
|
+
order_meta_data[:buy_order_id]
|
25
|
+
when :green, :magenta, :yellow
|
26
|
+
order_meta_data[:sell_order_id]
|
27
|
+
when :white
|
28
|
+
'Expired'
|
29
|
+
else
|
30
|
+
'N/A'
|
31
|
+
end
|
30
32
|
|
31
33
|
order_id_details = "- ID: #{order_id}"
|
32
34
|
|
@@ -77,15 +79,15 @@ module Cryptum
|
|
77
79
|
order_status_ln = "- Status: #{order_status}"
|
78
80
|
end
|
79
81
|
|
80
|
-
if created_at && (!expire_time || !done_at)
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
82
|
+
order_hist_created_finished_ln = if created_at && (!expire_time || !done_at)
|
83
|
+
"- Creation Date: #{created_at} | Finished Date: N/A"
|
84
|
+
elsif created_at && expire_time && !done_at
|
85
|
+
"- Creation Date: #{created_at} | Expiring Date: #{expire_time}"
|
86
|
+
elsif created_at && done_at
|
87
|
+
"- Creation Date: #{created_at} | Finished Date: #{done_at}"
|
88
|
+
else
|
89
|
+
'- Creation Date: N/A | Finished Date: N/A'
|
90
|
+
end
|
89
91
|
|
90
92
|
invest_out = Cryptum.beautify_large_number(
|
91
93
|
value: order_meta_data[:invest]
|
@@ -1,9 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
4
|
+
# Cryptum::UI Module used for Presenting the
|
5
|
+
# Cryptum Curses Interface
|
5
6
|
module UI
|
7
|
+
# Cryptum::UI::Order Namespace
|
6
8
|
module Order
|
9
|
+
# Update the Plan Section of the UI (When Active)
|
7
10
|
module Plan
|
8
11
|
# Supported Method Parameters::
|
9
12
|
# Cryptum::UI::Order::Plan.refresh(
|
@@ -101,7 +104,6 @@ module Cryptum
|
|
101
104
|
risk_target = fiat_budget * autotrade_cast_as_decimal
|
102
105
|
risk_alloc = risk_target
|
103
106
|
|
104
|
-
# TODO: Order Plan <= event_history.max_open_sell_orders
|
105
107
|
previous_slice_fiat_investing = 0.00
|
106
108
|
last_slice_detected = false
|
107
109
|
loop do
|
@@ -1,10 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
+
# Cryptum::UI Module used for Presenting the
|
5
|
+
# Cryptum Curses Interface
|
4
6
|
module UI
|
5
|
-
#
|
6
|
-
# selected from the Order Plan Window Pane.
|
7
|
+
# Cryptum::UI::Order Namespace
|
7
8
|
module Order
|
9
|
+
# Update the PlanDetails Section of the UI (When Active)
|
8
10
|
module PlanDetails
|
9
11
|
# Supported Method Parameters::
|
10
12
|
# Cryptum::UI::Order::PlanDetails.refresh(
|
@@ -1,9 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
+
# Cryptum::UI Module used for Presenting the
|
5
|
+
# Cryptum Curses Interface
|
4
6
|
module UI
|
5
|
-
#
|
7
|
+
# Cryptum::UI::Order Namespace
|
6
8
|
module Order
|
9
|
+
# Update the Timer Section of the UI
|
7
10
|
module Timer
|
8
11
|
# Supported Method Parameters::
|
9
12
|
# Cryptum::UI::Timer.refresh(
|
@@ -61,9 +64,6 @@ module Cryptum
|
|
61
64
|
color = indicator_status.market_trend[:color] if indicator_status.market_trend
|
62
65
|
case color
|
63
66
|
when :green
|
64
|
-
# TODO: add condition to check if open sell orders exist.
|
65
|
-
# If so intent should be something like, "- SEE ORDER HISTORY -"
|
66
|
-
# Otherwise, intent should be something like, "- WAIT FOR MARKET TREND SHIFT -"
|
67
67
|
intent = "- #{Cryptum.down_arrow} SEE ORDER HISTORY #{Cryptum.down_arrow} -"
|
68
68
|
else
|
69
69
|
speed = 'FAST'
|
data/lib/cryptum/ui/order.rb
CHANGED
data/lib/cryptum/ui/portfolio.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
4
|
+
# Cryptum::UI Module used for Presenting the
|
5
|
+
# Cryptum Curses Interface
|
5
6
|
module UI
|
7
|
+
# Update the Portfolio Section of the UI
|
6
8
|
module Portfolio
|
7
9
|
# Supported Method Parameters::
|
8
10
|
# Cryptum::UI::Candle.refresh(
|
@@ -1,8 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
4
|
+
# Cryptum::UI Module used for Presenting the
|
5
|
+
# Cryptum Curses Interface
|
5
6
|
module UI
|
7
|
+
# Update the SignalEngine Section of the UI
|
6
8
|
module SignalEngine
|
7
9
|
# Supported Method Parameters::
|
8
10
|
# Cryptum::UI::Candle.refresh(
|
data/lib/cryptum/ui/ticker.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
#
|
4
|
+
# Cryptum::UI Module used for Presenting the
|
5
|
+
# Cryptum Curses Interface
|
5
6
|
module UI
|
7
|
+
# Update the Ticker section of the UI
|
6
8
|
module Ticker
|
7
9
|
public_class_method def self.refresh(opts = {})
|
8
10
|
start_time = opts[:start_time]
|
@@ -81,9 +83,6 @@ module Cryptum
|
|
81
83
|
value: volume_30d
|
82
84
|
)
|
83
85
|
|
84
|
-
# TODO: Potential for RACE CONDITIONS - MIGRATE TO
|
85
|
-
# Cryptum::Event.parse
|
86
|
-
# Indicate if 24 Hour High is Reached During Sesssion
|
87
86
|
high_24h = format(
|
88
87
|
"%0.#{fiat_smallest_decimal}f",
|
89
88
|
event[:high_24h]
|
data/lib/cryptum/ui.rb
CHANGED
@@ -249,12 +249,9 @@ module Cryptum
|
|
249
249
|
key_press = ui_win.get_char
|
250
250
|
|
251
251
|
# Useful for detecting and logging actual key presses to file
|
252
|
-
#
|
253
|
-
#
|
254
|
-
#
|
255
|
-
# f.print key_press.inspect
|
256
|
-
# f.puts "\n\n\n"
|
257
|
-
# end
|
252
|
+
# if key_press
|
253
|
+
# debug_keys = "#{key_press.class} => key_press.inspect\n\n\n"
|
254
|
+
# Cryptum::Log.append(level: :debug, msg: debug_keys, which_self: self)
|
258
255
|
# end
|
259
256
|
|
260
257
|
case key_press
|
@@ -278,6 +275,7 @@ module Cryptum
|
|
278
275
|
key_press_event.key_tab = true
|
279
276
|
end
|
280
277
|
|
278
|
+
# TODO: Fix this - sometimes this results in unintended behavior.
|
281
279
|
# What a hack to detect special keys (-.-)
|
282
280
|
if key_press_event.key_esc
|
283
281
|
key_press_event.key_ansi = true if key_press == '['
|
data/lib/cryptum/version.rb
CHANGED