cryptum 0.0.453 → 0.0.455

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c65f2531ba188e7c6d94740f545c4e5b923718a0068ecbd06dc34e3f56cc0a58
4
- data.tar.gz: 7361620b8b2cca02ac949994b55a84f4542b7e712c46ea680a984b658a38fcf4
3
+ metadata.gz: 03eba9badc28d8d46f4b9f846b336dfa3606fc7b1f2194280e29f20abecff685
4
+ data.tar.gz: 2398690c5057cb87f1fe81a646cbaae9cfa0c0eebfe9dc6a14f52efa71c7cb03
5
5
  SHA512:
6
- metadata.gz: 8a977dd6d89c4183d5fc76f395b019775a5c43f232b2226ed999f645d359c030f48f6d3d2e0e9a481ae4b149091faf7dbc8fbf908ea9ae62e0ef0b85471c93d4
7
- data.tar.gz: 007abe184aab7b1c9ea20139e156d086daf22488d00ce41bb2dc00dd45d82254c8f7f89849dd57584e199db653ad232d22ea0dc142f395b38805d6e6342b8158
6
+ metadata.gz: 499ac78ce62d7ca4685a69946bd86e2cede0d52990e6e151117feeede672379486b6c13b54c08a82b85537fbd93dbe33a03befee3b5e55cba49f1a352f755158
7
+ data.tar.gz: bc93d3eb9cd1e340ea2508d9e42b24e93ba7a95ad623e67e083f34a2752d8e7aff16d0c0a2d77a48b1a3487b16eb4ce3310768ab5da14fdc0d3e9a4c377f99bc
data/.rubocop.yml CHANGED
@@ -6,7 +6,7 @@ Layout/LineLength:
6
6
  Lint/UselessRescue:
7
7
  Enabled: false
8
8
  Metrics/AbcSize:
9
- Max: 459.9
9
+ Max: 486.2
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: 91
17
+ Max: 93
18
18
  Metrics/MethodLength:
19
- Max: 421
19
+ Max: 457
20
20
  Metrics/ModuleLength:
21
- Max: 431
21
+ Max: 467
22
22
  Metrics/PerceivedComplexity:
23
- Max: 89
23
+ Max: 91
24
24
  Style/HashSyntax:
25
25
  EnforcedShorthandSyntax: never
26
26
 
@@ -80,7 +80,6 @@ module Cryptum
80
80
  order_book[:order_history_meta].keep_if do |ohm|
81
81
  order_book[:order_history].find do |oh|
82
82
  (oh[:id] == ohm[:buy_order_id] || oh[:id] == ohm[:sell_order_id]) && (
83
- ohm[:color].to_sym == :cyan ||
84
83
  ohm[:color].to_sym == :green ||
85
84
  ohm[:color].to_sym == :magenta ||
86
85
  ohm[:color].to_sym == :red ||
@@ -239,7 +239,15 @@ module Cryptum
239
239
  end
240
240
  end
241
241
 
242
- # Snag all sold orders YTD
242
+ # Snad all orders sold YTD
243
+ oh_sold_ytd_arr = order_history.select do |oh|
244
+ oh[:side] == 'sell' &&
245
+ oh.key?(:done_at) &&
246
+ Time.now.strftime('%Y') == Time.parse(oh[:done_at]).strftime('%Y')
247
+ end
248
+ order_hist_sold_ytd = oh_sold_ytd_arr.length
249
+
250
+ # Snag all session orders sold YTD
243
251
  oh_meta_sold_arr = order_history_meta.select do |ohm|
244
252
  ohm[:color].to_sym == :green &&
245
253
  ohm.key?(:done_at) &&
@@ -306,7 +314,16 @@ module Cryptum
306
314
  # OK, now let's tally up everything...
307
315
  twenty_four_hrs_ago = Time.now - 86_400
308
316
 
309
- # Snag all sold orders within past 24 hrs
317
+ # Snag all orders sold within past 24 hrs
318
+ oh_sold_twenty_four_arr = []
319
+ unless oh_sold_ytd_arr.empty?
320
+ oh_sold_twenty_four_arr = oh_sold_ytd_arr.select do |o|
321
+ Time.parse(o[:done_at]) >= twenty_four_hrs_ago
322
+ end
323
+ end
324
+ order_hist_sold_twenty_four = oh_sold_twenty_four_arr.length
325
+
326
+ # Snag all session orders sold within past 24 hrs
310
327
  ohm_sold_twenty_four_arr = []
311
328
  unless oh_meta_sold_arr.empty?
312
329
  ohm_sold_twenty_four_arr = oh_meta_sold_arr.select do |o|
@@ -343,27 +360,27 @@ module Cryptum
343
360
  # end
344
361
  # order_hist_meta_24h_expired = ohm_expire_twenty_four_arr.length
345
362
 
346
- # Calculate gains within past 24 hrs
347
- # && Calculate gains YTD
348
- gains_sum = oh_meta_sold_arr.map do |ohms|
363
+ # Calculate session gains YTD
364
+ sess_gains_sum = oh_meta_sold_arr.map do |ohms|
349
365
  ohms[:profit].to_f
350
366
  end.sum
351
367
 
352
- gains_out = Cryptum.beautify_large_number(
368
+ sess_gains_out = Cryptum.beautify_large_number(
353
369
  value: format(
354
370
  '%0.2f',
355
- gains_sum
371
+ sess_gains_sum
356
372
  )
357
373
  )
358
374
 
359
- gains_24h_sum = ohm_sold_twenty_four_arr.map do |ohms|
375
+ # Calculate session gains within past 24 hrs
376
+ sess_gains_24h_sum = ohm_sold_twenty_four_arr.map do |ohms|
360
377
  ohms[:profit].to_f
361
378
  end.sum
362
379
 
363
- gains_24h_out = Cryptum.beautify_large_number(
380
+ sess_gains_24h_out = Cryptum.beautify_large_number(
364
381
  value: format(
365
382
  '%0.2f',
366
- gains_24h_sum
383
+ sess_gains_24h_sum
367
384
  )
368
385
  )
369
386
 
@@ -562,24 +579,51 @@ module Cryptum
562
579
  string: ''.ljust(col_just1, ' ')
563
580
  )
564
581
 
565
- header_str = "OPEN S/T: #{total_selling_this_session}/#{total_to_sell} TPMsD: $#{total_selling_profit_out} | "
566
- header_str += "SOLD 24h: #{order_hist_meta_sold_twenty_four} YTD: #{order_hist_meta_sold} | "
567
- header_str += "GAINS 24h: $#{gains_24h_out} YTD: $#{gains_out} | "
568
- header_str += "AVG RND TRIP DAYS: #{avg_round_trip_days_out}"
582
+ sess_header_str = "SESS OPEN: #{total_selling_this_session} TPMD: $#{total_selling_profit_out} | "
583
+ sess_header_str += "SOLD 24h: #{order_hist_meta_sold_twenty_four} YTD: #{order_hist_meta_sold} | "
584
+ sess_header_str += "PROF 24h: $#{sess_gains_24h_out} YTD: $#{sess_gains_out} | "
585
+ sess_header_str += "AvgRndT DAYS: #{avg_round_trip_days_out}"
569
586
  order_execute_win.setpos(
570
587
  out_line_no,
571
- Cryptum::UI.col_center(str: header_str)
588
+ Cryptum::UI.col_center(str: sess_header_str)
572
589
  )
573
590
 
574
591
  Cryptum::UI.colorize(
575
592
  ui_win: order_execute_win,
576
593
  color: header_color,
577
594
  style: header_style,
578
- string: header_str
595
+ string: sess_header_str
579
596
  )
580
597
 
581
598
  # ROW 11
582
599
  out_line_no += 1
600
+ order_execute_win.setpos(out_line_no, Cryptum::UI.col_first)
601
+ order_execute_win.clrtoeol
602
+ Cryptum::UI.colorize(
603
+ ui_win: order_execute_win,
604
+ color: header_color,
605
+ style: header_style,
606
+ string: ''.ljust(col_just1, ' ')
607
+ )
608
+
609
+ tot_header_str = "TOTAL OPEN: #{total_to_sell} TPMD: $TBD | "
610
+ tot_header_str += "SOLD 24h: #{order_hist_sold_twenty_four} YTD: #{order_hist_sold_ytd} | "
611
+ tot_header_str += 'PRF 24h: $TBD Y: $TBD | '
612
+ tot_header_str += 'AvgRndT DAYS: TBD'
613
+ order_execute_win.setpos(
614
+ out_line_no,
615
+ Cryptum::UI.col_center(str: tot_header_str)
616
+ )
617
+
618
+ Cryptum::UI.colorize(
619
+ ui_win: order_execute_win,
620
+ color: header_color,
621
+ style: header_style,
622
+ string: tot_header_str
623
+ )
624
+
625
+ # ROW 12
626
+ out_line_no += 1
583
627
  Cryptum::UI.line(
584
628
  ui_win: order_execute_win,
585
629
  out_line_no: out_line_no,
@@ -239,7 +239,7 @@ module Cryptum
239
239
  )
240
240
 
241
241
  # Clear to OK ROW
242
- ok_row = 9
242
+ ok_row = 10
243
243
  out_line_no += 1
244
244
  to_ok_row = ok_row - 1
245
245
  (out_line_no..to_ok_row).each do |clr_line|
@@ -79,14 +79,14 @@ module Cryptum
79
79
  )
80
80
 
81
81
  self.order_execute_section = Cryptum::UI.window(
82
- height: 11,
82
+ height: 12,
83
83
  width: 0,
84
84
  top: 29,
85
85
  left: 0
86
86
  )
87
87
 
88
88
  self.order_execute_details_section = Cryptum::UI.window(
89
- height: 11,
89
+ height: 12,
90
90
  width: 0,
91
91
  top: 29,
92
92
  left: 0
@@ -95,7 +95,7 @@ module Cryptum
95
95
  self.command_section = Cryptum::UI.window(
96
96
  height: 3,
97
97
  width: 0,
98
- top: 40,
98
+ top: 41,
99
99
  left: 0
100
100
  )
101
101
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptum
4
- VERSION = '0.0.453'
4
+ VERSION = '0.0.455'
5
5
  end
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.453
4
+ version: 0.0.455
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.