Switch from ujson to rapidjson

This commit is contained in:
Matthias
2018-12-28 10:01:16 +01:00
parent 98ac2b15ca
commit c955415cc3
5 changed files with 11 additions and 11 deletions

View File

@@ -3,7 +3,6 @@ Various tool function for Freqtrade and scripts
"""
import gzip
import json
import logging
import re
from datetime import datetime
@@ -11,6 +10,7 @@ from typing import Dict
import numpy as np
from pandas import DataFrame
import rapidjson
logger = logging.getLogger(__name__)
@@ -77,10 +77,10 @@ def file_dump_json(filename, data, is_zip=False) -> None:
if not filename.endswith('.gz'):
filename = filename + '.gz'
with gzip.open(filename, 'w') as fp:
json.dump(data, fp, default=str)
rapidjson.dump(data, fp, default=str, number_mode=rapidjson.NM_NATIVE)
else:
with open(filename, 'w') as fp:
json.dump(data, fp, default=str)
rapidjson.dump(data, fp, default=str, number_mode=rapidjson.NM_NATIVE)
def format_ms_time(date: int) -> str: