Factor cumsize sign to var
parent
eba6a77966
commit
85a38d057b
|
@ -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
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue