It's possible that relying on a single events query during the initial sync of the liq-bot will either fail or cause wrong data after a market (e.g. ETH) has more than 10,000 trading events.
We need to deal with this before that happens. I see a few potential ways:
Implement batching during sync, so that only a fixed amount of events are retreived. Batching can be done by ranges of position ids because they are contiguous (incremented from one) and indexed (are a topic).
Sync from subgraph (but the subgraph may still be wrong at that point, and it's better to not depend on it for liquidations & alerting liveness).
Find a way to limit query to only the last event for an account (for each type of event), and sync from that. I didn't find a way to do that.
It's possible that relying on a single events query during the initial sync of the liq-bot will either fail or cause wrong data after a market (e.g. ETH) has more than 10,000 trading events.
We need to deal with this before that happens. I see a few potential ways: