chore: improve a few typings
This commit is contained in:
@@ -1481,8 +1481,8 @@ class Backtesting:
|
|||||||
strategy_safe_wrapper(self.strategy.bot_loop_start, supress_error=True)(
|
strategy_safe_wrapper(self.strategy.bot_loop_start, supress_error=True)(
|
||||||
current_time=current_time
|
current_time=current_time
|
||||||
)
|
)
|
||||||
pair_detail_cache = {}
|
pair_detail_cache: dict[str, list[tuple]] = {}
|
||||||
pair_tradedir_cache: dict[LongShort | None] = {}
|
pair_tradedir_cache: dict[str, LongShort | None] = {}
|
||||||
for current_time_det, is_first, has_detail, idx in self.time_generator_det(
|
for current_time_det, is_first, has_detail, idx in self.time_generator_det(
|
||||||
current_time, current_time + increment
|
current_time, current_time + increment
|
||||||
):
|
):
|
||||||
@@ -1530,11 +1530,14 @@ class Backtesting:
|
|||||||
and has_detail
|
and has_detail
|
||||||
and pair not in pair_detail_cache
|
and pair not in pair_detail_cache
|
||||||
and pair in self.detail_data
|
and pair in self.detail_data
|
||||||
|
and row
|
||||||
):
|
):
|
||||||
# Spread candle into detail timeframe and cache that -
|
# Spread candle into detail timeframe and cache that -
|
||||||
# only once per main candle
|
# only once per main candle
|
||||||
# and only if we can expect activity.
|
# and only if we can expect activity.
|
||||||
pair_detail_cache[pair] = self.get_detail_data(pair, row)
|
pair_detail = self.get_detail_data(pair, row)
|
||||||
|
if pair_detail is not None:
|
||||||
|
pair_detail_cache[pair] = pair_detail
|
||||||
row = pair_detail_cache[pair][idx]
|
row = pair_detail_cache[pair][idx]
|
||||||
|
|
||||||
is_last_row = current_time_det == end_date
|
is_last_row = current_time_det == end_date
|
||||||
|
|||||||
Reference in New Issue
Block a user