Break up the pnl calc from the percent part

fsp_feeds
Tyler Goodlet 2021-08-30 17:43:20 -04:00
parent f90be981b0
commit 60a6016e73
1 changed files with 9 additions and 2 deletions

View File

@ -49,7 +49,7 @@ def humanize(
) )
def percent_change( def pnl(
init: float, init: float,
new: float, new: float,
@ -62,4 +62,11 @@ def percent_change(
if not (init and new): if not (init and new):
return 0 return 0
return (new - init) / init * 100. return (new - init) / init
def percent_change(
init: float,
new: float,
) -> float:
return pnl(init, new) * 100.