From 33aea106d1db45260c2bcf0222f91530951105cc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 03:42:52 +0000 Subject: [PATCH 1/2] Bump python-rapidjson from 1.17 to 1.18 Bumps [python-rapidjson](https://github.com/python-rapidjson/python-rapidjson) from 1.17 to 1.18. - [Changelog](https://github.com/python-rapidjson/python-rapidjson/blob/master/CHANGES.rst) - [Commits](https://github.com/python-rapidjson/python-rapidjson/compare/v1.17...v1.18) --- updated-dependencies: - dependency-name: python-rapidjson dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- ft_client/requirements.txt | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ft_client/requirements.txt b/ft_client/requirements.txt index 35406c1d0..5e6856e92 100644 --- a/ft_client/requirements.txt +++ b/ft_client/requirements.txt @@ -1,3 +1,3 @@ # Requirements for freqtrade client library requests==2.32.3 -python-rapidjson==1.17 +python-rapidjson==1.18 diff --git a/requirements.txt b/requirements.txt index 5dec7bb5d..0538e7cf4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -30,7 +30,7 @@ pyarrow==16.1.0; platform_machine != 'armv7l' py_find_1st==1.1.6 # Load ticker files 30% faster -python-rapidjson==1.17 +python-rapidjson==1.18 # Properly format api responses orjson==3.10.5 From a800152a43deaa4c352ea0e60455b8c5156d7571 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 3 Jul 2024 09:19:23 +0200 Subject: [PATCH 2/2] Update gzip open mode to text mode It's slightly faster this way, as json files are text anyway. --- freqtrade/misc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/freqtrade/misc.py b/freqtrade/misc.py index 9a33fe430..23e2779a0 100644 --- a/freqtrade/misc.py +++ b/freqtrade/misc.py @@ -33,7 +33,7 @@ def file_dump_json(filename: Path, data: Any, is_zip: bool = False, log: bool = if log: logger.info(f'dumping json to "{filename}"') - with gzip.open(filename, "w") as fpz: + with gzip.open(filename, "wt", encoding="utf-8") as fpz: rapidjson.dump(data, fpz, default=str, number_mode=rapidjson.NM_NATIVE) else: if log: @@ -60,7 +60,7 @@ def file_dump_joblib(filename: Path, data: Any, log: bool = True) -> None: logger.debug(f'done joblib dump to "{filename}"') -def json_load(datafile: Union[gzip.GzipFile, TextIO]) -> Any: +def json_load(datafile: TextIO) -> Any: """ load data with rapidjson Use this to have a consistent experience, @@ -77,7 +77,7 @@ def file_load_json(file: Path): # Try gzip file first, otherwise regular json file. if gzipfile.is_file(): logger.debug(f"Loading historical data from file {gzipfile}") - with gzip.open(gzipfile) as datafile: + with gzip.open(gzipfile, "rt", encoding="utf-8") as datafile: pairdata = json_load(datafile) elif file.is_file(): logger.debug(f"Loading historical data from file {file}")