kernc / backtesting.py

:mag_right: :chart_with_upwards_trend: :snake: :moneybag: Backtest trading strategies in Python.
https://kernc.github.io/backtesting.py/
GNU Affero General Public License v3.0
5.04k stars 987 forks source link

How to get trades dataframe contain last trade that is still active? #1074

Open Amirefarani opened 8 months ago

Amirefarani commented 8 months ago

Expected Behavior

Hello, I have a strategy for trade. After trade with backtesting library, I have some trades list in a dataframe called trades. but the problem is closing active trades. I mean when my strategy open one or more trades at the last candles, while they are still active, the library close all of them and append them to trades dataframe. When you comment the code that close the last trades, active trades will not show in dataframe. Is there any way to get active trades in this dataframe or in another variable?