mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-01-31 11:20:24 +00:00
chore: don't shadow pandas builtin methods
This commit is contained in:
@@ -11,7 +11,7 @@ from freqtrade.constants import DEFAULT_DATAFRAME_COLUMNS
|
||||
from freqtrade.enums import CandleType, MarginMode, PriceType, TradingMode
|
||||
from freqtrade.exceptions import DDosProtection, OperationalException, TemporaryError
|
||||
from freqtrade.exchange import Exchange
|
||||
from freqtrade.exchange.binance_public_data import concat, download_archive_ohlcv
|
||||
from freqtrade.exchange.binance_public_data import concat_safe, download_archive_ohlcv
|
||||
from freqtrade.exchange.common import retrier
|
||||
from freqtrade.exchange.exchange_types import FtHas, Tickers
|
||||
from freqtrade.exchange.exchange_utils_timeframe import timeframe_to_msecs
|
||||
@@ -207,7 +207,7 @@ class Binance(Exchange):
|
||||
is_new_pair=is_new_pair,
|
||||
until_ms=until_ms,
|
||||
)
|
||||
all_df = concat([df, rest_df])
|
||||
all_df = concat_safe([df, rest_df])
|
||||
return all_df
|
||||
|
||||
def funding_fee_cutoff(self, open_date: datetime):
|
||||
|
||||
@@ -47,7 +47,7 @@ async def download_archive_ohlcv(
|
||||
"""
|
||||
Fetch OHLCV data from https://data.binance.vision
|
||||
The function makes its best effort to download data within the time range
|
||||
[`since_ms`, `until_ms`) -- including `since_ms`, but excluding `until_ms`.
|
||||
[`since_ms`, `until_ms`] -- including `since_ms`, but excluding `until_ms`.
|
||||
If `stop_one_404` is True, this returned DataFrame is guaranteed to start from `since_ms`
|
||||
with no gaps in the data.
|
||||
|
||||
@@ -107,7 +107,7 @@ async def download_archive_ohlcv(
|
||||
return df
|
||||
|
||||
|
||||
def concat(dfs) -> DataFrame:
|
||||
def concat_safe(dfs) -> DataFrame:
|
||||
if all(df is None for df in dfs):
|
||||
return DataFrame()
|
||||
else:
|
||||
@@ -168,17 +168,17 @@ async def _download_archive_ohlcv(
|
||||
"remaining data, this can take more time."
|
||||
)
|
||||
await cancel_and_await_tasks(tasks[tasks.index(task) + 1 :])
|
||||
return concat(dfs)
|
||||
return concat_safe(dfs)
|
||||
else:
|
||||
dfs.append(None)
|
||||
except BaseException as e:
|
||||
logger.warning(f"An exception raised: : {e}")
|
||||
# Directly return the existing data, do not allow the gap within the data
|
||||
await cancel_and_await_tasks(tasks[tasks.index(task) + 1 :])
|
||||
return concat(dfs)
|
||||
return concat_safe(dfs)
|
||||
else:
|
||||
dfs.append(df)
|
||||
return concat(dfs)
|
||||
return concat_safe(dfs)
|
||||
|
||||
|
||||
async def cancel_and_await_tasks(unawaited_tasks):
|
||||
|
||||
Reference in New Issue
Block a user