Ruff --fix

This commit is contained in:
Joe Schr
2024-02-07 12:45:39 +01:00
parent 72a20e9928
commit 39ba6fe56b
4 changed files with 10 additions and 19 deletions

View File

@@ -1,7 +1,6 @@
""" """
Functions to convert data from one format to another Functions to convert data from one format to another
""" """
import itertools
import logging import logging
import time import time
from typing import Dict from typing import Dict
@@ -125,7 +124,7 @@ def populate_dataframe_with_trades(config: Config, dataframe: DataFrame, trades:
pd.Timedelta(minutes=timeframe_minutes) pd.Timedelta(minutes=timeframe_minutes)
# skip if there are no trades at next candle because that this candle isn't finished yet # skip if there are no trades at next candle because that this candle isn't finished yet
# if not np.any((candle_next == df.candle_start)): # if not np.any((candle_next == df.candle_start)):
if not candle_next in trades_grouped_by_candle_start.groups: if candle_next not in trades_grouped_by_candle_start.groups:
logger.warning( logger.warning(
f"candle at {candle_start} with {len(trades_grouped_df)} trades might be unfinished, because no finished trades at {candle_next}") f"candle at {candle_start} with {len(trades_grouped_df)} trades might be unfinished, because no finished trades at {candle_next}")

View File

@@ -13,7 +13,7 @@ from pandas import DataFrame, Timedelta, Timestamp, to_timedelta
from freqtrade.configuration import TimeRange from freqtrade.configuration import TimeRange
from freqtrade.constants import (FULL_DATAFRAME_THRESHOLD, Config, ListPairsWithTimeframes, from freqtrade.constants import (FULL_DATAFRAME_THRESHOLD, Config, ListPairsWithTimeframes,
ListTicksWithTimeframes, PairWithTimeframe) PairWithTimeframe)
from freqtrade.data.converter import public_trades_to_dataframe from freqtrade.data.converter import public_trades_to_dataframe
from freqtrade.data.history import load_pair_history from freqtrade.data.history import load_pair_history
from freqtrade.data.history.idatahandler import get_datahandler from freqtrade.data.history.idatahandler import get_datahandler

View File

@@ -2406,7 +2406,7 @@ class Exchange:
# Timeframe in seconds # Timeframe in seconds
df = self.klines((pair, timeframe, candle_type), True) df = self.klines((pair, timeframe, candle_type), True)
_calculate_ohlcv_candle_start_and_end(df, timeframe) _calculate_ohlcv_candle_start_and_end(df, timeframe)
interval_in_sec = timeframe_to_seconds(timeframe) timeframe_to_seconds(timeframe)
# plr = self._trades_last_refresh_time.get((pair, timeframe, candle_type), 0) + interval_in_sec # plr = self._trades_last_refresh_time.get((pair, timeframe, candle_type), 0) + interval_in_sec
plr = round(df.iloc[-1]["candle_end"].timestamp()) plr = round(df.iloc[-1]["candle_end"].timestamp())
now = int(timeframe_to_prev_date(timeframe).timestamp()) now = int(timeframe_to_prev_date(timeframe).timestamp())

View File

@@ -1,18 +1,10 @@
import logging
from pathlib import Path
import arrow
import numpy as np import numpy as np
import pandas as pd import pandas as pd
import pytest import pytest
from pandas import DataFrame
from freqtrade.configuration import Configuration
from freqtrade.constants import DEFAULT_ORDERFLOW_COLUMNS
from freqtrade.data.converter import populate_dataframe_with_trades, public_trades_to_dataframe from freqtrade.data.converter import populate_dataframe_with_trades, public_trades_to_dataframe
from freqtrade.data.converter.converter import trades_to_volumeprofile_with_total_delta_bid_ask from freqtrade.data.converter.converter import trades_to_volumeprofile_with_total_delta_bid_ask
from freqtrade.enums import CandleType, MarginMode, TradingMode
from freqtrade.exchange.exchange import timeframe_to_minutes
BIN_SIZE_SCALE = 0.5 BIN_SIZE_SCALE = 0.5