lib/cryptum/event/history.rb in cryptum-0.0.373 vs lib/cryptum/event/history.rb in cryptum-0.0.374
- old
+ new
@@ -42,11 +42,11 @@
:time_between_orders_min,
:time_between_orders_reset,
:recalculate_order_plan
def initialize(opts = {})
- # option_choice = opts[:option_choice]
+ option_choice = opts[:option_choice]
start_time = opts[:start_time]
order_book = opts[:order_book]
self.bullish_trend = true
self.first_event = true
@@ -76,23 +76,122 @@
self.red_pill = false
self.recalculate_order_plan = false
self.start_time = start_time
# -------------------------------------------------- #
- # SAUCE 4
- # TODO: develop algorithm to calculate
- # FAST BUY && SLOW BUY values taking
- # market_trend_reset values into account
+ # SAUCE 3 (SAUCE 4 RELATES TO SAUCE 3)
+ case option_choice.market_trend_reset_label
+ when '1W'
+ # SLOW BUY = 1 day
+ self.time_between_orders_max = 86_400
- # FAST BUY = 4 hours
- self.time_between_orders = 14_400
- self.time_between_orders_reset = time_between_orders
+ # FAST BUY = 4 hours
+ self.time_between_orders = 14_400
+ self.time_between_orders_reset = time_between_orders
- # SLOW BUY = 1 day
- self.time_between_orders_max = 86_400
+ # 1 hour
+ self.time_between_orders_min = 3_600
+ when '1D'
+ # SLOW BUY = 4 hours
+ self.time_between_orders_max = 14_400
- # 1 hour
- self.time_between_orders_min = 3_600
+ # FAST BUY = 3 hours
+ self.time_between_orders = 10_800
+ self.time_between_orders_reset = time_between_orders
+
+ # 45 minutes
+ self.time_between_orders_min = 2_700
+ when '4h'
+ # SLOW BUY = 3 hours
+ self.time_between_orders_max = 10_800
+
+ # FAST BUY = 2 hours
+ self.time_between_orders = 7_200
+ self.time_between_orders_reset = time_between_orders
+
+ # 30 minutes
+ self.time_between_orders_min = 1_800
+ when '3h'
+ # SLOW BUY = 2 hours
+ self.time_between_orders_max = 7_200
+
+ # FAST BUY = 1 hour
+ self.time_between_orders = 3_600
+ self.time_between_orders_reset = time_between_orders
+
+ # 15 minutes
+ self.time_between_orders_min = 900
+ when '2h'
+ # SLOW BUY = 1 hour
+ self.time_between_orders_max = 3_600
+
+ # FAST BUY = 45 minutes
+ self.time_between_orders = 2_700
+ self.time_between_orders_reset = time_between_orders
+
+ # 5 minutes
+ self.time_between_orders_min = 300
+ when '1h'
+ # SLOW BUY = 45 minutes
+ self.time_between_orders_max = 2_700
+
+ # FAST BUY = 30 minutes
+ self.time_between_orders = 1_800
+ self.time_between_orders_reset = time_between_orders
+
+ # 3 minutes
+ self.time_between_orders_min = 180
+ when '45m'
+ # SLOW BUY = 30 minutes
+ self.time_between_orders_max = 1_800
+
+ # FAST BUY = 15 minutes
+ self.time_between_orders = 900
+ self.time_between_orders_reset = time_between_orders
+
+ # 1 minute
+ self.time_between_orders_min = 60
+ when '30m'
+ # SLOW BUY = 15 minutes
+ self.time_between_orders_max = 900
+
+ # FAST BUY = 5 minutes
+ self.time_between_orders = 300
+ self.time_between_orders_reset = time_between_orders
+
+ # 1 minute
+ self.time_between_orders_min = 60
+ when '15m'
+ # SLOW BUY = 5 minutes
+ self.time_between_orders_max = 300
+
+ # FAST BUY = 3 minutes
+ self.time_between_orders = 180
+ self.time_between_orders_reset = time_between_orders
+
+ # 1 minute
+ self.time_between_orders_min = 60
+ when '5m'
+ # SLOW BUY = 3 minutes
+ self.time_between_orders_max = 180
+
+ # FAST BUY = 1 minute
+ self.time_between_orders = 60
+ self.time_between_orders_reset = time_between_orders
+
+ # 1 minute
+ self.time_between_orders_min = 60
+ when '3m', '1m'
+ # SLOW BUY = 1 minute
+ self.time_between_orders_max = 60
+
+ # FAST BUY = 1 minute
+ self.time_between_orders = 60
+ self.time_between_orders_reset = time_between_orders
+
+ # 1 minute
+ self.time_between_orders_min = 60
+ end
# -------------------------------------------------- #
end
rescue Interrupt
# Exit Gracefully if CTRL+C is Pressed During Session
Cryptum.exit_gracefully(which_self: self)