-
Notifications
You must be signed in to change notification settings - Fork 52
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
feat: add asset price in position query #807
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #807 +/- ##
==========================================
- Coverage 42.63% 42.60% -0.03%
==========================================
Files 672 672
Lines 22813 22826 +13
==========================================
Hits 9726 9726
- Misses 11913 11926 +13
Partials 1174 1174 |
|
x/perpetual/keeper/mtp.go
Outdated
@@ -167,15 +167,20 @@ func (k Keeper) GetMTPs(ctx sdk.Context, pagination *query.PageRequest) ([]*type | |||
mtp.BorrowInterestUnpaidCollateral = k.GetBorrowInterest(ctx, &mtp, ammPool).Add(mtp.BorrowInterestUnpaidCollateral) | |||
} | |||
|
|||
mtpList = append(mtpList, &mtp) | |||
trading_asset_price := k.oracleKeeper.GetAssetPriceFromDenom(ctx, mtp.TradingAsset) |
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.
This price doesn't include decimals, is that right ?
This need to be same as stop_loss price, decimals that is when user gives input and it includes decimals, then we should multiply this value with decimals too
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.
mtp:
address: elys17lwha3f5jue86hwcfdd6crpxz85j8nf8m7hg5g
amm_pool_id: "2"
borrow_interest_paid_collateral: "362"
borrow_interest_paid_custody: "86"
borrow_interest_unpaid_collateral: "190202"
collateral: "225100635"
collateral_asset: ibc/2180E84E20F5679FCC760D8C165B60F42065DEF7F46A72B447CFF1B7DC6C0A65
consolidate_leverage: "3.000000000000000000"
custody: "112214323"
custody_asset: ibc/E2D2F6ADCC68AA3384B2F5DFACCA437923D137C14E86FB8A10207CF3BED0C8D4
funding_fee_paid_collateral: "467429"
funding_fee_paid_custody: "112326"
funding_fee_received_collateral: "0"
funding_fee_received_custody: "0"
id: "26"
last_funding_calc_block: "9840596"
last_funding_calc_time: "1726109566"
last_interest_calc_block: "9840596"
last_interest_calc_time: "1726109566"
leverage: "4.000000000000000000"
liabilities: "675301905"
liabilities_asset: ibc/2180E84E20F5679FCC760D8C165B60F42065DEF7F46A72B447CFF1B7DC6C0A65
mtp_health: "0.696055930376696467"
open_price: "8.015923724659138361"
position: LONG
stop_loss_price: "0.000000000000000000"
sum_collateral: "225100635"
take_profit_borrow_rate: "1.000000000000000000"
take_profit_custody: "76786844"
take_profit_liabilities: "319431108"
take_profit_price: "8.794500000000000000"
trading_asset: ibc/E2D2F6ADCC68AA3384B2F5DFACCA437923D137C14E86FB8A10207CF3BED0C8D4
trading_asset_price: "4.187546444213566112"
@amityadav0 fixed
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.
Please resolve a conflict
Expose price for an asset in position query
https://elys.atlassian.net/browse/DEV-1889