You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let debits_in_usd = Self::usd_value(p.pair.quote, p.leveraged_debits.saturating_abs())?;
Which is acceptable even though not perfectly accurate. After discussion with @Antonia-Chen, this reflects traditional markets and traders are used to it. (more accurate would be differentiating between longs and shorts)
However in the ENP/ELL, we are using leveraged_held:
let net_in_usd = Self::usd_value(pair.base, new_net.saturating_abs())?;
let new_max = cmp::max(pool.long.held, pool.short.held.saturating_abs());
let max_in_usd = Self::usd_value(pair.base, new_max.saturating_abs())?;
While it doesn't matter from a security perspective, I think for consistency reasons it should be the same. Otherwise it gets too confusing thinking about which kind of net calculation is now being used. A simple change like this would be enough:
let new_net = pool
.long
.debits
.checked_add(&pool.short.debits)
.ok_or(Error::<T>::NumOutOfBound)?;
let net_in_usd = Self::usd_value(pair.quote, new_net.saturating_abs())?;
let new_max = cmp::max(pool.long.debits, pool.short.debits.saturating_abs());
let max_in_usd = Self::usd_value(pair.quote, new_max.saturating_abs())?;
The text was updated successfully, but these errors were encountered:
Currently, we are calculating net positions for traders from the
leveraged_debits
:laminar-chain/modules/margin-protocol/src/lib.rs
Line 1159 in 1e91d3b
Which is acceptable even though not perfectly accurate. After discussion with @Antonia-Chen, this reflects traditional markets and traders are used to it. (more accurate would be differentiating between longs and shorts)
However in the ENP/ELL, we are using
leveraged_held
:laminar-chain/modules/margin-protocol/src/lib.rs
Lines 1270 to 1278 in 1e91d3b
While it doesn't matter from a security perspective, I think for consistency reasons it should be the same. Otherwise it gets too confusing thinking about which kind of net calculation is now being used. A simple change like this would be enough:
The text was updated successfully, but these errors were encountered: