cryptum 0.0.323 → 0.0.325

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e522f21a65cef1a50c40d23d8a8414bb497a0205e0bf146e74d9179c56a81ef0
4
- data.tar.gz: 02a029b2056b507ce6d9aca8538a6697e7d12208b0f7d66fc35babdb9ea27cc3
3
+ metadata.gz: 10328af02cf519e0d0909c39eebeef68636167861ce9c29f853cf3226aa3fe5f
4
+ data.tar.gz: 8acc998468938e4b9b368ebb23dcfdbe50e1f2365095be73ba2b4f3b552e8ef9
5
5
  SHA512:
6
- metadata.gz: f3973aa9521539f46d831cc0677dce3684b76c5012670c0ea68b0348f1fd4729a823883f275d6ce35a241584c2d2704169c97b3eb87737c47bf5393a0a842343
7
- data.tar.gz: c82fc92fa7f30b95220d032ebf5c64f1b475711cd94d5d2341eec49636576ef4e187ed231cd9a30e93cdd1adf5b5ec30ff111839c07cba481d0f687ae7f111a1
6
+ metadata.gz: 033467601d7fbfabb46747e51093f14c28320ad5cdb3fed2b35a5d75d0b576d7bb4d44de9b0239cba3a292b61fda8f99a1c1976e00225c46bae7cacfd677333f
7
+ data.tar.gz: bcaf51a3743fcabab91e43c539d558d9d281fbfc3e79bc1d7ff35b4ca46b44f754106e82f392ab27839f43915bdff1076c32ec0d2bdd18adb2db18c1acae93f4
@@ -77,6 +77,12 @@ module Cryptum
77
77
  self.recalculate_order_plan = false
78
78
  self.start_time = start_time
79
79
 
80
+ # -------------------------------------------------- #
81
+ # SAUCE 4
82
+ # TODO: develop algorithm to calculate
83
+ # FAST BUY && SLOW BUY values taking
84
+ # market_trend_reset values into account
85
+
80
86
  # FAST BUY = 10 minutes
81
87
  self.time_between_orders = 600
82
88
  self.time_between_orders_reset = time_between_orders
@@ -86,6 +92,7 @@ module Cryptum
86
92
 
87
93
  # 5 seconds
88
94
  self.time_between_orders_min = 5
95
+ # -------------------------------------------------- #
89
96
  end
90
97
  rescue Interrupt
91
98
  # Exit Gracefully if CTRL+C is Pressed During Session
@@ -148,7 +148,6 @@ module Cryptum
148
148
  option_choice = opts[:option_choice]
149
149
  env = opts[:env]
150
150
 
151
- puts `#{option_choice.driver_name} --help`
152
151
  puts "\n#{option_choice.driver_name} Supports the Following Products:"
153
152
  products = Cryptum::API.get_products(
154
153
  option_choice: option_choice,
@@ -62,57 +62,57 @@ module Cryptum
62
62
  raise e
63
63
  end
64
64
 
65
- public_class_method def self.reset(opts = {})
66
- # IT IS ABSOLUTELY CRITICAL THIS METHOD IS AS FAST AS POSSIBLE
67
- # TO AVOID TICKER PRICE SYNCING ISSUES.
68
- event_history = opts[:event_history]
69
-
70
- # order_history = event_history.order_book[:order_history]
71
- # order_history_meta = event_history.order_book[:order_history_meta]
72
-
73
- # Only retain past 24 hours of
74
- # order history meta for bought, sold, and expired
75
- # keep open limit sell orders indefintely
76
- # before_twenty_four_hrs_ago = Time.now - 86_400
77
- # order_history_meta.delete_if do |ohm|
78
- # order_history.find do |oh|
79
- # next unless oh[:done_at]
80
-
81
- # Time.parse(oh[:done_at]) < before_twenty_four_hrs_ago && (
82
- # oh[:id] == ohm[:buy_order_id] ||
83
- # oh[:id] == ohm[:sell_order_id]
84
- # ) && (
85
- # ohm[:color].to_sym == :white ||
86
- # ohm[:color].to_sym == :green ||
87
- # ohm[:color].to_sym == :cyan ||
88
- # ohm[:color].to_sym == :red
89
- # )
90
- # end
91
- # end
92
-
93
- # Only keep order history meta for those
94
- # hashes that exist in the last order history
95
- # response
96
- # order_history_meta.keep_if do |ohm|
97
- # order_history.find do |oh|
98
- # (oh[:id] == ohm[:buy_order_id] || oh[:id] == ohm[:sell_order_id]) && (
99
- # ohm[:color].to_sym == :white ||
100
- # ohm[:color].to_sym == :green ||
101
- # ohm[:color].to_sym == :yellow
102
- # )
103
- # end
104
- # end
105
- # event_history.order_book[:order_history_meta] = order_history_meta
106
-
107
- # Reset Market Trend Counter
108
- event_history.order_book[:market_trend][:buy] = 0
109
- event_history.order_book[:market_trend][:sell] = 0
110
- event_history.order_book[:last_trend_reset] = Time.now.strftime(
111
- '%Y-%m-%d %H:%M:%S.%N%z'
112
- )
113
- rescue StandardError => e
114
- raise e
115
- end
65
+ # public_class_method def self.reset(opts = {})
66
+ # # IT IS ABSOLUTELY CRITICAL THIS METHOD IS AS FAST AS POSSIBLE
67
+ # # TO AVOID TICKER PRICE SYNCING ISSUES.
68
+ # event_history = opts[:event_history]
69
+
70
+ # # order_history = event_history.order_book[:order_history]
71
+ # # order_history_meta = event_history.order_book[:order_history_meta]
72
+
73
+ # # Only retain past 24 hours of
74
+ # # order history meta for bought, sold, and expired
75
+ # # keep open limit sell orders indefintely
76
+ # # before_twenty_four_hrs_ago = Time.now - 86_400
77
+ # # order_history_meta.delete_if do |ohm|
78
+ # # order_history.find do |oh|
79
+ # # next unless oh[:done_at]
80
+
81
+ # # Time.parse(oh[:done_at]) < before_twenty_four_hrs_ago && (
82
+ # # oh[:id] == ohm[:buy_order_id] ||
83
+ # # oh[:id] == ohm[:sell_order_id]
84
+ # # ) && (
85
+ # # ohm[:color].to_sym == :white ||
86
+ # # ohm[:color].to_sym == :green ||
87
+ # # ohm[:color].to_sym == :cyan ||
88
+ # # ohm[:color].to_sym == :red
89
+ # # )
90
+ # # end
91
+ # # end
92
+
93
+ # # Only keep order history meta for those
94
+ # # hashes that exist in the last order history
95
+ # # response
96
+ # # order_history_meta.keep_if do |ohm|
97
+ # # order_history.find do |oh|
98
+ # # (oh[:id] == ohm[:buy_order_id] || oh[:id] == ohm[:sell_order_id]) && (
99
+ # # ohm[:color].to_sym == :white ||
100
+ # # ohm[:color].to_sym == :green ||
101
+ # # ohm[:color].to_sym == :yellow
102
+ # # )
103
+ # # end
104
+ # # end
105
+ # # event_history.order_book[:order_history_meta] = order_history_meta
106
+
107
+ # # Reset Market Trend Counter
108
+ # event_history.order_book[:market_trend][:buy] = 0
109
+ # event_history.order_book[:market_trend][:sell] = 0
110
+ # event_history.order_book[:last_trend_reset] = Time.now.strftime(
111
+ # '%Y-%m-%d %H:%M:%S.%N%z'
112
+ # )
113
+ # rescue StandardError => e
114
+ # raise e
115
+ # end
116
116
 
117
117
  # Display Usage for this Module
118
118
 
@@ -72,7 +72,7 @@ module Cryptum
72
72
  ui_win: order_timer_win,
73
73
  color: :white,
74
74
  style: :bold,
75
- string: "#{option_choice.market_trend_reset_label} Market Trend Reset: #{trend_countdown}"
75
+ string: "#{option_choice.market_trend_reset_label} M. Trend Rst: #{trend_countdown}"
76
76
  )
77
77
 
78
78
  # COLUMN 2
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptum
4
- VERSION = '0.0.323'
4
+ VERSION = '0.0.325'
5
5
  end
@@ -216,7 +216,13 @@ module Cryptum
216
216
  end
217
217
 
218
218
  EM.add_periodic_timer(option_choice.market_trend_reset) do
219
- Cryptum::OrderBook::MarketTrend.reset(event_history: event_history)
219
+ # NOTE: To ensure the integrity of event_history is maintained,
220
+ # changes to its contenta _MUST_ stay in thos block.
221
+ event_history.order_book[:market_trend][:buy] = 0
222
+ event_history.order_book[:market_trend][:sell] = 0
223
+ event_history.order_book[:last_trend_reset] = Time.now.strftime(
224
+ '%Y-%m-%d %H:%M:%S.%N%z'
225
+ )
220
226
 
221
227
  # Reload Bot Conf (i.e. Risk Allocation)
222
228
  # Recalculate Order Plan, and Write to File
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.323
4
+ version: 0.0.325
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-13 00:00:00.000000000 Z
11
+ date: 2022-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable