-
Notifications
You must be signed in to change notification settings - Fork 874
exchange/order/limits: Migrate to new package and integrate with exchanges #1860
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
Conversation
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.
Not bad, just some things I noticed.
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.
Approved, only some suggestions that won't hold up anything.
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 work 👍
Minor changes only - Will re-review as soon as you throw them back at me.
exchanges/binance/binance_test.go
Outdated
|
||
p := tests[a] | ||
l, err := e.GetOrderExecutionLimits(a, p) | ||
require.NoErrorf(t, err, "GetOrderExecutionLimits must not error for %s pair %s", a, p) |
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.
🚧 🌴 You've introduced a Run, but kept the assquire.*f
This applies to everything below.
require.NoErrorf(t, err, "GetOrderExecutionLimits must not error for %s pair %s", a, p) | |
require.NoError(t, err, "GetOrderExecutionLimits must not error") |
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.
whoops sorry! I dont think I understood at the 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.
Rather than going in a manually replacing all those fields since they were all so unique, I redid all TestUpdateOrderExecutionLimits
to a standard which doesn't include such assertify f's. Hope it's better, can revert if not. I don't believe testing each field is worthwhile so I just check one.
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.
🚧 Soz buddy, no, I don't agree.
I'm not against changing the way we do this, but not if it reduces RealWorld coverage.
That is: Lines that we actually assert are doing the right thing, rather than just executed by a test.
So looking again at #1464 which man-handled this into this shape, I think our coverage isn't at the right unit.
We're covering all the Fetch*
units implicitly via Update*
.
So either:
- Leave TestUpdate doing a full coverage test
- Move test coverage for for each type into
TestFetch*
- This will mean duplicating the common assertions though, and just haveTestUpdate
testing one thing.
For now, I'd vote that you just revert that change and fix the assert.*f
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.
Unfortunately I don't understand the way you are talking. Are you saying that you want the same amount of assertions on data? There's many changes in that PR and there's a lot of words you are saying despite coverage is the same. Its very hard for me to understand what you want changed to improve things outside of reverting
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.
Let me be clearer. Sorry if it sounds ruder as a result.
-
The fields you removed are not being tested. They need to be.
( MinPrice, MaxPrice, etc )
Please revert the change that removed testing for them. -
"Coverage" isn't the only thing that matters. We need to know that values are correct.
Example: If someone removes a line that means MaxTotalOrders is not being set, coverage would go up. But it's a break
I'll make a clear suggestion at the line for you, to speed this up.
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 making those changes! Just some final changes and this LGTG
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
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
Just a couple of 🚧 issues on reduced coverage of pricing limits.
I'm happy to pitch in and move those all to lower unit tests on Fetch*
if you'd like a hand.
exchanges/okx/okx_test.go
Outdated
require.NoError(t, err, "GetOrderExecutionLimits must not error") | ||
assert.Positivef(t, l.PriceStepIncrementSize, "PriceStepIncrementSize should be positive for %s", p) | ||
assert.Positivef(t, l.MinimumBaseAmount, "PriceStepIncrementSize should be positive for %s", p) |
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.
🚧 Same as binance, I don't think we should reduce coverage like this.
exchanges/okx/okx_test.go
Outdated
require.NoError(t, err, "GetOrderExecutionLimits must not error") | ||
assert.Positivef(t, l.PriceStepIncrementSize, "PriceStepIncrementSize should be positive for %s", p) | ||
assert.Positivef(t, l.MinimumBaseAmount, "PriceStepIncrementSize should be positive for %s", p) | ||
assert.NotZero(t, l.PriceStepIncrementSize, "PriceStepIncrementSize should not be zero") |
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.
Aside: I'm "going with it" that this should move from positive to "not zero" - Assuming that was deliberate and applies to both fields
assert.NotZero(t, l.PriceStepIncrementSize, "PriceStepIncrementSize should not be zero") | |
assert.NotZero(t, l.PriceStepIncrementSize, "PriceStepIncrementSize should not be zero") | |
assert.NotZero(t, l.MinimumBaseAmount, "MinimumBaseAmount should not be zero") |
HERE'S HOPING GITHUB FORMATS THIS CORRECTLY! Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
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.
ch ACK!
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.
Oh, I'm very happy. Thank you 🙏
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 making those changes!
PR Description
This looks like a big PR, but its not really. This is a change being brought over from private work. I thought perhaps it could be helpful for others, but happy to keep it private it people are unhappy with it.
Moves all order limits toI don't want it to be internally enforcedinternal/order/limits
, also obviously in a bid to appeal to gkkey
package helper to minimise code lineslimits
packageUse case
As a well-regarded trader, using multiple instances of an exchange, I wish to share the order execution limits between them.
Potential future(s) plans
Across many exchanges, currency details such as expiry, contract decimals and contract denomination are sent in the same response as limits. It would be useful to store these details along with these limits. I currently store them seperately, butUpdateTradablePairs
,UpdateOrderExecutionLimits
andGetFuturesContractDetails
are all the same endpoint across many exchanges. Even if they aren't they could still push changes down to the one set of local storage.Type of change
How has this been tested
Checklist