-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit order fees #690
Limit order fees #690
Conversation
321744b
to
31c587d
Compare
let gas_price_estimator = Arc::new(InstrumentedGasEstimator::new( | ||
shared::gas_price_estimation::create_priority_estimator( | ||
&http_factory, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: The block instantiating the quoter
could be moved right before the solvable_orders_cache
. Then the solvable_orders_cache
wouldn't need to be moved at all which shrinks the PR diff a bit.
/// Quotes all limit orders and sets the fee_amount for each one to the fee returned by the | ||
/// quoting process. If quoting fails, the corresponding order is filtered out. | ||
async fn set_limit_order_fees(&self, orders: Vec<Order>) -> Vec<Order> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think even when caching gets introduced in a follow up PR time boxing the fee calculation might be needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. In the same module we also have a time limit on native prices. Should do something similar for getting as many quotes as possible and run both tasks at the same time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for letting me know @vkgnosis, that's good to know.
afc44e3
to
3a62da0
Compare
888f027
to
1188e25
Compare
1188e25
to
5d9996a
Compare
self.optimal_quoter | ||
.store_quote(quote) | ||
.await | ||
.map_err(CalculateQuoteError::Other)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hoisting this up to the API level was a good choice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late review, but looks good!
Progress on #643.
Quotes limit orders whenever an auction is cut. The next PR will start caching the calculated fees to reduce the frequency of quoting, since quoting isn't cheap.
Note that the fee does not get stored anywhere in out database yet.
Refactored some interfaces to make things more explicit and to try to illustrate business logic a tiny bit more clearly.
Test Plan
Currently the change is not covered by tests. I will add an E2E test once it makes sense.
Release notes
Adds a new field to the
Order
type. This is a backwards-compatible change.