chore: move joblib export to bt_storage function
This commit is contained in:
@@ -54,22 +54,6 @@ def file_dump_json(filename: Path, data: Any, is_zip: bool = False, log: bool =
|
|||||||
logger.debug(f'done json to "{filename}"')
|
logger.debug(f'done json to "{filename}"')
|
||||||
|
|
||||||
|
|
||||||
def file_dump_joblib(filename: Path, data: Any, log: bool = True) -> None:
|
|
||||||
"""
|
|
||||||
Dump object data into a file
|
|
||||||
:param filename: file to create
|
|
||||||
:param data: Object data to save
|
|
||||||
:return:
|
|
||||||
"""
|
|
||||||
import joblib
|
|
||||||
|
|
||||||
if log:
|
|
||||||
logger.info(f'dumping joblib to "{filename}"')
|
|
||||||
with filename.open("wb") as fp:
|
|
||||||
joblib.dump(data, fp)
|
|
||||||
logger.debug(f'done joblib dump to "{filename}"')
|
|
||||||
|
|
||||||
|
|
||||||
def json_load(datafile: TextIO) -> Any:
|
def json_load(datafile: TextIO) -> Any:
|
||||||
"""
|
"""
|
||||||
load data with rapidjson
|
load data with rapidjson
|
||||||
|
|||||||
@@ -1,18 +1,35 @@
|
|||||||
import logging
|
import logging
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from pandas import DataFrame
|
from pandas import DataFrame
|
||||||
|
|
||||||
from freqtrade.constants import LAST_BT_RESULT_FN
|
from freqtrade.constants import LAST_BT_RESULT_FN
|
||||||
from freqtrade.enums.runmode import RunMode
|
from freqtrade.enums.runmode import RunMode
|
||||||
from freqtrade.ft_types import BacktestResultType
|
from freqtrade.ft_types import BacktestResultType
|
||||||
from freqtrade.misc import file_dump_joblib, file_dump_json
|
from freqtrade.misc import file_dump_json
|
||||||
from freqtrade.optimize.backtest_caching import get_backtest_metadata_filename
|
from freqtrade.optimize.backtest_caching import get_backtest_metadata_filename
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
def file_dump_joblib(filename: Path, data: Any, log: bool = True) -> None:
|
||||||
|
"""
|
||||||
|
Dump object data into a file
|
||||||
|
:param filename: file to create
|
||||||
|
:param data: Object data to save
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
import joblib
|
||||||
|
|
||||||
|
if log:
|
||||||
|
logger.info(f'dumping joblib to "{filename}"')
|
||||||
|
with filename.open("wb") as fp:
|
||||||
|
joblib.dump(data, fp)
|
||||||
|
logger.debug(f'done joblib dump to "{filename}"')
|
||||||
|
|
||||||
|
|
||||||
def _generate_filename(recordfilename: Path, appendix: str, suffix: str) -> Path:
|
def _generate_filename(recordfilename: Path, appendix: str, suffix: str) -> Path:
|
||||||
"""
|
"""
|
||||||
Generates a filename based on the provided parameters.
|
Generates a filename based on the provided parameters.
|
||||||
|
|||||||
Reference in New Issue
Block a user