[Mod] add default value for pre_close price if zero
This commit is contained in:
parent
01fed04246
commit
b117e84167
@ -1099,7 +1099,12 @@ class DailyResult:
|
||||
inverse: bool
|
||||
):
|
||||
""""""
|
||||
# If no pre_close provided on the first day,
|
||||
# use value 1 to avoid zero division error
|
||||
if pre_close:
|
||||
self.pre_close = pre_close
|
||||
else:
|
||||
self.pre_close = 1
|
||||
|
||||
# Holding pnl is the pnl from holding position at day start
|
||||
self.start_pos = start_pos
|
||||
|
Loading…
Reference in New Issue
Block a user