-
Notifications
You must be signed in to change notification settings - Fork 573
Fix BSRM 2 Borrowing; Issue #3746 #3748
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -107,27 +107,19 @@ export default class AssetUtils { | |
| * - Settlement Price: feed price * force settlement offset factor | ||
| * | ||
| */ | ||
| if (!!asset.bitasset) { | ||
| return asset.bitasset.current_feed.settlement_price; | ||
| } | ||
| if (!!asset.current_feed) { | ||
| return asset.current_feed.settlement_price; | ||
| } | ||
| if (!!asset.settlement_price) { | ||
| return asset.settlement_price; | ||
| } | ||
| let ret; | ||
|
|
||
| if (!!asset.get("bitasset")) { | ||
| return asset.getIn([ | ||
| "bitasset", | ||
| "current_feed", | ||
| "settlement_price" | ||
| ]); | ||
| asset = asset.get("bitasset"); | ||
| } | ||
| 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a comment how it relates, and why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. |
||
| } else { | ||
| ret = asset.get("current_feed").get("settlement_price"); | ||
| } | ||
| if (!!asset.get("current_feed")) { | ||
| return asset.getIn(["current_feed", "settlement_price"]); | ||
|
|
||
| if (!!ret) { | ||
| return ret; | ||
| } | ||
| throw "Feed price not found!"; | ||
| } | ||
|
|
||
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.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.median_feeds.settlement_pricewhen borrowing, to calculate CR and etc.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.BSRMis1or2,median_feeds.settlement_priceandcurrent_feed.settlement_pricecan be different when there was a black swan event.settlement_priceis set whenBSRMis0and a black swan event happens. It is used in this case for forced-settlements. Check theUSDasset on chain.individual_settlement_debtis set whenBSRMis (2or3) and a black swan event happens. Check theCNYandSGDassets on chain.