We want to have a very robust and rich price feed for the imbalances on mainnet. Thus, the goal is to ensure that we get at least a few different price feeds for every imbalance that occurs, reliably, and store them in our analytics db.
I am currently trying to understand what steps would be required to address this.
Some suggestions:
Sytematic testing: Adding tests which can be run locally and on each pull request which test all major functionality of the code. At the moment only formatting is tested on pull requests. There are two three test files. Only one of them seems to be working. It is not testing prices. Running any code on price fetching locally seems to require code changes.
Error handling: Add enough error handling to recover from crashes and to log useful error message. All emited alerts should be actionable. At the moment, crashing the program can result in incomplete data in the database. There was an error spamming alerts without documentation on how to react.
Documentation: There should be more documentation in the code to understand what it does. The code is already quite convoluted. I tried to go through what it does but it is not really possible for me.
Formatting: Use strict formatting rules. At the moment we seem to be going for 8/10, which could mean complete files without reasonable formatting.
Database setup: There should be a programmatic way of setting up a database for testing. At the moment, one needs write access to a database and some tables are expected to exist. Those need to be added by hand. The database we use in our cluster is also messed up in terms of privileges.
We want to have a very robust and rich price feed for the imbalances on mainnet. Thus, the goal is to ensure that we get at least a few different price feeds for every imbalance that occurs, reliably, and store them in our analytics db.