cryptum 0.0.454 → 0.0.456

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: fe56750d834a8a3e0538467db783230b134f9cea5ef38844c88bac82b62f65dd
4
- data.tar.gz: 43212a6a0cbe059efe4f52be43ab8811b83d06b055e67501fadaada69e4faca6
3
+ metadata.gz: 4e3f976fdd41eb06a0f31c77a0f98052dd3b75b816cfd4a7ada3109c046f33f4
4
+ data.tar.gz: 986148e3bae656c4d32420c2b4d9dcc9e36d6680eb32242012bdfad73bb6d1eb
5
5
  SHA512:
6
- metadata.gz: '008fe5c27c445c60451b8dfa1e9ffae8cc3d9679308aca824daafc0948b03bb0bf97f93c18b8a095a7fba92bc970a2309910fa8949112f592191b34eeb52b479'
7
- data.tar.gz: eb22d2dd3a75e539d5d657b78de88ffce7738b8edc1d875e59ef91ab721519358cb668ae02997a820450f81f02d33a4180337fae8045c6430dc098636da1cd39
6
+ metadata.gz: 27280b8e5c51c90a3d46452dd5c449f3558c31306c3afd7411a7ac38db0accc2a3e70721b37892fe2e3ab839c2816215cda28220db3f611d5b1249b52dd7ba47
7
+ data.tar.gz: 919f242f11f071e1e5a5f211e509b85759ef3f3696c1073c67896a6c90efa01f8f671c353dc10b3a92771435e90159da81dc8e6d58026248bef388a57d230014
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 RndT 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 += 'PROF 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.454'
4
+ VERSION = '0.0.456'
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.454
4
+ version: 0.0.456
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.