Skip to content

Why don't use adjusted_price when close a trade ? #149

@albertwh1te

Description

@albertwh1te

Expected Behavior

I think the exit_price in trades should be the adjusted_price.

self._close_trade(trade, price, time_index)

                    # Order size greater than this opposite-directed existing trade,
                    # so it will be closed completely
                    if abs(need_size) >= abs(trade.size):
                        # I think we shoud use adjusted_price 
                        self._close_trade(trade, adjusted_price, time_index)
                        need_size += trade.size
                    else:
                        # The existing trade is larger than the new order,
                        # so it will only be closed partially
                        self._reduce_trade(trade, adjusted_price, need_size, time_index)
                        need_size = 0
                        break

Actual Behavior

We are using the price right now. :)

Steps to Reproduce

  1. Just run a simple strategy
  2. check the exit_price in stats._trades
  3. compare with close price at the same

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions