From e04f630f41e1e6308b430c830180a964571bed1c Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 4 Dec 2024 07:10:53 +0100 Subject: [PATCH] chore: further improve typing in orderflow --- freqtrade/data/converter/orderflow.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/freqtrade/data/converter/orderflow.py b/freqtrade/data/converter/orderflow.py index 03775f97b..0bfd7a05f 100644 --- a/freqtrade/data/converter/orderflow.py +++ b/freqtrade/data/converter/orderflow.py @@ -4,7 +4,6 @@ Functions to convert orderflow data from public_trades import logging import time -import typing from collections import OrderedDict from datetime import datetime @@ -108,7 +107,7 @@ def populate_dataframe_with_trades( if is_between.any(): from freqtrade.exchange import timeframe_to_next_date - candle_next = timeframe_to_next_date(timeframe, typing.cast(datetime, candle_start)) + candle_next = timeframe_to_next_date(timeframe, candle_start) if candle_next not in trades_grouped_by_candle_start.groups: logger.warning( f"candle at {candle_start} with {len(trades_grouped_df)} trades " @@ -117,9 +116,7 @@ def populate_dataframe_with_trades( # Use caching mechanism if (candle_start, candle_next) in cached_grouped_trades: - cache_entry = cached_grouped_trades[ - (typing.cast(datetime, candle_start), candle_next) - ] + cache_entry = cached_grouped_trades[(candle_start, candle_next)] # dataframe.loc[is_between] = cache_entry # doesn't take, so we need workaround: # Create a dictionary of the column values to be assigned update_dict = {c: cache_entry[c].iat[0] for c in cache_entry.columns}