cryptum 0.0.430 → 0.0.432

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: 2a529bc6041458959ded98c7d5a487f978a1ca4da216ef27006daa74b4882fdf
4
- data.tar.gz: be3358d93281401821f0192b837717d343872a58c1b0eb759056ce8d00387a00
3
+ metadata.gz: 3f84b25db89b6e6e4cf9b50130516a44e64eba480a1e567aba5619bae57b118d
4
+ data.tar.gz: ea62f0ff2be5facfb7823012ed7b28a7590b8fa046d378f9836f7a0fa91e9838
5
5
  SHA512:
6
- metadata.gz: 7f1cad0e69a09e9754340649c6457e9bb7abbac52b6a6f2e15158ad7b6b8f1a2a667ad4afacdc9b460b30828bfa9a44a0cd4d1bdce40dd25446d39c71b1d95d8
7
- data.tar.gz: 002ad29184c1b14f4dd6a6ea6bd04fd836a9d08d3db03d76e401353f4ade3acf9c05edae3045c61f104975fbc1fd536d9217ae90f3da486098699c338f1e26bf
6
+ metadata.gz: 8976c39e002384261258f717f436a77376dbfe1af3c3173d70f9905ea9c55007988c24fc3f990b4486145e7ddbeb1c706d6414fdb1cc9be72f0e39efb8bcb68c
7
+ data.tar.gz: 1966b1868954202ee6151ac1a0bf6a4e7d03915925fdb4b0da075120e2bfdd8a0fa344a8ade889cec6b95ffa6f2f25e11f31ffc57eef0c89f6ab6e2919bba4d6
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.4'
15
- gem 'bundler', '>=2.4.12'
15
+ gem 'bundler', '>=2.4.13'
16
16
  gem 'bundler-audit', '0.9.1'
17
17
  gem 'curses', '1.4.4'
18
18
  gem 'eventmachine', '1.2.7'
@@ -28,7 +28,7 @@ gem 'rest-client', '2.1.0'
28
28
  gem 'rspec', '3.12.0'
29
29
  gem 'rubocop', '1.50.2'
30
30
  gem 'rubocop-rake', '0.6.0'
31
- gem 'rubocop-rspec', '2.20.0'
31
+ gem 'rubocop-rspec', '2.22.0'
32
32
  gem 'ruby-prof', '1.6.3'
33
33
  gem 'rvm', '1.11.3.9'
34
34
  gem 'sinatra', '3.0.6'
@@ -13,7 +13,7 @@ module Cryptum
13
13
  terminal_win = opts[:terminal_win]
14
14
  event_history = opts[:event_history]
15
15
 
16
- terminal_win.key_press_event.key_w = false
16
+ terminal_win.key_press_event.key_w = false unless terminal_win.nil?
17
17
  order_book_file = event_history.order_book[:path]
18
18
 
19
19
  File.write(
@@ -108,7 +108,7 @@ module Cryptum
108
108
  )
109
109
  recalc_op = event_history.recalculate_order_plan
110
110
  order_plan = event_history.order_book[:order_plan]
111
- terminal_win.key_press_event.key_w = true if (recalc_op || order_plan.empty?) &&
111
+ terminal_win.key_press_event.key_w = true if (event_history.order_ready || recalc_op || order_plan.empty?) &&
112
112
  !event_history.red_pill
113
113
  event_history.recalculate_order_plan = false
114
114
  end
data/lib/cryptum/log.rb CHANGED
@@ -68,7 +68,7 @@ module Cryptum
68
68
  logger.level = Logger::WARN
69
69
  else
70
70
  level_error = "ERROR: Invalid log level. Valid options are:\n"
71
- level_error += ":info\n:warn\n:unknown\n:fatal\n:error\n:debug"
71
+ level_error += ":debug\n:error\n:fatal\n:info\n:learning\n:unknown\n:warn\n"
72
72
  raise level_error
73
73
  end
74
74
 
@@ -70,6 +70,24 @@ module Cryptum
70
70
  File.read(order_book_file),
71
71
  symbolize_names: true
72
72
  )
73
+
74
+ # Only keep order history meta for those hashes
75
+ # that exist in the last order history response
76
+ # :white ones will be kept for at least 24 hrs
77
+ # and handled via Cryptum::OrderBook::MarketTrend.reset
78
+ # This exist primarily to clean up "zombie" meta
79
+ # data entries if the bot crashes for whatever reason.
80
+ order_book[:order_history_meta].keep_if do |ohm|
81
+ order_book[:order_history].find do |oh|
82
+ (oh[:id] == ohm[:buy_order_id] || oh[:id] == ohm[:sell_order_id]) && (
83
+ ohm[:color].to_sym == :cyan ||
84
+ ohm[:color].to_sym == :green ||
85
+ ohm[:color].to_sym == :magenta ||
86
+ ohm[:color].to_sym == :red ||
87
+ ohm[:color].to_sym == :yellow
88
+ )
89
+ end
90
+ end
73
91
  end
74
92
 
75
93
  event_history = Cryptum::Event::History.new(
@@ -67,22 +67,16 @@ module Cryptum
67
67
  # TO AVOID TICKER PRICE SYNCING ISSUES.
68
68
  event_history = opts[:event_history]
69
69
 
70
- # order_history = event_history.order_book[:order_history]
71
- order_history_meta = event_history.order_book[:order_history_meta]
72
-
73
70
  # Only retain past 24 hours of
74
71
  # order history meta for expired
75
72
  # keep open limit sell orders indefintely
76
73
  before_twenty_four_hrs_ago = Time.now - 86_400
77
- order_history_meta.delete_if do |ohm|
74
+ event_history.order_book[:order_history_meta].delete_if do |ohm|
78
75
  next unless ohm[:color] == 'white'
79
76
 
80
77
  Time.parse(ohm[:done_at]) < before_twenty_four_hrs_ago
81
78
  end
82
79
 
83
- # Write order_history_meta back to event_history object
84
- event_history.order_book[:order_history_meta] = order_history_meta
85
-
86
80
  # Reset Market Trend Counter
87
81
  event_history.order_book[:market_trend][:buy] = 0
88
82
  event_history.order_book[:market_trend][:sell] = 0
@@ -23,13 +23,7 @@ module Cryptum
23
23
  Cryptum::Log.append(level: :fatal, msg: e, which_self: self, event_history: event_history)
24
24
  exit 1
25
25
  ensure
26
- if event_history
27
- order_book_file = event_history.order_book[:path]
28
- File.write(
29
- order_book_file,
30
- JSON.pretty_generate(event_history.order_book)
31
- )
32
- end
26
+ Cryptum::Event::OrderBook.write(event_history: event_history) if event_history
33
27
  end
34
28
 
35
29
  # Display a List of Every UI Module
@@ -86,9 +86,7 @@ module Cryptum
86
86
 
87
87
  # If price is greater than the previous order,
88
88
  # force it to be slightly less
89
- last_order = order_history_meta.select do |order|
90
- order if order[:color] == 'yellow'
91
- end.last
89
+ last_order = order_history_meta.reverse.find { |o| o[:color] == 'yellow' }
92
90
 
93
91
  last_purchase_price = 0.0
94
92
  last_purchase_price = last_order[:price].to_f if last_order
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptum
4
- VERSION = '0.0.430'
4
+ VERSION = '0.0.432'
5
5
  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.430
4
+ version: 0.0.432
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-04-27 00:00:00.000000000 Z
11
+ date: 2023-05-12 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.12
33
+ version: 2.4.13
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.12
40
+ version: 2.4.13
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler-audit
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -254,14 +254,14 @@ dependencies:
254
254
  requirements:
255
255
  - - '='
256
256
  - !ruby/object:Gem::Version
257
- version: 2.20.0
257
+ version: 2.22.0
258
258
  type: :runtime
259
259
  prerelease: false
260
260
  version_requirements: !ruby/object:Gem::Requirement
261
261
  requirements:
262
262
  - - '='
263
263
  - !ruby/object:Gem::Version
264
- version: 2.20.0
264
+ version: 2.22.0
265
265
  - !ruby/object:Gem::Dependency
266
266
  name: ruby-prof
267
267
  requirement: !ruby/object:Gem::Requirement
@@ -537,7 +537,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
537
537
  - !ruby/object:Gem::Version
538
538
  version: '0'
539
539
  requirements: []
540
- rubygems_version: 3.4.12
540
+ rubygems_version: 3.4.13
541
541
  signing_key:
542
542
  specification_version: 4
543
543
  summary: Coinbase Pro High-Frequency Trading Bot