lib/cryptum/ui/ticker.rb in cryptum-0.0.334 vs lib/cryptum/ui/ticker.rb in cryptum-0.0.335
- old
+ new
@@ -26,13 +26,24 @@
last_ticker_price = order_book[:ticker_price].to_f
second_to_last_ticker_price = order_book[:ticker_price_second_to_last].to_f
sequence = event[:sequence].to_i
last_sequence = order_book[:sequence].to_i
+ order_book[:sequence] = sequence
- raise "ERROR: Sequence Order Mismatch - #{last_sequence} #{sequence}" unless sequence >= last_sequence
+ return unless sequence >= last_sequence
- order_book[:sequence] = sequence
+ if last_sequence + 1 < sequence
+ sequence_diff = sequence - last_sequence
+ f.puts Time.now.strftime('%Y-%m-%d %H:%M:%S.%N %z')
+ f.puts "Module: #{self}"
+ f.puts 'Messages likely dropped:'
+ f.puts "This Sequence: #{sequence}"
+ f.puts "Last Sequence: #{last_sequence}"
+ f.puts "Sequence Diff: #{sequence_diff}\n\n\n"
+ end
+ # raise "ERROR: Sequence Order Mismatch - #{last_sequence} #{sequence}" unless sequence >= last_sequence
+
open_24h = event[:open_24h].to_f
order_book[:open_24h] = open_24h
open_24h_out = "#{Cryptum.open_symbol} #{fiat_symbol}#{Cryptum.beautify_large_number(value: format("%0.#{fiat_smallest_decimal}f", open_24h))}"