-
Notifications
You must be signed in to change notification settings - Fork 13
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
Investigate profit calculation #232
Comments
So I see two problems in the existing calculation: Problem unified-auctions-ui/core/src/auctions.ts Line 52 in 1f3aa05
We can calculate how much collateral will actually be sold by using But there is a problem, that unified-auctions-ui/core/src/price.ts Lines 81 to 84 in 1f3aa05
Therefore, in some rare occasions, when auction can not be executed, the market price wouldn't be available as well. Not sure it's desirable, since till now we used unavailability of market price as an indication that it's "not tradable". We should maybe catch those two errors differently? Problem unified-auctions-ui/core/src/price.ts Lines 44 to 55 in 1f3aa05
The difference between total selling prices should be computed on the |
I think the best way to address it would be to recreate take function line by line https://github.com/makerdao/dss/blob/master/src/clip.sol#L335-L415 |
Once again: we want ContextThere are can be many reasons for it, but known problems are described above:
How to reproduce
Known problems
|
Since we now have test setup in place, I suggest to open a PR where we first write a failing test:
This will open the ground for the further investigation based on actual number and reproducible way to test our theories. |
fun fact (aka observation) which does not make any definite conclusions and just raises a discussion i've merged my test #364 with #247 and changed unified-auctions-ui/core/src/price.ts Line 64 in c139af9
then all the auctions on the default blocknumber (now on main) have an accurate prediction OR can't be swapped due to insuffiecient profit. all cases on 14760072 block have the same result so among ~25 test cases there's only single outlier that has an inaccurate prediction. compared to the case with the original As of now, i am struggling to explain "why" this change gives better result. and is struggle to understand why there's one exception in the |
This means that whatever way the
When do you say "the same" how same are they? Down to the last digit?
Can please you provide predicted gross profit for the one that fails? |
Within 1 percent is the guarantee of the test
actual profit 336.713869870931917693
after looking at the tested function This makes me a bit confused regarding why we have to find minimum during transaction collateral outcome computation. |
The investigation result for the one failing case there: My current hypothesis is that |
Good question. We are sending
But even if we aim to sell complete amount of collateral in the auction (eg 100 ETH) the amount of collateral that will be sold will not be defined by the value we send, but by the To answer you question "why": the function where
I think that is most probable cause for the #329 |
Regarding the dates, please note that there are two exact files |
Another input to this issue: #561 (comment) |
Context:
We experienced our profit calculation to not be accurate all the time.
See recording here -> LOCAL TESTING video
We saw that similar problems were tackled in the auction demo keeper implementation here
First conclusion by @valiafetisov:
Tasks:
calculateTransactionCollateralOutcome
approachThe text was updated successfully, but these errors were encountered: