Short positions must use:
- Entry (sell): add_exit_fee reduces price received
- Exit (buy): add_entry_fee increases cost to close
Previous commit incorrectly inverted these in both get_most_recent_return
and get_most_recent_profit for short positions.
self._position_history[previous_tick] == Positions.Long
or self._position_history[previous_tick] == Positions.Neutral
):
- previous_price = self.add_entry_fee(previous_price)
+ previous_price = self.add_exit_fee(previous_price)
if (
previous_price <= 0.0
return (current_price - previous_price) / previous_price
elif self._position == Positions.Short:
- current_price = self.add_exit_fee(self.current_price())
- previous_price = self.add_entry_fee(self.previous_price())
+ current_price = self.add_entry_fee(self.current_price())
+ previous_price = self.add_exit_fee(self.previous_price())
if (
previous_price <= 0.0