Separate autopilot API native price estimator #4044
+369
−218
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Once we started forwarding native price estimates from the Orderbook to Autopilot, CoinGecko API usage went up. This happened because the estimator was disabled in the Orderbook and moved to Autopilot, which now handles all requests and also relies on CoinGecko.
This PR refactors the native price estimator by pulling the cache layer into a shared component, so it’s reused across all native price estimator instances. An optional native price estimation config is introduced that is used specifically for the estimation requests received through the API. In case of the config's absence, the main set of estimators is used. That way we configure a different price estimator to serve the Autopilot API.
The native price initialization is also moved right into the constructor. Not sure why it was a separate step initially.
How to test
Existing tests.