chore: simplify code structure by moving conditional to parent method
This commit is contained in:
@@ -134,7 +134,19 @@ class Binance(Exchange):
|
|||||||
)
|
)
|
||||||
return DataFrame(columns=DEFAULT_DATAFRAME_COLUMNS)
|
return DataFrame(columns=DEFAULT_DATAFRAME_COLUMNS)
|
||||||
|
|
||||||
if self._config["exchange"].get("only_from_ccxt", False):
|
if (
|
||||||
|
self._config["exchange"].get("only_from_ccxt", False)
|
||||||
|
and
|
||||||
|
# only download timeframes with significant improvements,
|
||||||
|
# otherwise fall back to rest API
|
||||||
|
not (
|
||||||
|
(candle_type == CandleType.SPOT and timeframe in ["1s", "1m", "3m", "5m"])
|
||||||
|
or (
|
||||||
|
candle_type == CandleType.FUTURES
|
||||||
|
and timeframe in ["1m", "3m", "5m", "15m", "30m"]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
):
|
||||||
return super().get_historic_ohlcv(
|
return super().get_historic_ohlcv(
|
||||||
pair=pair,
|
pair=pair,
|
||||||
timeframe=timeframe,
|
timeframe=timeframe,
|
||||||
@@ -166,10 +178,6 @@ class Binance(Exchange):
|
|||||||
"""
|
"""
|
||||||
Fastly fetch OHLCV data by leveraging https://data.binance.vision.
|
Fastly fetch OHLCV data by leveraging https://data.binance.vision.
|
||||||
"""
|
"""
|
||||||
# only download timeframes with significant improvements, otherwise fall back to rest API
|
|
||||||
if (candle_type == CandleType.SPOT and timeframe in ["1s", "1m", "3m", "5m"]) or (
|
|
||||||
candle_type == CandleType.FUTURES and timeframe in ["1m", "3m", "5m", "15m", "30m"]
|
|
||||||
):
|
|
||||||
df = self.loop.run_until_complete(
|
df = self.loop.run_until_complete(
|
||||||
download_archive_ohlcv(
|
download_archive_ohlcv(
|
||||||
candle_type=candle_type,
|
candle_type=candle_type,
|
||||||
@@ -201,15 +209,6 @@ class Binance(Exchange):
|
|||||||
)
|
)
|
||||||
all_df = concat([df, rest_df])
|
all_df = concat([df, rest_df])
|
||||||
return all_df
|
return all_df
|
||||||
else:
|
|
||||||
return super().get_historic_ohlcv(
|
|
||||||
pair=pair,
|
|
||||||
timeframe=timeframe,
|
|
||||||
since_ms=since_ms,
|
|
||||||
candle_type=candle_type,
|
|
||||||
is_new_pair=is_new_pair,
|
|
||||||
until_ms=until_ms,
|
|
||||||
)
|
|
||||||
|
|
||||||
def funding_fee_cutoff(self, open_date: datetime):
|
def funding_fee_cutoff(self, open_date: datetime):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user