add create_userdir function

This commit is contained in:
Matthias
2019-07-21 13:42:56 +02:00
parent c85cd13ca1
commit 6c3a0eb1d6
3 changed files with 34 additions and 2 deletions

View File

@@ -10,7 +10,7 @@ from typing import Any, Callable, Dict, Optional
from freqtrade import OperationalException, constants
from freqtrade.configuration.check_exchange import check_exchange
from freqtrade.configuration.create_datadir import create_datadir
from freqtrade.configuration.folder_operations import create_datadir
from freqtrade.configuration.json_schema import validate_config_schema
from freqtrade.loggers import setup_logging
from freqtrade.misc import deep_merge_dicts

View File

@@ -18,3 +18,17 @@ def create_datadir(config: Dict[str, Any], datadir: Optional[str] = None) -> str
folder.mkdir(parents=True)
logger.info(f'Created data directory: {datadir}')
return str(folder)
def create_userdata_dir(directory: str):
sub_dirs = ["backtest_results", "data", "hyperopts", "plots", "strategies", ]
folder = Path(directory)
if not folder.is_dir():
folder.mkdir(parents=True)
logger.info(f'Created user-data directory: {folder}')
# Create required subdirectories
for f in sub_dirs:
subfolder = folder / f
if not subfolder.is_dir():
subfolder.mkdir(parents=False)