From b80a219d035a11c665f3a683e25d3d7b3341f0d1 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 18 Oct 2020 16:35:23 +0200 Subject: [PATCH] Improve typehints for backtesting --- freqtrade/optimize/backtesting.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 61a83afc1..01885de26 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -147,7 +147,7 @@ class Backtesting: return data, timerange - def _get_ohlcv_as_lists(self, processed: Dict) -> Dict[str, DataFrame]: + def _get_ohlcv_as_lists(self, processed: Dict[str, DataFrame]) -> Dict[str, DataFrame]: """ Helper function to convert a processed dataframes into lists for performance reasons. @@ -215,7 +215,10 @@ class Backtesting: else: return sell_row.open - def _get_sell_trade_entry(self, trade: Trade, sell_row: DataFrame) -> Optional[BacktestResult]: + def _get_sell_trade_entry(self, trade: Trade, sell_row) -> Optional[BacktestResult]: + """ + sell_row is a named tuple with attributes for date, buy, open, close, sell, low, high. + """ sell = self.strategy.should_sell(trade, sell_row.open, sell_row.date, sell_row.buy, sell_row.sell, low=sell_row.low, high=sell_row.high) @@ -322,7 +325,6 @@ class Backtesting: # Waits until the time-counter reaches the start of the data for this pair. if row.date > tmp: continue - indexes[pair] += 1 # without positionstacking, we can only have one open trade per pair.