cryptum 0.0.379 → 0.0.381
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/.rubocop.yml +2 -0
- data/.rubocop_todo.yml +2 -17
- data/bin/cryptum +3 -3
- data/bin/cryptum-forecast +4 -4
- data/lib/cryptum/api/exchange_rates.rb +42 -0
- data/lib/cryptum/api/fees.rb +36 -0
- data/lib/cryptum/api/order_history.rb +56 -0
- data/lib/cryptum/api/orders.rb +253 -0
- data/lib/cryptum/api/portfolio.rb +79 -0
- data/lib/cryptum/api/products.rb +65 -0
- data/lib/cryptum/api/rest.rb +177 -0
- data/lib/cryptum/api/signature.rb +79 -0
- data/lib/cryptum/api.rb +10 -640
- data/lib/cryptum/event/buy.rb +1 -1
- data/lib/cryptum/event/cancel.rb +1 -1
- data/lib/cryptum/event/gtfo.rb +1 -1
- data/lib/cryptum/event/sell.rb +1 -1
- 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/order_book/generate.rb +1 -1
- data/lib/cryptum/portfolio/balance.rb +3 -5
- data/lib/cryptum/ui/order_execution.rb +2 -2
- data/lib/cryptum/version.rb +1 -1
- data/lib/cryptum/web_sock/coinbase.rb +1 -1
- data/spec/lib/cryptum/api/exchange_rates_spec.rb +10 -0
- data/spec/lib/cryptum/api/fees_spec.rb +10 -0
- data/spec/lib/cryptum/api/order_history_spec.rb +10 -0
- data/spec/lib/cryptum/api/orders_spec.rb +10 -0
- data/spec/lib/cryptum/api/portfolio_spec.rb +10 -0
- data/spec/lib/cryptum/api/products_spec.rb +10 -0
- data/spec/lib/cryptum/api/rest_spec.rb +10 -0
- data/spec/lib/cryptum/api/signature_spec.rb +10 -0
- 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 +24 -2
@@ -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
|
@@ -25,7 +25,7 @@ module Cryptum
|
|
25
25
|
order_book_file = "#{session_root}/order_books/#{symbol}.ORDER_BOOK.json"
|
26
26
|
|
27
27
|
# Only need to retrieve a product list once / session.
|
28
|
-
products = Cryptum::API.
|
28
|
+
products = Cryptum::API::Products.get(
|
29
29
|
option_choice: option_choice,
|
30
30
|
env: env
|
31
31
|
)
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'logger'
|
4
|
-
|
5
3
|
module Cryptum
|
6
4
|
# This plugin is used to instantiate a Cryptum logger with a custom message format
|
7
5
|
module Portfolio
|
@@ -64,7 +62,7 @@ module Cryptum
|
|
64
62
|
enotes = "{ \"event_type\": \"#{etype}\", \"cancel\": \"#{ocancel}\", \"submitted\": \"#{osubmit}\" }" if option_choice.proxy
|
65
63
|
event_history.event_notes = enotes
|
66
64
|
|
67
|
-
portfolio = Cryptum::API.
|
65
|
+
portfolio = Cryptum::API::Portfolio.get(
|
68
66
|
option_choice: option_choice,
|
69
67
|
env: env,
|
70
68
|
crypto: crypto,
|
@@ -74,13 +72,13 @@ module Cryptum
|
|
74
72
|
)
|
75
73
|
event_history.order_book[:portfolio] = portfolio unless portfolio.empty?
|
76
74
|
|
77
|
-
order_history = Cryptum::API.
|
75
|
+
order_history = Cryptum::API::OrderHistory.get(
|
78
76
|
option_choice: option_choice,
|
79
77
|
env: env
|
80
78
|
)
|
81
79
|
event_history.order_book[:order_history] = order_history unless order_history.empty?
|
82
80
|
|
83
|
-
fees = Cryptum::API.
|
81
|
+
fees = Cryptum::API::Fees.get(
|
84
82
|
option_choice: option_choice,
|
85
83
|
env: env
|
86
84
|
)
|
@@ -127,7 +127,7 @@ module Cryptum
|
|
127
127
|
event_history.red_pill = true if fiat_invested_this_order > fiat_avail_to_trade.to_f
|
128
128
|
|
129
129
|
unless event_history.red_pill
|
130
|
-
event_history = Cryptum::API.submit_limit_order(
|
130
|
+
event_history = Cryptum::API::Orders.submit_limit_order(
|
131
131
|
option_choice: option_choice,
|
132
132
|
env: env,
|
133
133
|
price: price,
|
@@ -253,7 +253,7 @@ module Cryptum
|
|
253
253
|
|
254
254
|
size = order_ready_to_sell[:size]
|
255
255
|
|
256
|
-
Cryptum::API.submit_limit_order(
|
256
|
+
Cryptum::API::Orders.submit_limit_order(
|
257
257
|
option_choice: option_choice,
|
258
258
|
env: env,
|
259
259
|
price: price,
|
data/lib/cryptum/version.rb
CHANGED
@@ -65,7 +65,7 @@ module Cryptum
|
|
65
65
|
product_id = option_choice.symbol.to_s.gsub('_', '-').upcase
|
66
66
|
|
67
67
|
api_secret = env[:api_secret]
|
68
|
-
api_signature_response = Cryptum::API.
|
68
|
+
api_signature_response = Cryptum::API::Signature.generate(
|
69
69
|
api_secret: api_secret
|
70
70
|
)
|
71
71
|
api_key = env[:api_key]
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Cryptum::API::ExchangeRates do
|
6
|
+
it 'should display information for existing help method' do
|
7
|
+
help_response = Cryptum::API::ExchangeRates
|
8
|
+
expect(help_response).to respond_to :help
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Cryptum::API::OrderHistory do
|
6
|
+
it 'should display information for existing help method' do
|
7
|
+
help_response = Cryptum::API::OrderHistory
|
8
|
+
expect(help_response).to respond_to :help
|
9
|
+
end
|
10
|
+
end
|