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 +4 -4
- data/Gemfile +1 -1
- data/cryptum.gemspec +6 -7
- data/lib/cryptum/ui/key_press_event.rb +6 -0
- data/lib/cryptum/ui/order_execution.rb +52 -12
- data/lib/cryptum/ui/order_plan.rb +11 -9
- data/lib/cryptum/version.rb +1 -1
- data/spec/lib/cryptum/event/history_spec.rb +3 -3
- data/spec/lib/cryptum/option/choice_spec.rb +3 -3
- data/spec/lib/cryptum/order_book/indicator_spec.rb +3 -3
- data/spec/lib/cryptum/ui/key_press_event_spec.rb +3 -3
- data/spec/lib/cryptum/ui/terminal_window_spec.rb +3 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad583e315522b51751a336aff7cff06e1f9efa4a6b0227ebaf21149835ef03f4
|
4
|
+
data.tar.gz: e269e281bb9de22cf6049cb965e20566d0a0fcce00d45ef7d7c94129017b54f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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 |
|
29
|
-
|
30
|
-
|
31
|
-
|
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
|
-
|
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
|
@@ -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
|
-
|
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
|
-
|
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 = "
|
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
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
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 = "
|
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
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
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
|
data/lib/cryptum/version.rb
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Cryptum::Event::History do
|
6
|
-
it 'should
|
7
|
-
|
8
|
-
expect(
|
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
|
7
|
-
|
8
|
-
expect(
|
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
|
7
|
-
|
8
|
-
expect(
|
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
|
7
|
-
|
8
|
-
expect(
|
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
|
7
|
-
|
8
|
-
expect(
|
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.
|
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-
|
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.
|
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.
|
40
|
+
version: 2.4.10
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler-audit
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|