Hey folks, anyone's bot keep a local cache of the orderbook for a token/tokens? If so, any tips on how to properly detect staleness in this book? This should be possible with the hashes that get sent around, but the hashes require 'Last Trade Price", which isn't always included definitively in all WS messages, e.g. the price change event. There is a 'last trade price' event, but it's not nearly as frequent as the price change events, so you deal with lag if you just grab it then. You can 'kind of' derive it, but it's not always clear what metric PM is using in the hash depending on the change- cancellations, fills, etc. the complement token trading. Would love if someone has authoritatively solved this problem to chat about it some.
Hey folks, anyone's bot keep a local cache of the orderbook for a token/tokens? If so, any tips on how to properly detect staleness in this book? This should be possible with the hashes that get sent around, but the hashes require 'Last Trade Price", which isn't always included definitively in all WS messages, e.g. the price change event. There is a 'last trade price' event, but it's not nearly as frequent as the price change events, so you deal with lag if you just grab it then. You can 'kind of' derive it, but it's not always clear what metric PM is using in the hash depending on the change- cancellations, fills, etc. the complement token trading. Would love if someone has authoritatively solved this problem to chat about it some.