cryptum 0.0.456 → 0.0.457
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 +5 -5
- data/lib/cryptum/ui/order/execute.rb +37 -2
- 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: a7dda352965440c606383099a1ad8affc595e83b3126b1d9a17a5a9e80ea93f8
|
4
|
+
data.tar.gz: 9680be3d642bdbf69833c3e61d1d25aa908a2259f421138106c42a554de7069e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb4e777ff41816b922ce7a98323c4ea33142abb623cd3e9bab90433e7436fdcf06d538c8794c7c3360234494ae6a062ddaa67a701ae718f8628767232c129b5f
|
7
|
+
data.tar.gz: 4cbf5bb9dd5c144b92b8165e65fd830d6c84e9cd479e3e65ebae6c1dc4d10c4b675609fb8d292dd706e79398d9f59aa15e906ad78de416eb6d2d8a1bddc4dcf9
|
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: 537.6
|
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: 134
|
16
16
|
Metrics/CyclomaticComplexity:
|
17
|
-
Max:
|
17
|
+
Max: 102
|
18
18
|
Metrics/MethodLength:
|
19
|
-
Max:
|
19
|
+
Max: 485
|
20
20
|
Metrics/ModuleLength:
|
21
|
-
Max:
|
21
|
+
Max: 495
|
22
22
|
Metrics/PerceivedComplexity:
|
23
|
-
Max:
|
23
|
+
Max: 100
|
24
24
|
Style/HashSyntax:
|
25
25
|
EnforcedShorthandSyntax: never
|
26
26
|
|
@@ -239,13 +239,28 @@ module Cryptum
|
|
239
239
|
end
|
240
240
|
end
|
241
241
|
|
242
|
-
#
|
242
|
+
# Snag all orders bought YTD
|
243
|
+
oh_buy_ytd_arr = order_history.select do |oh|
|
244
|
+
oh[:side] == 'buy' &&
|
245
|
+
oh.key?(:done_at) &&
|
246
|
+
Time.now.strftime('%Y') == Time.parse(oh[:done_at]).strftime('%Y')
|
247
|
+
end
|
248
|
+
order_hist_buy_usd_tot = oh_buy_ytd_arr.map do |oh|
|
249
|
+
oh[:executed_value].to_f
|
250
|
+
end.sum
|
251
|
+
|
252
|
+
# Snag all orders sold YTD
|
243
253
|
oh_sold_ytd_arr = order_history.select do |oh|
|
244
254
|
oh[:side] == 'sell' &&
|
245
255
|
oh.key?(:done_at) &&
|
246
256
|
Time.now.strftime('%Y') == Time.parse(oh[:done_at]).strftime('%Y')
|
247
257
|
end
|
248
258
|
order_hist_sold_ytd = oh_sold_ytd_arr.length
|
259
|
+
order_hist_sold_usd_tot = oh_sold_ytd_arr.map do |oh|
|
260
|
+
oh[:executed_value].to_f
|
261
|
+
end.sum
|
262
|
+
order_hist_profit_usd_ytd = order_hist_sold_usd_tot - order_hist_buy_usd_tot
|
263
|
+
order_hist_profit_usd_ytd_out = format('%0.2f', order_hist_profit_usd_ytd)
|
249
264
|
|
250
265
|
# Snag all session orders sold YTD
|
251
266
|
oh_meta_sold_arr = order_history_meta.select do |ohm|
|
@@ -314,6 +329,15 @@ module Cryptum
|
|
314
329
|
# OK, now let's tally up everything...
|
315
330
|
twenty_four_hrs_ago = Time.now - 86_400
|
316
331
|
|
332
|
+
# Snag all orders bought within past 24 hrs
|
333
|
+
oh_buy_twenty_four_arr = []
|
334
|
+
unless oh_buy_ytd_arr.empty?
|
335
|
+
oh_buy_twenty_four_arr = oh_buy_ytd_arr.select do |o|
|
336
|
+
Time.parse(o[:done_at]) >= twenty_four_hrs_ago
|
337
|
+
end
|
338
|
+
end
|
339
|
+
# order_hist_buy_twenty_four = oh_buy_twenty_four_arr.length
|
340
|
+
|
317
341
|
# Snag all orders sold within past 24 hrs
|
318
342
|
oh_sold_twenty_four_arr = []
|
319
343
|
unless oh_sold_ytd_arr.empty?
|
@@ -323,6 +347,17 @@ module Cryptum
|
|
323
347
|
end
|
324
348
|
order_hist_sold_twenty_four = oh_sold_twenty_four_arr.length
|
325
349
|
|
350
|
+
# Calculate 24h gain
|
351
|
+
order_hist_buy_usd_24h = oh_buy_twenty_four_arr.map do |oh|
|
352
|
+
oh[:excuted_value].to_f
|
353
|
+
end.sum
|
354
|
+
|
355
|
+
order_hist_sold_usd_24h = oh_sold_twenty_four_arr.map do |oh|
|
356
|
+
oh[:executed_value].to_f
|
357
|
+
end.sum
|
358
|
+
order_hist_profit_usd_24h = order_hist_sold_usd_24h - order_hist_buy_usd_24h
|
359
|
+
order_hist_profit_usd_24h_out = format('%0.2f', order_hist_profit_usd_24h)
|
360
|
+
|
326
361
|
# Snag all session orders sold within past 24 hrs
|
327
362
|
ohm_sold_twenty_four_arr = []
|
328
363
|
unless oh_meta_sold_arr.empty?
|
@@ -608,7 +643,7 @@ module Cryptum
|
|
608
643
|
|
609
644
|
tot_header_str = "TOTAL OPEN: #{total_to_sell} TPMD: $TBD | "
|
610
645
|
tot_header_str += "SOLD 24h: #{order_hist_sold_twenty_four} YTD: #{order_hist_sold_ytd} | "
|
611
|
-
tot_header_str +=
|
646
|
+
tot_header_str += "PROF 24h: $#{order_hist_profit_usd_24h_out} YTD: $#{order_hist_profit_usd_ytd_out} | "
|
612
647
|
tot_header_str += 'AvgRndT DAYS: TBD'
|
613
648
|
order_execute_win.setpos(
|
614
649
|
out_line_no,
|
data/lib/cryptum/version.rb
CHANGED