mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 21:12:16 +00:00
* start papermill rollback * move reports to templates folder * comment some stuff * refactor reports controller * change var names * clean ctrl class vars * small refactoring on metadata search * relocate some func * breaking changes * revert some changes * destroying changes * change menu appearance * change menu appeaerance again * update choices * change some assets locations * remove unused vars * change some docstrings * rename vars * its working * forgot one dash * omg its working * clean some code and doc * change func name * fix a bug and add some comments * fix economy report startup * add custom reports * allow custom reports * forgot to delete this * unused import * make somestuff more explicit, 5 min rule * add helper func * supress errors--no-verify * add some type checks * fix check ipynb func * check inputs in run * rewrite some integration tests * remove unused import * add some docs to website * add auto completion * warn if no forecast * add to do * add arg name if 1 arg * add papermill pointing to github main * add notebooks * fix terminal spec * relocated choices files * merge main * relocate website docs for reports * limit user choices * fix portfolio auto completion * limit choices fix * clean som edocstrings * limit user choices in run command * improve run parser * fix msg * add reports controller tests * relax crypto choices limit * contain commands * pass pre commit * flake8 * flake8 * ignore mypy * pylint * website * move docs to jupyter tab * add installer dep * remove etf * remove reports * update reports to main * handle events erros * rever reports to previous commits before main merge * add papermill installer strategies * add flags to terminal * avoid sdk crash * execute notebook in thread * remove unused sys * execute report in a child process * fix some notebook stuff * fix portfolio report * fix reports controller volatility * change api to sdk * move images * remove som unucessary installer imports * remove debugger warning * move ipykernel launcher * supress notebook crash * remove portfolio decorator * fix run command * forgot to change this * add images * fix portfolio report * fix crypto report * linting and tests * add run integration test * pylint * hide reports module args * try at supressing args * try at supreccing warning * solve some os issues * handle pm errors * fix warning unrecognized arguments * change comment * avoid crash when parameters not found * fix etf commands * minor cleanup * update forecasting check * fix some linting * fix futures test * pylint * limit user choices to prompt * limit user choices to prompt * supress warnings * revert poetry lock back to main * papermill pointing to main * flake8 * forgot requirements * Update helper_funcs.py * Update reports_model.py * choices Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt> Co-authored-by: James Simmons <53658028+simmonsj330@users.noreply.github.com>
78 lines
2.1 KiB
Python
78 lines
2.1 KiB
Python
# IMPORTATION STANDARD
|
|
from typing import List
|
|
|
|
from openbb_terminal.core.config.paths import (
|
|
SETTINGS_DIRECTORY,
|
|
USER_DATA_DIRECTORY,
|
|
USER_ENV_FILE,
|
|
REPOSITORY_ENV_FILE,
|
|
USER_CUSTOM_IMPORTS_DIRECTORY,
|
|
USER_EXPORTS_DIRECTORY,
|
|
USER_PORTFOLIO_DATA_DIRECTORY,
|
|
USER_PRESETS_DIRECTORY,
|
|
USER_ROUTINES_DIRECTORY,
|
|
USER_DATA_SOURCES_DEFAULT_FILE,
|
|
)
|
|
|
|
# pylint: disable=W0603
|
|
|
|
|
|
def create_paths(list_dirs: List):
|
|
"""
|
|
Creates dirs for user data outside the
|
|
terminal if they don't exist
|
|
"""
|
|
for dirs in list_dirs:
|
|
if not dirs.exists():
|
|
dirs.mkdir(
|
|
parents=True,
|
|
)
|
|
|
|
|
|
def create_files(list_files: List):
|
|
"""
|
|
Creates files outside the terminal if they don't exist
|
|
"""
|
|
for filename in list_files:
|
|
if not filename.is_file():
|
|
with open(str(filename), "w"):
|
|
pass
|
|
|
|
|
|
dirs_list = [
|
|
SETTINGS_DIRECTORY,
|
|
USER_DATA_DIRECTORY,
|
|
USER_DATA_DIRECTORY / "styles",
|
|
USER_DATA_DIRECTORY / "reports",
|
|
USER_DATA_DIRECTORY / "reports" / "custom reports",
|
|
USER_CUSTOM_IMPORTS_DIRECTORY,
|
|
USER_CUSTOM_IMPORTS_DIRECTORY / "econometrics",
|
|
USER_CUSTOM_IMPORTS_DIRECTORY / "stocks",
|
|
USER_CUSTOM_IMPORTS_DIRECTORY / "dashboards",
|
|
USER_EXPORTS_DIRECTORY,
|
|
USER_PORTFOLIO_DATA_DIRECTORY,
|
|
USER_PORTFOLIO_DATA_DIRECTORY / "views",
|
|
USER_PORTFOLIO_DATA_DIRECTORY / "holdings",
|
|
USER_PORTFOLIO_DATA_DIRECTORY / "allocation",
|
|
USER_PORTFOLIO_DATA_DIRECTORY / "optimization",
|
|
USER_PRESETS_DIRECTORY,
|
|
USER_PRESETS_DIRECTORY / "stocks" / "options",
|
|
USER_PRESETS_DIRECTORY / "stocks" / "screener",
|
|
USER_PRESETS_DIRECTORY / "stocks" / "insider",
|
|
USER_PRESETS_DIRECTORY / "etf" / "screener",
|
|
USER_ROUTINES_DIRECTORY,
|
|
]
|
|
dirs_files = [USER_ENV_FILE, REPOSITORY_ENV_FILE, USER_DATA_SOURCES_DEFAULT_FILE]
|
|
initialized = False
|
|
|
|
|
|
def init_userdata():
|
|
"""
|
|
Initializes the user data folder
|
|
"""
|
|
global initialized
|
|
if not initialized:
|
|
create_paths(dirs_list)
|
|
create_files(dirs_files)
|
|
initialized = True
|