Skip to content
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

entry price and position PnL #37

Open
Zergity opened this issue Jul 27, 2023 · 0 comments
Open

entry price and position PnL #37

Zergity opened this issue Jul 27, 2023 · 0 comments
Assignees

Comments

@Zergity
Copy link
Contributor

Zergity commented Jul 27, 2023

the next version of the contract will emit the price field in the Swap event, this Beta version the price need to be fetched somewhere else, either getLogs at that block or some 3rd-party API, and keep them in storage along with the wallet history.

Or deploy a workaround Helper: https://github.com/derivable-labs/derivable-core/blob/dev/contracts/support/Helper.sol

Note: price = base/quote, priceR = R/USD which require client to pass an additional INDEX_R for reserve with a stablecoin.

Position Entry Price: price above
Position Entry Value = amountIn (in ETH) x priceR ($)
Position Current Value = (how value is currently calculated)
Value Changed = CurrentValue - EntryValue
PnL rate = ValueChanged / EntryValue (%)

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants