cryptum 0.0.370 → 0.0.373

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: 53bdb2d2da6bf7e78c5623af1b88d27bb8c7942e19911b00306f0b6bfef912eb
4
- data.tar.gz: 9882b53b7be9185eb84ba21a8a52ac8a8773b098830786556a94ecfe92abbf4b
3
+ metadata.gz: ad583e315522b51751a336aff7cff06e1f9efa4a6b0227ebaf21149835ef03f4
4
+ data.tar.gz: e269e281bb9de22cf6049cb965e20566d0a0fcce00d45ef7d7c94129017b54f2
5
5
  SHA512:
6
- metadata.gz: 51b81e6d2e78d0cc9d9151d7b0186ff13fe6e55ba4b5c29d176fee5818fb13d5a06baa281ef255306669d18c3e320c389667615f66a41965a939a8e57cf96c22
7
- data.tar.gz: 1d764d72578d39ab049c462499f1885a26b3aa1f07aa5d02ba06688306b3a3faa65378e6dc26523588820823b17377f8b6bb319ec7b68ee9ed86c2dee94ff71e
6
+ metadata.gz: dc070fb8cac58f2c2bec2444c667c1aba3c6c7078c3d72fe3d5de92bd42ebd2a2b1b1920ab8bc3f4d7fb2fbfafb27d9546eff148fb05d738bee0151ebb470e8b
7
+ data.tar.gz: 8d948d008ac22ff81af033efb9367e3600c8bb2b41c8a84286dd8ed571ddb63e4b11671dfd922f61b946c6f5814e92daf80ebf57836e548d69796a7d4de935c1
data/Gemfile CHANGED
@@ -12,7 +12,7 @@ gemspec
12
12
  # to build appropriately. Defer to ./reinstall_coinbot_gemset.sh
13
13
  # to review these custom flags
14
14
  gem 'addressable', '2.8.1'
15
- gem 'bundler', '>=2.4.9'
15
+ gem 'bundler', '>=2.4.10'
16
16
  gem 'bundler-audit', '0.9.1'
17
17
  gem 'curses', '1.4.4'
18
18
  gem 'eventmachine', '1.2.7'
data/cryptum.gemspec CHANGED
@@ -25,15 +25,14 @@ Gem::Specification.new do |spec|
25
25
  cryptum_modules = spec.files.grep(%r{^lib/})
26
26
 
27
27
  missing_rspec = false
28
- cryptum_modules.each do |cryptum_path|
29
- spec_test_for_mod = "#{File.dirname(cryptum_path)}/#{File.basename(cryptum_path).split('.').first}_spec.rb"
30
-
31
- next unless spec_tests.grep(/#{spec_test_for_mod}/).empty?
28
+ cryptum_modules.each do |mod_path|
29
+ spec_dirname_for_mod = "spec/#{File.dirname(mod_path)}"
30
+ spec_test_for_mod = "#{File.basename(mod_path).split('.').first}_spec.rb"
31
+ spec_path_for_mod = "#{spec_dirname_for_mod}/#{spec_test_for_mod}"
32
+ next unless spec_tests.grep(/#{spec_path_for_mod}/).empty?
32
33
 
33
34
  missing_rspec = true
34
- cryptum_mod_dir = File.dirname(cryptum_path)
35
- spec_test = "spec/#{cryptum_mod_dir}/#{spec_test_for_mod}"
36
- error_msg = "ERROR: RSpec: #{spec_test} missing for Cryptum Module: #{cryptum_path}"
35
+ error_msg = "ERROR: No RSpec: #{spec_path_for_mod} for Cryptum Module: #{mod_path}"
37
36
  # Display error message in red (octal encoded ansi sequence)
38
37
  puts "\001\e[1m\002\001\e[31m\002#{error_msg}\001\e[0m\002"
39
38
  end
@@ -29,5 +29,11 @@ module Cryptum
29
29
  Curses.close_screen
30
30
  raise e
31
31
  end
32
+
33
+ # Display a List of Every UI Module
34
+
35
+ public_class_method def self.help
36
+ constants.sort
37
+ end
32
38
  end
33
39
  end
@@ -88,11 +88,19 @@ module Cryptum
88
88
  last_order = order_history_meta.select do |order|
89
89
  order if order[:color] == 'yellow'
90
90
  end.last
91
+
91
92
  last_purchase_price = 0.0
92
93
  last_purchase_price = last_order[:price].to_f if last_order
93
94
 
94
95
  limit_price = last_purchase_price - quote_increment.to_f if last_purchase_price.positive? && last_purchase_price < limit_price
95
96
 
97
+ # Debug last order
98
+ File.open('/tmp/cryptum-errors.txt', 'a') do |f|
99
+ f.puts "Last Order: #{last_order}"
100
+ f.puts "Last Purchase Price: #{last_purchase_price}"
101
+ f.puts "Limit Price (Should be <= quote_increment-- ^): #{limit_price}"
102
+ end
103
+
96
104
  price = format(
97
105
  "%0.#{fiat_smallest_decimal}f",
98
106
  limit_price
@@ -312,6 +320,7 @@ module Cryptum
312
320
  oh_meta_sold_arr = order_history_meta.select do |ohm|
313
321
  ohm[:color].to_sym == :green && ohm.key?(:done_at)
314
322
  end
323
+ order_hist_meta_sold = oh_meta_sold_arr.length
315
324
 
316
325
  # Snag all sold orders within past 24 hrs
317
326
  ohm_sold_twenty_four_arr = []
@@ -320,12 +329,13 @@ module Cryptum
320
329
  Time.parse(o[:done_at]) >= twenty_four_hrs_ago
321
330
  end
322
331
  end
323
- order_hist_meta_sold = ohm_sold_twenty_four_arr.length
332
+ order_hist_meta_sold_twenty_four = ohm_sold_twenty_four_arr.length
324
333
 
325
334
  # Snag all expired orders
326
335
  oh_meta_expired_arr = order_history_meta.select do |ohm|
327
336
  ohm[:color].to_sym == :white && ohm.key?(:done_at)
328
337
  end
338
+ order_hist_meta_expired = oh_meta_expired_arr.length
329
339
 
330
340
  # Snag all expired orders within past 24 hrs
331
341
  ohm_expire_twenty_four_arr = []
@@ -334,9 +344,20 @@ module Cryptum
334
344
  Time.parse(o[:done_at]) >= twenty_four_hrs_ago
335
345
  end
336
346
  end
337
- order_hist_meta_expired = ohm_expire_twenty_four_arr.length
347
+ order_hist_meta_24h_expired = ohm_expire_twenty_four_arr.length
348
+
349
+ # Calculate total gains and gains within past 24 hrs
350
+ gains_sum = oh_meta_sold_arr.map do |ohms|
351
+ ohms[:profit].to_f
352
+ end.sum
353
+
354
+ gains_out = Cryptum.beautify_large_number(
355
+ value: format(
356
+ '%0.2f',
357
+ gains_sum
358
+ )
359
+ )
338
360
 
339
- # Calculate gains within past 24 hrs
340
361
  gains_24h_sum = ohm_sold_twenty_four_arr.map do |ohms|
341
362
  ohms[:profit].to_f
342
363
  end.sum
@@ -351,7 +372,23 @@ module Cryptum
351
372
  total_to_sell = order_history.select do |oh|
352
373
  oh[:status].to_sym == :open && oh[:side].to_sym == :sell
353
374
  end.length
375
+
354
376
  event_history.open_sell_orders = total_to_sell
377
+ oh_meta_total_selling_profit_arr = order_history_meta.select do |ohm|
378
+ ohm[:color].to_sym == :yellow
379
+ end
380
+
381
+ total_selling_profit = oh_meta_total_selling_profit_arr.map do |ohms|
382
+ ohms[:profit].to_f
383
+ end.sum
384
+
385
+ total_selling_profit_out = Cryptum.beautify_large_number(
386
+ value: format(
387
+ '%0.2f',
388
+ total_selling_profit
389
+ )
390
+ )
391
+
355
392
  # TODO: when event_history.open_sell_orders > event_history.open_sell_orders_max
356
393
  # Capture highest amount to sell, cancel all orders, and create _one_ limit sell
357
394
  # order set to a price of the previously captured highest amount to sell.
@@ -524,7 +561,10 @@ module Cryptum
524
561
  string: ''.ljust(col_just1, ' ')
525
562
  )
526
563
 
527
- header_str = "24 HR SUMMARY | Open Sell Orders: #{total_to_sell} | Sold: #{order_hist_meta_sold} | Gains: $#{gains_24h_out} | Expired: #{order_hist_meta_expired}"
564
+ header_str = "SELLING: #{total_to_sell} w tProf: $#{total_selling_profit_out} | "
565
+ header_str += "SOLD 24h: #{order_hist_meta_sold_twenty_four} Tot: #{order_hist_meta_sold} | "
566
+ header_str += "GAINS 24h: $#{gains_24h_out} Tot: $#{gains_out} | "
567
+ header_str += "EXPIRED 24h: #{order_hist_meta_24h_expired} Tot: #{order_hist_meta_expired}"
528
568
  order_execute_win.setpos(
529
569
  out_line_no,
530
570
  Cryptum::UI.col_center(str: header_str)
@@ -537,14 +577,14 @@ module Cryptum
537
577
  string: header_str
538
578
  )
539
579
 
540
- order_execute_win.setpos(out_line_no, Cryptum::UI.col_fourth)
541
- order_execute_win.clrtoeol
542
- Cryptum::UI.colorize(
543
- ui_win: order_execute_win,
544
- color: header_color,
545
- style: header_style,
546
- string: ''.ljust(col_just4, ' ')
547
- )
580
+ # order_execute_win.setpos(out_line_no, Cryptum::UI.col_fourth)
581
+ # order_execute_win.clrtoeol
582
+ # Cryptum::UI.colorize(
583
+ # ui_win: order_execute_win,
584
+ # color: header_color,
585
+ # style: header_style,
586
+ # string: ''.ljust(col_just4, ' ')
587
+ # )
548
588
 
549
589
  # ROW 11
550
590
  out_line_no += 1
@@ -456,7 +456,9 @@ module Cryptum
456
456
  string: ''.ljust(col_just1, ' ')
457
457
  )
458
458
 
459
- header_str = "CYCLE SUMMARY | Risk Allocated: $#{order_plan_volume_out} | Profit: $#{order_plan_profit_sum_out} | #{order_plan_exec_percent}% Done"
459
+ header_str = "RISK ALLOCATED: $#{order_plan_volume_out} | "
460
+ header_str += "PROJECTED PROFIT: $#{order_plan_profit_sum_out} | "
461
+ header_str += "#{order_plan_exec_percent}% DONE"
460
462
  order_plan_win.setpos(
461
463
  out_line_no,
462
464
  Cryptum::UI.col_center(str: header_str)
@@ -469,14 +471,14 @@ module Cryptum
469
471
  string: header_str
470
472
  )
471
473
 
472
- order_plan_win.setpos(out_line_no, Cryptum::UI.col_fourth)
473
- order_plan_win.clrtoeol
474
- Cryptum::UI.colorize(
475
- ui_win: order_plan_win,
476
- color: header_color,
477
- style: header_style,
478
- string: ''.ljust(col_just4, ' ')
479
- )
474
+ # order_plan_win.setpos(out_line_no, Cryptum::UI.col_fourth)
475
+ # order_plan_win.clrtoeol
476
+ # Cryptum::UI.colorize(
477
+ # ui_win: order_plan_win,
478
+ # color: header_color,
479
+ # style: header_style,
480
+ # string: ''.ljust(col_just4, ' ')
481
+ # )
480
482
  end
481
483
 
482
484
  # ROW 11
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptum
4
- VERSION = '0.0.370'
4
+ VERSION = '0.0.373'
5
5
  end
@@ -3,8 +3,8 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe Cryptum::Event::History do
6
- it 'should display information for existing help method' do
7
- help_response = Cryptum::Event::History
8
- expect(help_response).to respond_to :help
6
+ it 'should respond to instantiation' do
7
+ init_response = Cryptum::Event::History
8
+ expect(init_response).to respond_to :new
9
9
  end
10
10
  end
@@ -3,8 +3,8 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe Cryptum::Option::Choice do
6
- it 'should return data for help method' do
7
- help_response = Cryptum::Option::Choice.help
8
- expect(help_response).not_to be_nil
6
+ it 'should respond to instantiation' do
7
+ init_response = Cryptum::Option::Choice
8
+ expect(init_response).to respond_to :new
9
9
  end
10
10
  end
@@ -3,8 +3,8 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe Cryptum::OrderBook::Indicator do
6
- it 'should display information for existing help method' do
7
- help_response = Cryptum::OrderBook::Indicator
8
- expect(help_response).to respond_to :help
6
+ it 'should respond to instantiation' do
7
+ init_response = Cryptum::OrderBook::Indicator
8
+ expect(init_response).to respond_to :new
9
9
  end
10
10
  end
@@ -3,8 +3,8 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe Cryptum::UI::KeyPressEvent do
6
- it 'should display information for existing help method' do
7
- help_response = Cryptum::UI::KeyPressEvent
8
- expect(help_response).to respond_to :help
6
+ it 'should respond to instantiation' do
7
+ init_response = Cryptum::UI::KeyPressEvent
8
+ expect(init_response).to respond_to :new
9
9
  end
10
10
  end
@@ -3,8 +3,8 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe Cryptum::UI::TerminalWindow do
6
- it 'should display information for existing help method' do
7
- help_response = Cryptum::UI::TerminalWindow
8
- expect(help_response).to respond_to :help
6
+ it 'should respond to instantiation' do
7
+ init_response = Cryptum::UI::TerminalWindow
8
+ expect(init_response).to respond_to :new
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.370
4
+ version: 0.0.373
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-23 00:00:00.000000000 Z
11
+ date: 2023-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 2.4.9
33
+ version: 2.4.10
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 2.4.9
40
+ version: 2.4.10
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler-audit
43
43
  requirement: !ruby/object:Gem::Requirement