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.enums import CandleType, MarginMode, PriceType, TradingMode
|
||||||
from freqtrade.exceptions import DDosProtection, OperationalException, TemporaryError
|
from freqtrade.exceptions import DDosProtection, OperationalException, TemporaryError
|
||||||
from freqtrade.exchange import Exchange
|
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.common import retrier
|
||||||
from freqtrade.exchange.exchange_types import FtHas, Tickers
|
from freqtrade.exchange.exchange_types import FtHas, Tickers
|
||||||
from freqtrade.exchange.exchange_utils_timeframe import timeframe_to_msecs
|
from freqtrade.exchange.exchange_utils_timeframe import timeframe_to_msecs
|
||||||
@@ -207,7 +207,7 @@ class Binance(Exchange):
|
|||||||
is_new_pair=is_new_pair,
|
is_new_pair=is_new_pair,
|
||||||
until_ms=until_ms,
|
until_ms=until_ms,
|
||||||
)
|
)
|
||||||
all_df = concat([df, rest_df])
|
all_df = concat_safe([df, rest_df])
|
||||||
return all_df
|
return all_df
|
||||||
|
|
||||||
def funding_fee_cutoff(self, open_date: datetime):
|
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
|
Fetch OHLCV data from https://data.binance.vision
|
||||||
The function makes its best effort to download data within the time range
|
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`
|
If `stop_one_404` is True, this returned DataFrame is guaranteed to start from `since_ms`
|
||||||
with no gaps in the data.
|
with no gaps in the data.
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ async def download_archive_ohlcv(
|
|||||||
return df
|
return df
|
||||||
|
|
||||||
|
|
||||||
def concat(dfs) -> DataFrame:
|
def concat_safe(dfs) -> DataFrame:
|
||||||
if all(df is None for df in dfs):
|
if all(df is None for df in dfs):
|
||||||
return DataFrame()
|
return DataFrame()
|
||||||
else:
|
else:
|
||||||
@@ -168,17 +168,17 @@ async def _download_archive_ohlcv(
|
|||||||
"remaining data, this can take more time."
|
"remaining data, this can take more time."
|
||||||
)
|
)
|
||||||
await cancel_and_await_tasks(tasks[tasks.index(task) + 1 :])
|
await cancel_and_await_tasks(tasks[tasks.index(task) + 1 :])
|
||||||
return concat(dfs)
|
return concat_safe(dfs)
|
||||||
else:
|
else:
|
||||||
dfs.append(None)
|
dfs.append(None)
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
logger.warning(f"An exception raised: : {e}")
|
logger.warning(f"An exception raised: : {e}")
|
||||||
# Directly return the existing data, do not allow the gap within the data
|
# Directly return the existing data, do not allow the gap within the data
|
||||||
await cancel_and_await_tasks(tasks[tasks.index(task) + 1 :])
|
await cancel_and_await_tasks(tasks[tasks.index(task) + 1 :])
|
||||||
return concat(dfs)
|
return concat_safe(dfs)
|
||||||
else:
|
else:
|
||||||
dfs.append(df)
|
dfs.append(df)
|
||||||
return concat(dfs)
|
return concat_safe(dfs)
|
||||||
|
|
||||||
|
|
||||||
async def cancel_and_await_tasks(unawaited_tasks):
|
async def cancel_and_await_tasks(unawaited_tasks):
|
||||||
|
|||||||
Reference in New Issue
Block a user