Fix BSRM 2 Borrowing; Issue #3746#3748
Fix BSRM 2 Borrowing; Issue #3746#3748litepresence wants to merge 1 commit intobitshares:developfrom
Conversation
sschiessl-bcp
left a comment
There was a problem hiding this comment.
Since we have multiple black swan strategies, I think we need to detail out how each of them is used and which variables are set or not set and fix this method to work for all.
| } | ||
| if (!!asset.get("settlement_price")) { | ||
| return asset.getIn(["settlement_price"]); | ||
| if (!!asset.get("individual_settlement_debt")) { |
There was a problem hiding this comment.
@abitmore since we have different black swan handling strategies, which variables are set in which case?
Is settlement_price and individual_settlement_debt both set at the same time, or either or?
There was a problem hiding this comment.
IMO, since the extractRawFeedPrice() function is used in different places for different purposes, we should be careful when updating code here to avoid introducing new bugs.
- We should always use
median_feeds.settlement_pricewhen borrowing, to calculate CR and etc. - Use
current_feed.settlement_pricewhen displaying the "yellow" orders (margin calls) on the order book, placing limit order to buy into the margin calls, or requesting forced-settlements (note that it's not for the scenario when BSRM is0and a black swan event had happened), etc. - When
BSRMis1or2,median_feeds.settlement_priceandcurrent_feed.settlement_pricecan be different when there was a black swan event.
settlement_price is set when BSRM is 0 and a black swan event happens. It is used in this case for forced-settlements. Check the USD asset on chain.
individual_settlement_debt is set when BSRM is (2 or 3) and a black swan event happens. Check the CNY and SGD assets on chain.
| if (!!asset.get("settlement_price")) { | ||
| return asset.getIn(["settlement_price"]); | ||
| if (!!asset.get("individual_settlement_debt")) { | ||
| ret = asset.get("median_feed").get("settlement_price"); |
There was a problem hiding this comment.
Please add a comment how it relates, and why
There was a problem hiding this comment.
If it has a positive individual_settlement_debt, then the current feed freezes, you need to switch to using the median feed to continue borrowing new individual settlement positions.
Closes #3746
Use
median_feedinstead ofcurrent_feedin the case of a BSRM 2 individual settlementCode Preparation
Please review all your changes one last time before committing
Testing
The branch has been tested on the following browsers (desktop and mobile view)