Factor cumsize sign to var

account_tests
Tyler Goodlet 2023-08-07 10:13:31 -04:00
parent eba6a77966
commit 85a38d057b
1 changed files with 3 additions and 2 deletions

View File

@ -649,11 +649,12 @@ def ledger_to_dfs(
if ( if (
abs(cumsize) > 0 # non-exit-to-zero position txn abs(cumsize) > 0 # non-exit-to-zero position txn
): ):
cumsize_sign: float = copysign(1, cumsize)
ledger_bep: float = ( ledger_bep: float = (
( (
(ppu * cumsize) (ppu * cumsize)
- -
(last_ledger_pnl * copysign(1, cumsize)) (last_ledger_pnl * cumsize_sign)
) / cumsize ) / cumsize
) )
@ -671,7 +672,7 @@ def ledger_to_dfs(
( (
(ppu * cumsize) (ppu * cumsize)
- -
(last_pos_pnl * copysign(1, cumsize)) (last_pos_pnl * cumsize_sign)
) / cumsize ) / cumsize
) )