cryptum 0.0.424 → 0.0.425
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -3
- data/lib/cryptum/log.rb +10 -11
- data/lib/cryptum/ui/order/execute.rb +21 -7
- data/lib/cryptum/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93ce9c71816f16413dd9aac6b343d4b24b958ac2956aad177bd2409b22f2b96f
|
4
|
+
data.tar.gz: 72b4e5410ff43db2f0b1bc17a9c3c46ec8decfea5c4a0118096a6bc9a1f31f23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5838263d18649850b67a020a39e80bfea10acfb1bfec589c38d15728fc5876b489bec31d9f6d78e16ad2608b38e839a45eaf837f715d3e67cc40aff3ac49d6c
|
7
|
+
data.tar.gz: 9355aa5e0950cb73e6ce1519f5df29c40836ae1ec51311a7ef78861b35f934866fda5b0c3a0e0b2135d3c893841c070a664233660275b27711de7ec79f8aa142
|
data/.rubocop.yml
CHANGED
@@ -6,7 +6,7 @@ Layout/LineLength:
|
|
6
6
|
Lint/UselessRescue:
|
7
7
|
Enabled: false
|
8
8
|
Metrics/AbcSize:
|
9
|
-
Max:
|
9
|
+
Max: 410
|
10
10
|
Metrics/BlockLength:
|
11
11
|
Max: 138
|
12
12
|
Metrics/BlockNesting:
|
@@ -14,13 +14,13 @@ Metrics/BlockNesting:
|
|
14
14
|
Metrics/ClassLength:
|
15
15
|
Max: 128
|
16
16
|
Metrics/CyclomaticComplexity:
|
17
|
-
Max:
|
17
|
+
Max: 80
|
18
18
|
Metrics/MethodLength:
|
19
19
|
Max: 397
|
20
20
|
Metrics/ModuleLength:
|
21
21
|
Max: 407
|
22
22
|
Metrics/PerceivedComplexity:
|
23
|
-
Max:
|
23
|
+
Max: 80
|
24
24
|
Style/HashSyntax:
|
25
25
|
EnforcedShorthandSyntax: never
|
26
26
|
|
data/lib/cryptum/log.rb
CHANGED
@@ -26,9 +26,13 @@ module Cryptum
|
|
26
26
|
datetime_str = '%Y-%m-%d %H:%M:%S.%N%z'
|
27
27
|
|
28
28
|
# Always append to log file
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
if level == :learning
|
30
|
+
log_file_path = "/tmp/cryptum-ai-#{session}-#{symbol}.json" if level == :learning
|
31
|
+
log_file = File.open(log_file_path, 'w')
|
32
|
+
else
|
33
|
+
log_file_path = '/tmp/cryptum.log'
|
34
|
+
log_file = File.open(log_file_path, 'a')
|
35
|
+
end
|
32
36
|
|
33
37
|
# Leave 10 "old" log files where
|
34
38
|
# each file is ~ 1,024,000 bytes
|
@@ -69,17 +73,12 @@ module Cryptum
|
|
69
73
|
end
|
70
74
|
|
71
75
|
if level == :learning
|
72
|
-
|
73
|
-
|
76
|
+
log_event = msg
|
77
|
+
logger.formatter = proc do |_severity, _datetime, _progname, json_msg|
|
74
78
|
JSON.pretty_generate(
|
75
|
-
|
76
|
-
session: session,
|
77
|
-
symbol: symbol,
|
78
|
-
progname: progname,
|
79
|
-
msg: json_msg
|
79
|
+
learning_data: json_msg
|
80
80
|
)
|
81
81
|
end
|
82
|
-
log_event = msg
|
83
82
|
else
|
84
83
|
log_event = "driver: #{driver_name}"
|
85
84
|
if event_history.respond_to?('order_book')
|
@@ -237,6 +237,12 @@ module Cryptum
|
|
237
237
|
end
|
238
238
|
end
|
239
239
|
|
240
|
+
# Snag all sold orders
|
241
|
+
oh_meta_sold_arr = order_history_meta.select do |ohm|
|
242
|
+
ohm[:color].to_sym == :green && ohm.key?(:done_at)
|
243
|
+
end
|
244
|
+
order_hist_meta_sold = oh_meta_sold_arr.length
|
245
|
+
|
240
246
|
# Update Completed Sell Orders w/ Green &&
|
241
247
|
# Include done_at Timestamp for 24h gain calc
|
242
248
|
if event_type == :done &&
|
@@ -247,6 +253,18 @@ module Cryptum
|
|
247
253
|
order_history_meta.each do |meta|
|
248
254
|
next unless meta[:sell_order_id] == sell_order_id
|
249
255
|
|
256
|
+
learning_arr = []
|
257
|
+
oh_meta_sold_arr.each do |ohm|
|
258
|
+
learning = ohm
|
259
|
+
buy_order_id = ohm[:buy_order_id]
|
260
|
+
sell_order_id = ohm[:sell_order_id]
|
261
|
+
order_history_buy_details = order_history.select { |oh| oh[:id] == buy_order_id }
|
262
|
+
order_history_sell_details = order_history.select { |oh| oh[:id] == sell_order_id }
|
263
|
+
learning[:buy_details] = order_history_buy_details.first
|
264
|
+
learning[:sell_details] = order_history_sell_details.first
|
265
|
+
learning_arr.push(learning)
|
266
|
+
end
|
267
|
+
|
250
268
|
meta[:done_at] = Time.now.strftime('%Y-%m-%d %H:%M:%S.%N%z')
|
251
269
|
meta[:color] = :green
|
252
270
|
|
@@ -259,9 +277,11 @@ module Cryptum
|
|
259
277
|
order_history_sell_details = order_history.select { |oh| oh[:id] == sell_order_id }
|
260
278
|
learning[:buy_details] = order_history_buy_details.first
|
261
279
|
learning[:sell_details] = order_history_sell_details.first
|
280
|
+
learning_arr.push(learning)
|
281
|
+
|
262
282
|
Cryptum::Log.append(
|
263
283
|
level: :learning,
|
264
|
-
msg:
|
284
|
+
msg: learning_arr,
|
265
285
|
which_self: self,
|
266
286
|
event_history: event_history
|
267
287
|
)
|
@@ -271,12 +291,6 @@ module Cryptum
|
|
271
291
|
# OK, now let's tally up everything...
|
272
292
|
twenty_four_hrs_ago = Time.now - 86_400
|
273
293
|
|
274
|
-
# Snag all sold orders
|
275
|
-
oh_meta_sold_arr = order_history_meta.select do |ohm|
|
276
|
-
ohm[:color].to_sym == :green && ohm.key?(:done_at)
|
277
|
-
end
|
278
|
-
order_hist_meta_sold = oh_meta_sold_arr.length
|
279
|
-
|
280
294
|
# Snag all sold orders within past 24 hrs
|
281
295
|
ohm_sold_twenty_four_arr = []
|
282
296
|
unless oh_meta_sold_arr.empty?
|
data/lib/cryptum/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.425
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 0day Inc.
|
@@ -537,7 +537,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
537
537
|
- !ruby/object:Gem::Version
|
538
538
|
version: '0'
|
539
539
|
requirements: []
|
540
|
-
rubygems_version: 3.4.
|
540
|
+
rubygems_version: 3.4.11
|
541
541
|
signing_key:
|
542
542
|
specification_version: 4
|
543
543
|
summary: Coinbase Pro High-Frequency Trading Bot
|