Skip to content

WS2 - Order book management code fails checksum audit #106

Description

@casper

Issue type

  • bug
  • missing functionality
  • performance
  • feature request

Brief description

When running the order_book_checksums.rb code in the examples/ws/v2 folder with :checksum_audit => true, the logger will frequently report checksum mismatch.

Something is not working properly with the internal order book management code.

Steps to reproduce

Run this slightly modified order_book_checksums.rb code, which will quickly highlight the bug:

require_relative '../../../lib/bitfinex.rb'

client = Bitfinex::WSv2.new({
  :url => ENV['WS_URL'],
  :manage_order_books => true,
  :checksum_audit     => true
})

client.on(:order_book) do |sym, msg|
  p "recv order book message for symbol #{sym}"
  p msg
end

client.on(:open) do
  client.subscribe_order_book('fUSD', 'P4', '25')
end

client.on(:checksum) do |sym, msg|
  puts
  puts "CHECKSUM"
  pp msg
  puts
end

client.on(:error) do |err|
  pp err
  exit
end

client.open!
Additional Notes:

Example output when running the above code:

...
CHECKSUM
[323049, "cs", -1108044634]

E, [2024-01-07T22:08:50.997911 #16770] ERROR -- ws2: OB checksum mismatch, have -961054908 want -1108044634 [fUSD
"OB checksum mismatch, have -961054908 want -1108044634 [fUSD"
I, [2024-01-07T22:08:50.998627 #16770]  INFO -- ws2: client closed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions