mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
refactor: Move dataframe parsing into get_historic_ohlcv
This commit is contained in:
@@ -17,7 +17,6 @@ from freqtrade.constants import (
|
|||||||
from freqtrade.data.converter import (
|
from freqtrade.data.converter import (
|
||||||
clean_ohlcv_dataframe,
|
clean_ohlcv_dataframe,
|
||||||
convert_trades_to_ohlcv,
|
convert_trades_to_ohlcv,
|
||||||
ohlcv_to_dataframe,
|
|
||||||
trades_df_remove_duplicates,
|
trades_df_remove_duplicates,
|
||||||
trades_list_to_df,
|
trades_list_to_df,
|
||||||
)
|
)
|
||||||
@@ -273,7 +272,7 @@ def _download_pair_history(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Default since_ms to 30 days if nothing is given
|
# Default since_ms to 30 days if nothing is given
|
||||||
new_data = exchange.get_historic_ohlcv(
|
new_dataframe = exchange.get_historic_ohlcv(
|
||||||
pair=pair,
|
pair=pair,
|
||||||
timeframe=timeframe,
|
timeframe=timeframe,
|
||||||
since_ms=(
|
since_ms=(
|
||||||
@@ -285,10 +284,6 @@ def _download_pair_history(
|
|||||||
candle_type=candle_type,
|
candle_type=candle_type,
|
||||||
until_ms=until_ms if until_ms else None,
|
until_ms=until_ms if until_ms else None,
|
||||||
)
|
)
|
||||||
# TODO: Maybe move parsing to exchange class (?)
|
|
||||||
new_dataframe = ohlcv_to_dataframe(
|
|
||||||
new_data, timeframe, pair, fill_missing=False, drop_incomplete=True
|
|
||||||
)
|
|
||||||
if data.empty:
|
if data.empty:
|
||||||
data = new_dataframe
|
data = new_dataframe
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -2223,7 +2223,7 @@ class Exchange:
|
|||||||
candle_type: CandleType,
|
candle_type: CandleType,
|
||||||
is_new_pair: bool = False,
|
is_new_pair: bool = False,
|
||||||
until_ms: Optional[int] = None,
|
until_ms: Optional[int] = None,
|
||||||
) -> List:
|
) -> DataFrame:
|
||||||
"""
|
"""
|
||||||
Get candle history using asyncio and returns the list of candles.
|
Get candle history using asyncio and returns the list of candles.
|
||||||
Handles all async work for this.
|
Handles all async work for this.
|
||||||
@@ -2233,7 +2233,7 @@ class Exchange:
|
|||||||
:param since_ms: Timestamp in milliseconds to get history from
|
:param since_ms: Timestamp in milliseconds to get history from
|
||||||
:param until_ms: Timestamp in milliseconds to get history up to
|
:param until_ms: Timestamp in milliseconds to get history up to
|
||||||
:param candle_type: '', mark, index, premiumIndex, or funding_rate
|
:param candle_type: '', mark, index, premiumIndex, or funding_rate
|
||||||
:return: List with candle (OHLCV) data
|
:return: Dataframe with candle (OHLCV) data
|
||||||
"""
|
"""
|
||||||
pair, _, _, data, _ = self.loop.run_until_complete(
|
pair, _, _, data, _ = self.loop.run_until_complete(
|
||||||
self._async_get_historic_ohlcv(
|
self._async_get_historic_ohlcv(
|
||||||
@@ -2246,7 +2246,7 @@ class Exchange:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
logger.info(f"Downloaded data for {pair} with length {len(data)}.")
|
logger.info(f"Downloaded data for {pair} with length {len(data)}.")
|
||||||
return data
|
return ohlcv_to_dataframe(data, timeframe, pair, fill_missing=False, drop_incomplete=True)
|
||||||
|
|
||||||
async def _async_get_historic_ohlcv(
|
async def _async_get_historic_ohlcv(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Reference in New Issue
Block a user