-
Notifications
You must be signed in to change notification settings - Fork 648
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
Call price is inconsistent when MCR changed #1270
Comments
Note: #460 makes the situation a bit more complicated, that said, MCR is now affecting PMs as well although it shouldn't. In principle we keep the behavior unchanged, but for better code maintenance-ability, it's better to still use same code for both PMs and non-PM bitAssets (that means we may change the behavior of PMs a bit). |
I think it's better to modify the median calculation a bit. Given:
Explanation: for call orders, define Currently,
When MCR and MSSR are static, curve of median MCP and MSSR would be smooth, and result would be expected; when MCR or MSSR is dynamic, we may get unexpected result. I think the formula below is better:
For example, given this data set:
Result of current formula would be:
Result of the revised formula would be:
Thoughts? |
I think it makes more sense to view SP, MCR and MSSR as independent values, and it is easier for market participants to think in terms of "I need 1.75 times collateral" and "on margin call I will lose 10%". With the new formula, behaviour would be much less predictable and consequently much more difficult to follow. |
@pmconrad I disagree. MCR and MSSR are subjective parameters, while settlement price was objective before BSIP42. For objective data, it makes sense to get the median input; but for subjective data, IMHO it's better to get the input as a whole to achieve combined effects. Combining subjective input from different sources will likely lead to unexpected consequences. For better UX, we need to keep the numbers consistent, that said, if we use this formula:
It's possible that To solve this inconsistency, we may change the algorithm to:
Note: it's possible that Thoughts? |
Fix #1270 Call price is inconsistent when MCR changed
Fixed by #1324. |
Bug Description
According to discussion in https://bitsharestalk.org/index.php?topic=26496.0
To solve the cache inconsistency issue, we have options:
totally drop the caching mechanism, calculate call prices on the fly (may impact order matching performance)
update "call price" cache immediately when MCR changed (may impact performance since possibly need to update lots of data at a time)
update "call price" cache at maintenance interval since maintenance interval is meant to be used to process mass calculation
3.1 if we don't change MCR update behavior, aka update "current effective" MCR directly when feed changed, then the call price cache will be still inconsistent before maintenance interval;
3.2 we can defer MCR update to maintenance interval, that said, when detected a MCR change due to feed change or asset option e.g. feed lifetime change, don't apply the MCR update immediately, but apply it in next maintenance interval. With this approach, the call price data will be always consistent to "current effective" MCR.
#941 is an attempt to implement 3.2.
Later discussion suggests it's better to go with option 1, and perhaps can use a cache on median price feed to improve performance (need test).
Update: finally went with option 1 and fixed by #1324.
Impacts
Describe which portion(s) of BitShares Core may be impacted by this bug. Please tick at least one box.
CORE TEAM TASK LIST
The text was updated successfully, but these errors were encountered: