cryptum 0.0.389 → 0.0.392
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +1 -17
- data/bin/cryptum +3 -21
- data/lib/cryptum/api.rb +1 -1
- data/lib/cryptum/event.rb +1 -1
- data/lib/cryptum/option/environment.rb +3 -1
- data/lib/cryptum/option/input_validation.rb +3 -1
- data/lib/cryptum/option/parser.rb +3 -1
- data/lib/cryptum/order_book.rb +1 -1
- data/lib/cryptum/portfolio.rb +1 -1
- data/lib/cryptum/ui/exit.rb +1 -1
- data/lib/cryptum/ui/key_press_event.rb +1 -1
- data/lib/cryptum/ui/order.rb +1 -1
- data/lib/cryptum/version.rb +1 -1
- data/lib/cryptum/web_sock/event_machine.rb +23 -19
- data/lib/cryptum/web_sock.rb +1 -1
- data/spec/lib/cryptum/option/environment_spec.rb +2 -2
- data/spec/lib/cryptum/option/input_validation_spec.rb +2 -2
- data/spec/lib/cryptum/option/parser_spec.rb +2 -2
- data/spec/lib/cryptum_spec.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: 110c196928530da1a4052a8e6040d4d8059b1aa1468a7da7801e6b9be24e0d51
|
4
|
+
data.tar.gz: 22d185e05a7fc7a365441c3147b481e9cf5aa097c1d857f459ac5302eb3f7a61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b67141f9c82d817e68c6ff494af9a40b037114347ac8c26ba8bab339042bd94c0e0372c471636763603ce30ec39a89f57dbe5694e9b374b9d36b9612772d5c9
|
7
|
+
data.tar.gz: 19c5f92b35ca7d11b1fa693aebcc52e6b4dac788ead664b27bf74239f765005b9870229026debde3e900edd53214b91f5be88635ca8e1d4c526eb2cd86ca587f
|
data/.rubocop_todo.yml
CHANGED
@@ -1,21 +1,11 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2023-04-03
|
3
|
+
# on 2023-04-03 22:26:52 UTC using RuboCop version 1.49.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count: 1
|
10
|
-
Lint/UnreachableCode:
|
11
|
-
Exclude:
|
12
|
-
- 'bin/cryptum'
|
13
|
-
|
14
|
-
# Offense count: 1
|
15
|
-
Style/ClassVars:
|
16
|
-
Exclude:
|
17
|
-
- 'bin/cryptum'
|
18
|
-
|
19
9
|
# Offense count: 5
|
20
10
|
# This cop supports safe autocorrection (--autocorrect).
|
21
11
|
# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
|
@@ -30,9 +20,3 @@ Style/ConditionalAssignment:
|
|
30
20
|
# Configuration parameters: AllowedConstants.
|
31
21
|
Style/Documentation:
|
32
22
|
Enabled: false
|
33
|
-
|
34
|
-
# Offense count: 1
|
35
|
-
# This cop supports safe autocorrection (--autocorrect).
|
36
|
-
Style/RedundantSelf:
|
37
|
-
Exclude:
|
38
|
-
- 'lib/cryptum/api.rb'
|
data/bin/cryptum
CHANGED
@@ -19,12 +19,7 @@ if option_choice.list_products
|
|
19
19
|
)
|
20
20
|
end
|
21
21
|
|
22
|
-
# Instantiate Our Status Indicators & History Objects
|
23
|
-
indicator_status = Cryptum::OrderBook::Indicator.new
|
24
|
-
|
25
22
|
# Generate an Order Book for Session Tracking
|
26
|
-
# Load previous order_book_justification from
|
27
|
-
# Order Book File (if it exists)
|
28
23
|
event_history = Cryptum::OrderBook::Generate.new(
|
29
24
|
option_choice: option_choice,
|
30
25
|
env: env
|
@@ -34,25 +29,12 @@ event_history = Cryptum::OrderBook::Generate.new(
|
|
34
29
|
terminal_win = Cryptum::UI.init(event_history: event_history)
|
35
30
|
terminal_win.key_press_event.key_w = true if option_choice.reset_session_countdown
|
36
31
|
|
37
|
-
# Automatically Create Bot Confs if they don't
|
38
|
-
# Exist and Initialize Automated Trading Parameters
|
39
|
-
bot_conf = Cryptum::BotConf.read(
|
40
|
-
option_choice: option_choice,
|
41
|
-
event_history: event_history
|
42
|
-
)
|
43
|
-
|
44
32
|
# Connect to WebSocket
|
45
|
-
# Trigger Events as
|
46
|
-
#
|
47
|
-
# Web Socket HTTP Responses
|
48
|
-
# Refresh UI with Event Data
|
49
|
-
# Update "Status Indicators"
|
50
|
-
# Leverage "Status Indicators" to Initiate Actions
|
33
|
+
# Refresh UI and Trigger Events as Messages via Web Socket are Received.
|
34
|
+
# Leverage Indicators to Initiate Actions
|
51
35
|
Cryptum::WebSock::EventMachine.run(
|
52
36
|
option_choice: option_choice,
|
53
37
|
env: env,
|
54
38
|
terminal_win: terminal_win,
|
55
|
-
event_history: event_history
|
56
|
-
indicator_status: indicator_status,
|
57
|
-
bot_conf: bot_conf
|
39
|
+
event_history: event_history
|
58
40
|
)
|
data/lib/cryptum/api.rb
CHANGED
data/lib/cryptum/event.rb
CHANGED
data/lib/cryptum/order_book.rb
CHANGED
data/lib/cryptum/portfolio.rb
CHANGED
data/lib/cryptum/ui/exit.rb
CHANGED
data/lib/cryptum/ui/order.rb
CHANGED
data/lib/cryptum/version.rb
CHANGED
@@ -15,8 +15,16 @@ module Cryptum
|
|
15
15
|
option_choice = opts[:option_choice]
|
16
16
|
terminal_win = opts[:terminal_win]
|
17
17
|
event_history = opts[:event_history]
|
18
|
-
|
19
|
-
|
18
|
+
|
19
|
+
# Instantiate Our Status Indicator Objects
|
20
|
+
indicator_status = Cryptum::OrderBook::Indicator.new
|
21
|
+
|
22
|
+
# Automatically Create Bot Confs if they don't
|
23
|
+
# Exist and Initialize Automated Trading Parameters
|
24
|
+
bot_conf = Cryptum::BotConf.read(
|
25
|
+
option_choice: option_choice,
|
26
|
+
event_history: event_history
|
27
|
+
)
|
20
28
|
|
21
29
|
max_conn_attempts = 30
|
22
30
|
conn_attempt = 0
|
@@ -49,12 +57,7 @@ module Cryptum
|
|
49
57
|
end
|
50
58
|
|
51
59
|
ws.on :message do |event|
|
52
|
-
#
|
53
|
-
# Frequency of WebSocket Messages Coming Through.
|
54
|
-
# Explore another way to decouple required events
|
55
|
-
# (such as keypresses) from only being triggered
|
56
|
-
# when messages come through.
|
57
|
-
|
60
|
+
# Convert Web Socket Response JSON Message to Hash
|
58
61
|
event_history.event = JSON.parse(
|
59
62
|
event.data,
|
60
63
|
symbolize_names: true
|
@@ -73,8 +76,7 @@ module Cryptum
|
|
73
76
|
# Detect Key Press Events
|
74
77
|
Cryptum::Event::KeyPress.detect(terminal_win: terminal_win)
|
75
78
|
|
76
|
-
# Cancel ALL Open Orders when
|
77
|
-
# C is pressed
|
79
|
+
# Cancel ALL Open Orders when C is pressed
|
78
80
|
if terminal_win.key_press_event.key_c
|
79
81
|
Cryptum::Event::Cancel.open_orders(
|
80
82
|
terminal_win: terminal_win,
|
@@ -83,8 +85,7 @@ module Cryptum
|
|
83
85
|
)
|
84
86
|
end
|
85
87
|
|
86
|
-
# Get the F* Out (GTFO) when
|
87
|
-
# G is pressed
|
88
|
+
# Get the F* Out (GTFO) when G is pressed
|
88
89
|
if terminal_win.key_press_event.key_g
|
89
90
|
event_history = Cryptum::Event::GTFO.now(
|
90
91
|
terminal_win: terminal_win,
|
@@ -104,8 +105,7 @@ module Cryptum
|
|
104
105
|
)
|
105
106
|
end
|
106
107
|
|
107
|
-
#
|
108
|
-
# W is Pressed
|
108
|
+
# Write Order Book to File when W is Pressed
|
109
109
|
if terminal_win.key_press_event.key_w
|
110
110
|
Cryptum::Event::OrderBook.write(
|
111
111
|
terminal_win: terminal_win,
|
@@ -114,7 +114,11 @@ module Cryptum
|
|
114
114
|
end
|
115
115
|
|
116
116
|
# Exit if x is Pressed
|
117
|
-
|
117
|
+
if terminal_win.key_press_event.key_x
|
118
|
+
Cryptum::Event::Exit.gracefully(
|
119
|
+
event_history: event_history
|
120
|
+
)
|
121
|
+
end
|
118
122
|
|
119
123
|
# TAB through Order Plan / Order Execution Window Panes
|
120
124
|
if terminal_win.key_press_event.key_tab
|
@@ -182,9 +186,9 @@ module Cryptum
|
|
182
186
|
end
|
183
187
|
|
184
188
|
ws.on :close do
|
185
|
-
# raise when remote peer forces reset...
|
186
|
-
#
|
187
|
-
# until conn_attempt > max_conn_attempts
|
189
|
+
# raise Errno::ECONNRESET when remote peer forces reset...
|
190
|
+
# This will be caught in the rescue block below which reattempts
|
191
|
+
# to connect until conn_attempt > max_conn_attempts
|
188
192
|
raise Errno::ECONNRESET
|
189
193
|
end
|
190
194
|
|
@@ -211,7 +215,7 @@ module Cryptum
|
|
211
215
|
|
212
216
|
EM.add_periodic_timer(option_choice.market_trend_reset) do
|
213
217
|
# NOTE: To ensure the integrity of event_history is maintained,
|
214
|
-
# changes to its
|
218
|
+
# changes to its contents _MUST_ stay in this block.
|
215
219
|
event_history.order_book[:market_trend][:buy] = 0
|
216
220
|
event_history.order_book[:market_trend][:sell] = 0
|
217
221
|
event_history.order_book[:last_trend_reset] = Time.now.strftime(
|
data/lib/cryptum/web_sock.rb
CHANGED
@@ -4,7 +4,7 @@ require 'spec_helper'
|
|
4
4
|
|
5
5
|
describe Cryptum::Option::Environment do
|
6
6
|
it 'should return data for help method' do
|
7
|
-
help_response = Cryptum::Option::Environment
|
8
|
-
expect(help_response).
|
7
|
+
help_response = Cryptum::Option::Environment
|
8
|
+
expect(help_response).to respond_to :help
|
9
9
|
end
|
10
10
|
end
|
@@ -4,7 +4,7 @@ require 'spec_helper'
|
|
4
4
|
|
5
5
|
describe Cryptum::Option::InputValidation do
|
6
6
|
it 'should return data for help method' do
|
7
|
-
help_response = Cryptum::Option::InputValidation
|
8
|
-
expect(help_response).
|
7
|
+
help_response = Cryptum::Option::InputValidation
|
8
|
+
expect(help_response).to respond_to :help
|
9
9
|
end
|
10
10
|
end
|
@@ -4,7 +4,7 @@ require 'spec_helper'
|
|
4
4
|
|
5
5
|
describe Cryptum::Option::Parser do
|
6
6
|
it 'should return data for help method' do
|
7
|
-
help_response = Cryptum::Option::Parser
|
8
|
-
expect(help_response).
|
7
|
+
help_response = Cryptum::Option::Parser
|
8
|
+
expect(help_response).to respond_to :help
|
9
9
|
end
|
10
10
|
end
|
data/spec/lib/cryptum_spec.rb
CHANGED