cryptum 0.0.379 → 0.0.380
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/.rubocop_todo.yml +1 -5
- data/bin/cryptum +3 -3
- data/bin/cryptum-forecast +1 -1
- data/lib/cryptum/api.rb +24 -4
- data/lib/cryptum/option/choice.rb +2 -2
- data/lib/cryptum/option/environment.rb +45 -0
- data/lib/cryptum/option/input_validation.rb +85 -0
- data/lib/cryptum/option/parser.rb +85 -0
- data/lib/cryptum/option.rb +3 -192
- data/lib/cryptum/version.rb +1 -1
- data/spec/lib/cryptum/option/environment_spec.rb +10 -0
- data/spec/lib/cryptum/option/input_validation_spec.rb +10 -0
- data/spec/lib/cryptum/option/parser_spec.rb +10 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c3982c00e3f216242d2e27886cd5896804f3605d540394c6961d0d5c1bc38db
|
4
|
+
data.tar.gz: d346e20098bcb5488d4a0a5067b8004ddf26674e8d181fa24676d10a80dda370
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b4b4cbb7db373840040049d056bcfb58fa0ead62230cefb8953d4573b29043f343f3eee2ac23166806a212de26d2a4aa59ea39cc94959c41e315ac2df2280e7
|
7
|
+
data.tar.gz: 18951472ce501e7f80332fd531e9f7dc70483af3d11b0efce8ee117d86b47dbb8848c52e0c6fc27e5fe13ced953c8ec4fb5487333368032c395776160d1bddcd
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2023-03-
|
3
|
+
# on 2023-03-30 21:02:59 UTC using RuboCop version 1.48.1.
|
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
|
@@ -11,10 +11,6 @@ Lint/UselessAssignment:
|
|
11
11
|
Exclude:
|
12
12
|
- 'lib/cryptum/api.rb'
|
13
13
|
|
14
|
-
# Offense count: 58
|
15
|
-
Lint/UselessRescue:
|
16
|
-
Enabled: false
|
17
|
-
|
18
14
|
# Offense count: 1
|
19
15
|
# Configuration parameters: CountComments, CountAsOne.
|
20
16
|
Metrics/ClassLength:
|
data/bin/cryptum
CHANGED
@@ -8,14 +8,14 @@ begin
|
|
8
8
|
start_time = Time.now.strftime('%Y-%m-%d %H:%M:%S%z')
|
9
9
|
# Initialize Driver Name & Parse cryptum Flags
|
10
10
|
driver_name = File.basename($PROGRAM_NAME)
|
11
|
-
option_choice = Cryptum::Option.
|
11
|
+
option_choice = Cryptum::Option::Parser.get(driver_name: driver_name)
|
12
12
|
|
13
13
|
# Initialize the Respective Environment / API Authentication Artifacts
|
14
|
-
env = Cryptum::Option.
|
14
|
+
env = Cryptum::Option::Environment.get(option_choice: option_choice)
|
15
15
|
|
16
16
|
# Dump out supported products if --list-products flag is passed and exit
|
17
17
|
if option_choice.list_products
|
18
|
-
Cryptum::
|
18
|
+
Cryptum::API.list_products_and_exit(
|
19
19
|
option_choice: option_choice,
|
20
20
|
env: env
|
21
21
|
)
|
data/bin/cryptum-forecast
CHANGED
@@ -113,7 +113,7 @@ begin
|
|
113
113
|
autotrade_cycle_tot = 1 unless option_choice.cycles_complete.to_i.positive?
|
114
114
|
|
115
115
|
# Initialize the Respective Environment / API Authentication Artifacts
|
116
|
-
env = Cryptum::Option.
|
116
|
+
env = Cryptum::Option::Environment.get(option_choice: option_choice)
|
117
117
|
|
118
118
|
# Read in Bot Conf Values
|
119
119
|
bot_conf = Cryptum::BotConf.read(option_choice: option_choice)
|
data/lib/cryptum/api.rb
CHANGED
@@ -488,6 +488,26 @@ module Cryptum
|
|
488
488
|
raise e
|
489
489
|
end
|
490
490
|
|
491
|
+
# List Supported Cryptum Products and Exit
|
492
|
+
public_class_method def self.list_products_and_exit(opts = {})
|
493
|
+
option_choice = opts[:option_choice]
|
494
|
+
env = opts[:env]
|
495
|
+
|
496
|
+
puts "\n#{option_choice.driver_name} Supports the Following Products:"
|
497
|
+
products = Cryptum::API.get_products(
|
498
|
+
option_choice: option_choice,
|
499
|
+
env: env
|
500
|
+
)
|
501
|
+
|
502
|
+
products.map do |product|
|
503
|
+
puts product[:id].downcase
|
504
|
+
end
|
505
|
+
|
506
|
+
exit 0
|
507
|
+
rescue StandardError => e
|
508
|
+
raise e
|
509
|
+
end
|
510
|
+
|
491
511
|
private_class_method def self.get_exchange_rates(opts = {})
|
492
512
|
option_choice = opts[:option_choice]
|
493
513
|
env = opts[:env]
|
@@ -668,19 +688,19 @@ module Cryptum
|
|
668
688
|
)
|
669
689
|
|
670
690
|
profiles = #{self}.get_profiles(
|
671
|
-
env: 'required - Coinbase::Option.
|
691
|
+
env: 'required - Coinbase::Option::Environment.get Object'
|
672
692
|
)
|
673
693
|
|
674
694
|
products = #{self}.get_products(
|
675
|
-
env: 'required - Coinbase::Option.
|
695
|
+
env: 'required - Coinbase::Option::Environment.get Object'
|
676
696
|
)
|
677
697
|
|
678
698
|
portfolio = #{self}.get_portfolio(
|
679
|
-
env: 'required - Coinbase::Option.
|
699
|
+
env: 'required - Coinbase::Option::Environment.get Object'
|
680
700
|
)
|
681
701
|
|
682
702
|
order_history = #{self}.get_order_history(
|
683
|
-
env: 'required - Coinbase::Option.
|
703
|
+
env: 'required - Coinbase::Option::Environment.get Object'
|
684
704
|
)
|
685
705
|
"
|
686
706
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cryptum
|
4
|
-
# This
|
4
|
+
# This module is used to Accept User Input at Session Initiation
|
5
5
|
module Option
|
6
|
-
#
|
6
|
+
# attr_accessor objects to pass through application
|
7
7
|
class Choice
|
8
8
|
attr_accessor :autotrade,
|
9
9
|
:driver_name,
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
module Cryptum
|
6
|
+
# This module is used to Accept User Input at Session Initiation
|
7
|
+
module Option
|
8
|
+
# Common module to consume YAML config and determine which environment to use.
|
9
|
+
module Environment
|
10
|
+
# Initialize Cryptum Session Environment
|
11
|
+
public_class_method def self.get(opts = {})
|
12
|
+
option_choice = opts[:option_choice]
|
13
|
+
|
14
|
+
yaml_conf_file = "#{option_choice.session_root}/etc/coinbase_pro.yaml"
|
15
|
+
yaml_conf = YAML.load_file(
|
16
|
+
yaml_conf_file,
|
17
|
+
symbolize_names: true
|
18
|
+
)
|
19
|
+
|
20
|
+
env = yaml_conf[:prod]
|
21
|
+
env[:env] = :prod
|
22
|
+
env = yaml_conf[:sandbox] if option_choice.sandbox
|
23
|
+
env[:env] = :sandbox if option_choice.sandbox
|
24
|
+
|
25
|
+
open_ai_yaml_conf_file = "#{option_choice.session_root}/etc/open_ai.yaml"
|
26
|
+
if File.exist?(open_ai_yaml_conf_file)
|
27
|
+
open_ai_yaml_conf = YAML.load_file(
|
28
|
+
open_ai_yaml_conf_file,
|
29
|
+
symbolize_names: true
|
30
|
+
)
|
31
|
+
env[:open_ai_bearer_token] = open_ai_yaml_conf[:bearer_token]
|
32
|
+
end
|
33
|
+
|
34
|
+
env
|
35
|
+
rescue StandardError => e
|
36
|
+
raise e
|
37
|
+
end
|
38
|
+
|
39
|
+
# Display Usage for this Module
|
40
|
+
public_class_method def self.help
|
41
|
+
constants.sort
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cryptum
|
4
|
+
# This module is used to Accept User Input at Session Initiation
|
5
|
+
module Option
|
6
|
+
# Common module to validate input submitted at session initiation
|
7
|
+
module InputValidation
|
8
|
+
# Validate Options for cryptum Driver
|
9
|
+
public_class_method def self.check(opts = {})
|
10
|
+
option_choice = opts[:option_choice]
|
11
|
+
|
12
|
+
# Conditions to display cryptum usage
|
13
|
+
if option_choice.symbol.nil? && option_choice.list_products.nil?
|
14
|
+
usage = true
|
15
|
+
reason = :symbol
|
16
|
+
end
|
17
|
+
|
18
|
+
option_choice.session_root = "#{Dir.home}/cryptum" if option_choice.session_root.nil?
|
19
|
+
|
20
|
+
unless Dir.exist?(option_choice.session_root)
|
21
|
+
usage = true
|
22
|
+
reason = :session_root
|
23
|
+
end
|
24
|
+
|
25
|
+
option_choice.market_trend_reset = 86_400 if option_choice.market_trend_reset.to_i.zero?
|
26
|
+
unless option_choice.market_trend_reset.to_i >= 60 &&
|
27
|
+
option_choice.market_trend_reset <= 604_800
|
28
|
+
usage = true
|
29
|
+
reason = :market_trend_reset
|
30
|
+
end
|
31
|
+
|
32
|
+
case option_choice.market_trend_reset
|
33
|
+
when 604_800
|
34
|
+
option_choice.market_trend_reset_label = '1W'
|
35
|
+
when 86_400
|
36
|
+
option_choice.market_trend_reset_label = '1D'
|
37
|
+
when 14_400
|
38
|
+
option_choice.market_trend_reset_label = '4h'
|
39
|
+
when 10_800
|
40
|
+
option_choice.market_trend_reset_label = '3h'
|
41
|
+
when 7_200
|
42
|
+
option_choice.market_trend_reset_label = '2h'
|
43
|
+
when 3_600
|
44
|
+
option_choice.market_trend_reset_label = '1h'
|
45
|
+
when 2_700
|
46
|
+
option_choice.market_trend_reset_label = '45m'
|
47
|
+
when 1_800
|
48
|
+
option_choice.market_trend_reset_label = '30m'
|
49
|
+
when 900
|
50
|
+
option_choice.market_trend_reset_label = '15m'
|
51
|
+
when 300
|
52
|
+
option_choice.market_trend_reset_label = '5m'
|
53
|
+
when 180
|
54
|
+
option_choice.market_trend_reset_label = '3m'
|
55
|
+
when 60
|
56
|
+
option_choice.market_trend_reset_label = '1m'
|
57
|
+
else
|
58
|
+
usage = true
|
59
|
+
reason = :market_trend_reset
|
60
|
+
end
|
61
|
+
|
62
|
+
if usage
|
63
|
+
case reason
|
64
|
+
when :symbol
|
65
|
+
puts "ERROR: --symbol Flag is Required.\n\n"
|
66
|
+
when :session_root
|
67
|
+
puts "ERROR: #{option_choice.session_root} does not exist.\n\n"
|
68
|
+
when :market_trend_reset
|
69
|
+
puts "ERROR: #{option_choice.market_trend_reset} - Possible values are: 604_800 || 86_400 || 14_400 || 10_800 || 7_200 || 3_600 || 2_700 || 1_800 || 900 || 300 || 180 || 60\n\n"
|
70
|
+
end
|
71
|
+
|
72
|
+
puts `#{option_choice.driver_name} --help`
|
73
|
+
exit 1
|
74
|
+
end
|
75
|
+
rescue StandardError => e
|
76
|
+
raise e
|
77
|
+
end
|
78
|
+
|
79
|
+
# Display Usage for this Module
|
80
|
+
public_class_method def self.help
|
81
|
+
constants.sort
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
module Cryptum
|
6
|
+
# This module is used to Accept User Input at Session Initiation
|
7
|
+
module Option
|
8
|
+
# Common module to consume YAML config and determine which environment to use.
|
9
|
+
module Parser
|
10
|
+
# Parse Options Passed to cryptum
|
11
|
+
public_class_method def self.get(opts = {})
|
12
|
+
option_choice = Cryptum::Option::Choice.new
|
13
|
+
option_choice.driver_name = opts[:driver_name]
|
14
|
+
|
15
|
+
OptionParser.new do |options|
|
16
|
+
options.banner = "USAGE: #{option_choice.driver_name} [opts]"
|
17
|
+
|
18
|
+
options.on(
|
19
|
+
'-sSYMBOL',
|
20
|
+
'--symbol=SYMBOL',
|
21
|
+
'<Required - Crypto Symbol.(e.g. btc-usd, eth-usd, etc.)'
|
22
|
+
) { |s| option_choice.symbol = s.to_s.gsub('-', '_').downcase.to_sym }
|
23
|
+
|
24
|
+
options.on(
|
25
|
+
'-A',
|
26
|
+
'--[no-]autotrade',
|
27
|
+
'<Optional - Automatically Buy and Sell Crypto>'
|
28
|
+
) { |a| option_choice.autotrade = a }
|
29
|
+
|
30
|
+
options.on(
|
31
|
+
'-l',
|
32
|
+
'--[no-]list-products',
|
33
|
+
'<Optional - List Supported Crypto Currency Products and Exit>'
|
34
|
+
) { |l| option_choice.list_products = l }
|
35
|
+
|
36
|
+
options.on(
|
37
|
+
'-pPROXY',
|
38
|
+
'--proxy=PROXY',
|
39
|
+
'<Optional - HTTP Proxy e.g. "http://127.0.0.1:8080">'
|
40
|
+
) { |p| option_choice.proxy = p }
|
41
|
+
|
42
|
+
options.on(
|
43
|
+
'-R',
|
44
|
+
'--[no-]reset-trend-countdown',
|
45
|
+
'<Optional - Reset Market Trend Countdown at Session Init (Defaults to false)>'
|
46
|
+
) { |t| option_choice.reset_session_countdown = t }
|
47
|
+
|
48
|
+
options.on(
|
49
|
+
'-rPATH',
|
50
|
+
'--session-root=PATH',
|
51
|
+
'<Optional - Directory with etc && order_books (Defaults to ~/cryptum)>'
|
52
|
+
) { |r| option_choice.session_root = r }
|
53
|
+
|
54
|
+
options.on(
|
55
|
+
'-S',
|
56
|
+
'--[no-]sandbox',
|
57
|
+
'<Optional - Use Coinbase Sandbox Environment for Testing Ideas>'
|
58
|
+
) { |n| option_choice.sandbox = n }
|
59
|
+
|
60
|
+
options.on(
|
61
|
+
'-tSECONDS',
|
62
|
+
'--trend-reset-time=SECONDS',
|
63
|
+
'<Optional - Seconds Between Market Trend Reset (Default 86_400 i.e. 1 day)>'
|
64
|
+
) { |t| option_choice.market_trend_reset = t.to_i }
|
65
|
+
end.parse!
|
66
|
+
|
67
|
+
Cryptum::Option::InputValidation.check(option_choice: option_choice)
|
68
|
+
|
69
|
+
option_choice
|
70
|
+
rescue OptionParser::InvalidOption => e
|
71
|
+
# Print Usage if unsupported flags are passed
|
72
|
+
puts "ERROR: #{e.message}\n\n"
|
73
|
+
puts `#{option_choice.driver_name} --help`
|
74
|
+
exit 1
|
75
|
+
rescue StandardError => e
|
76
|
+
raise e
|
77
|
+
end
|
78
|
+
|
79
|
+
# Display Usage for this Module
|
80
|
+
public_class_method def self.help
|
81
|
+
constants.sort
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
data/lib/cryptum/option.rb
CHANGED
@@ -1,202 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'optparse'
|
4
|
-
require 'yaml'
|
5
|
-
|
6
3
|
module Cryptum
|
7
4
|
# Cryptum::UI Module used for Presenting the
|
8
5
|
# Cryptum Curses Interface
|
9
6
|
module Option
|
10
7
|
require 'cryptum/option/choice'
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
option_choice = Option::Choice.new
|
15
|
-
option_choice.driver_name = opts[:driver_name]
|
16
|
-
|
17
|
-
OptionParser.new do |options|
|
18
|
-
options.banner = "USAGE: #{option_choice.driver_name} [opts]"
|
19
|
-
|
20
|
-
options.on(
|
21
|
-
'-sSYMBOL',
|
22
|
-
'--symbol=SYMBOL',
|
23
|
-
'<Required - Crypto Symbol.(e.g. btc-usd, eth-usd, etc.)'
|
24
|
-
) { |s| option_choice.symbol = s.to_s.gsub('-', '_').downcase.to_sym }
|
25
|
-
|
26
|
-
options.on(
|
27
|
-
'-A',
|
28
|
-
'--[no-]autotrade',
|
29
|
-
'<Optional - Automatically Buy and Sell Crypto>'
|
30
|
-
) { |a| option_choice.autotrade = a }
|
31
|
-
|
32
|
-
options.on(
|
33
|
-
'-l',
|
34
|
-
'--[no-]list-products',
|
35
|
-
'<Optional - List Supported Crypto Currency Products and Exit>'
|
36
|
-
) { |l| option_choice.list_products = l }
|
37
|
-
|
38
|
-
options.on(
|
39
|
-
'-pPROXY',
|
40
|
-
'--proxy=PROXY',
|
41
|
-
'<Optional - HTTP Proxy e.g. "http://127.0.0.1:8080">'
|
42
|
-
) { |p| option_choice.proxy = p }
|
43
|
-
|
44
|
-
options.on(
|
45
|
-
'-R',
|
46
|
-
'--[no-]reset-trend-countdown',
|
47
|
-
'<Optional - Reset Market Trend Countdown at Session Init (Defaults to false)>'
|
48
|
-
) { |t| option_choice.reset_session_countdown = t }
|
49
|
-
|
50
|
-
options.on(
|
51
|
-
'-rPATH',
|
52
|
-
'--session-root=PATH',
|
53
|
-
'<Optional - Directory with etc && order_books (Defaults to ~/cryptum)>'
|
54
|
-
) { |r| option_choice.session_root = r }
|
55
|
-
|
56
|
-
options.on(
|
57
|
-
'-S',
|
58
|
-
'--[no-]sandbox',
|
59
|
-
'<Optional - Use Coinbase Sandbox Environment for Testing Ideas>'
|
60
|
-
) { |n| option_choice.sandbox = n }
|
61
|
-
|
62
|
-
options.on(
|
63
|
-
'-tSECONDS',
|
64
|
-
'--trend-reset-time=SECONDS',
|
65
|
-
'<Optional - Seconds Between Market Trend Reset (Default 86_400 i.e. 1 day)>'
|
66
|
-
) { |t| option_choice.market_trend_reset = t.to_i }
|
67
|
-
end.parse!
|
68
|
-
|
69
|
-
input_validation(option_choice: option_choice)
|
70
|
-
|
71
|
-
option_choice
|
72
|
-
rescue OptionParser::InvalidOption => e
|
73
|
-
# Print Usage if unsupported flags are passed
|
74
|
-
puts "ERROR: #{e.message}\n\n"
|
75
|
-
puts `#{option_choice.driver_name} --help`
|
76
|
-
exit 1
|
77
|
-
rescue StandardError => e
|
78
|
-
raise e
|
79
|
-
end
|
80
|
-
|
81
|
-
# Validate Options for cryptum Driver
|
82
|
-
public_class_method def self.input_validation(opts = {})
|
83
|
-
option_choice = opts[:option_choice]
|
84
|
-
|
85
|
-
# Conditions to display cryptum usage
|
86
|
-
if option_choice.symbol.nil? && option_choice.list_products.nil?
|
87
|
-
usage = true
|
88
|
-
reason = :symbol
|
89
|
-
end
|
90
|
-
|
91
|
-
option_choice.session_root = "#{Dir.home}/cryptum" if option_choice.session_root.nil?
|
92
|
-
|
93
|
-
unless Dir.exist?(option_choice.session_root)
|
94
|
-
usage = true
|
95
|
-
reason = :session_root
|
96
|
-
end
|
97
|
-
|
98
|
-
option_choice.market_trend_reset = 86_400 if option_choice.market_trend_reset.to_i.zero?
|
99
|
-
unless option_choice.market_trend_reset.to_i >= 60 &&
|
100
|
-
option_choice.market_trend_reset <= 604_800
|
101
|
-
usage = true
|
102
|
-
reason = :market_trend_reset
|
103
|
-
end
|
104
|
-
|
105
|
-
case option_choice.market_trend_reset
|
106
|
-
when 604_800
|
107
|
-
option_choice.market_trend_reset_label = '1W'
|
108
|
-
when 86_400
|
109
|
-
option_choice.market_trend_reset_label = '1D'
|
110
|
-
when 14_400
|
111
|
-
option_choice.market_trend_reset_label = '4h'
|
112
|
-
when 10_800
|
113
|
-
option_choice.market_trend_reset_label = '3h'
|
114
|
-
when 7_200
|
115
|
-
option_choice.market_trend_reset_label = '2h'
|
116
|
-
when 3_600
|
117
|
-
option_choice.market_trend_reset_label = '1h'
|
118
|
-
when 2_700
|
119
|
-
option_choice.market_trend_reset_label = '45m'
|
120
|
-
when 1_800
|
121
|
-
option_choice.market_trend_reset_label = '30m'
|
122
|
-
when 900
|
123
|
-
option_choice.market_trend_reset_label = '15m'
|
124
|
-
when 300
|
125
|
-
option_choice.market_trend_reset_label = '5m'
|
126
|
-
when 180
|
127
|
-
option_choice.market_trend_reset_label = '3m'
|
128
|
-
when 60
|
129
|
-
option_choice.market_trend_reset_label = '1m'
|
130
|
-
else
|
131
|
-
usage = true
|
132
|
-
reason = :market_trend_reset
|
133
|
-
end
|
134
|
-
|
135
|
-
if usage
|
136
|
-
case reason
|
137
|
-
when :symbol
|
138
|
-
puts "ERROR: --symbol Flag is Required.\n\n"
|
139
|
-
when :session_root
|
140
|
-
puts "ERROR: #{option_choice.session_root} does not exist.\n\n"
|
141
|
-
when :market_trend_reset
|
142
|
-
puts "ERROR: #{option_choice.market_trend_reset} - Possible values are: 604_800 || 86_400 || 14_400 || 10_800 || 7_200 || 3_600 || 2_700 || 1_800 || 900 || 300 || 180 || 60\n\n"
|
143
|
-
end
|
144
|
-
|
145
|
-
puts `#{option_choice.driver_name} --help`
|
146
|
-
exit 1
|
147
|
-
end
|
148
|
-
rescue StandardError => e
|
149
|
-
raise e
|
150
|
-
end
|
151
|
-
|
152
|
-
# List Supported Cryptum Products and Exit
|
153
|
-
public_class_method def self.list_products_and_exit(opts = {})
|
154
|
-
option_choice = opts[:option_choice]
|
155
|
-
env = opts[:env]
|
156
|
-
|
157
|
-
puts "\n#{option_choice.driver_name} Supports the Following Products:"
|
158
|
-
products = Cryptum::API.get_products(
|
159
|
-
option_choice: option_choice,
|
160
|
-
env: env
|
161
|
-
)
|
162
|
-
|
163
|
-
products.map do |product|
|
164
|
-
puts product[:id].downcase
|
165
|
-
end
|
166
|
-
|
167
|
-
exit 0
|
168
|
-
rescue StandardError => e
|
169
|
-
raise e
|
170
|
-
end
|
171
|
-
|
172
|
-
# Initialize Cryptum Session Environment
|
173
|
-
public_class_method def self.get_env(opts = {})
|
174
|
-
option_choice = opts[:option_choice]
|
175
|
-
|
176
|
-
yaml_conf_file = "#{option_choice.session_root}/etc/coinbase_pro.yaml"
|
177
|
-
yaml_conf = YAML.load_file(
|
178
|
-
yaml_conf_file,
|
179
|
-
symbolize_names: true
|
180
|
-
)
|
181
|
-
|
182
|
-
env = yaml_conf[:prod]
|
183
|
-
env[:env] = :prod
|
184
|
-
env = yaml_conf[:sandbox] if option_choice.sandbox
|
185
|
-
env[:env] = :sandbox if option_choice.sandbox
|
186
|
-
|
187
|
-
open_ai_yaml_conf_file = "#{option_choice.session_root}/etc/open_ai.yaml"
|
188
|
-
if File.exist?(open_ai_yaml_conf_file)
|
189
|
-
open_ai_yaml_conf = YAML.load_file(
|
190
|
-
open_ai_yaml_conf_file,
|
191
|
-
symbolize_names: true
|
192
|
-
)
|
193
|
-
env[:open_ai_bearer_token] = open_ai_yaml_conf[:bearer_token]
|
194
|
-
end
|
195
|
-
|
196
|
-
env
|
197
|
-
rescue StandardError => e
|
198
|
-
raise e
|
199
|
-
end
|
8
|
+
require 'cryptum/option/environment'
|
9
|
+
require 'cryptum/option/input_validation'
|
10
|
+
require 'cryptum/option/parser'
|
200
11
|
|
201
12
|
# Display a List of Every UI Module
|
202
13
|
public_class_method def self.help
|
data/lib/cryptum/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cryptum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.380
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 0day Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -427,6 +427,9 @@ files:
|
|
427
427
|
- lib/cryptum/open_ai.rb
|
428
428
|
- lib/cryptum/option.rb
|
429
429
|
- lib/cryptum/option/choice.rb
|
430
|
+
- lib/cryptum/option/environment.rb
|
431
|
+
- lib/cryptum/option/input_validation.rb
|
432
|
+
- lib/cryptum/option/parser.rb
|
430
433
|
- lib/cryptum/order_book.rb
|
431
434
|
- lib/cryptum/order_book/generate.rb
|
432
435
|
- lib/cryptum/order_book/indicator.rb
|
@@ -472,6 +475,9 @@ files:
|
|
472
475
|
- spec/lib/cryptum/matrix_spec.rb
|
473
476
|
- spec/lib/cryptum/open_ai_spec.rb
|
474
477
|
- spec/lib/cryptum/option/choice_spec.rb
|
478
|
+
- spec/lib/cryptum/option/environment_spec.rb
|
479
|
+
- spec/lib/cryptum/option/input_validation_spec.rb
|
480
|
+
- spec/lib/cryptum/option/parser_spec.rb
|
475
481
|
- spec/lib/cryptum/option_spec.rb
|
476
482
|
- spec/lib/cryptum/order_book/generate_spec.rb
|
477
483
|
- spec/lib/cryptum/order_book/indicator_spec.rb
|