mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-01 23:12:21 +00:00
* Addition of UK Companies House data. Allows you to search for companies and inspect their details and download any filings including accounts * reformatting of code * reformatting * reformat code * reformat * fix codespell issue * updated for changes in way key are handled * small reformatting * added timeout for requests * formatting * ruff order fixes * black reformatting * merge issue - removed function call_openbb * black format change * Added new Companies House functionality to SDK * formattng * more Formatting (black) * Ruff fix * change return type for function * forced type conversion * return type fix * correct error return type * fix return type * deleted companieshouse tests as they require API key * Extra validation added for when data not exist from remote calls * Added extra commands to en.yml * spelling mistake correction * fat finger trouble corrected * Save documents with identifying names and allow documents to be viewed directly within OpenBB * ruff updates * black changes * ruff change * Addition of currently loaded company information in menu * add entry in the API keys guide for Companies Hosue * adds images to api keys guide * adds section in SDK API Keys Guide for Companies House * test file for companieshouse_model * changed test data due to ruff line size limit * resolve merge issues * resolve merge issue * doc strings examples * added docstrings for companieshouse_model * allow download_filking_document methid in view class to be called from SDK * added docstring for download_filing_document SDK method * correct Companies house key literal * replace starnge . with , * add check_api_key decorator to each methopd in controller * implement next and previous for looping through filings * ruff changes * correct tests * companing filings now allows you specify category * ruff line length issue resolved * retrieves all filings and added charges command * bug fix * Added limit parameter to filings command, def :100 * fix ruff issue * added get_charges to sdk and to test class * resolved ruff line length issue * add some view tests * add some controller tests * applying fix not merged to develop yet, column_keep_types=['Company Number'] * fix i18n description * update test_print_help * actually update test_print_help.txt * Update en.yml - no colon * rerorder imports - ruff failurre * simple text change * ruff fix * help text change trying to fix pytest issue --------- Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com>
81 lines
2.7 KiB
Python
81 lines
2.7 KiB
Python
# IMPORTATION STANDARD
|
|
from pathlib import Path
|
|
from typing import List
|
|
|
|
from openbb_terminal.core.config.paths import (
|
|
REPOSITORY_ENV_FILE,
|
|
SETTINGS_DIRECTORY,
|
|
SETTINGS_ENV_FILE,
|
|
)
|
|
from openbb_terminal.core.session.current_user import get_current_user
|
|
|
|
# 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
|
|
|
|
|
|
current_user = get_current_user()
|
|
|
|
dirs_list = [
|
|
SETTINGS_DIRECTORY,
|
|
current_user.preferences.USER_DATA_DIRECTORY,
|
|
current_user.preferences.USER_DATA_DIRECTORY / "styles",
|
|
current_user.preferences.USER_DATA_DIRECTORY / "reports",
|
|
current_user.preferences.USER_DATA_DIRECTORY / "reports" / "custom reports",
|
|
current_user.preferences.USER_DATA_DIRECTORY / "companies_house",
|
|
current_user.preferences.USER_CUSTOM_IMPORTS_DIRECTORY,
|
|
current_user.preferences.USER_CUSTOM_IMPORTS_DIRECTORY / "econometrics",
|
|
current_user.preferences.USER_CUSTOM_IMPORTS_DIRECTORY / "stocks",
|
|
current_user.preferences.USER_CUSTOM_IMPORTS_DIRECTORY / "dashboards",
|
|
current_user.preferences.USER_EXPORTS_DIRECTORY,
|
|
current_user.preferences.USER_PORTFOLIO_DATA_DIRECTORY,
|
|
current_user.preferences.USER_PORTFOLIO_DATA_DIRECTORY / "views",
|
|
current_user.preferences.USER_PORTFOLIO_DATA_DIRECTORY / "holdings",
|
|
current_user.preferences.USER_PORTFOLIO_DATA_DIRECTORY / "allocation",
|
|
current_user.preferences.USER_PORTFOLIO_DATA_DIRECTORY / "optimization",
|
|
current_user.preferences.USER_PRESETS_DIRECTORY,
|
|
current_user.preferences.USER_PRESETS_DIRECTORY / "stocks" / "options",
|
|
current_user.preferences.USER_PRESETS_DIRECTORY / "stocks" / "screener",
|
|
current_user.preferences.USER_PRESETS_DIRECTORY / "stocks" / "insider",
|
|
current_user.preferences.USER_PRESETS_DIRECTORY / "etf" / "screener",
|
|
current_user.preferences.USER_ROUTINES_DIRECTORY,
|
|
current_user.preferences.USER_DATA_DIRECTORY / "sources",
|
|
]
|
|
dirs_files = [
|
|
SETTINGS_ENV_FILE,
|
|
REPOSITORY_ENV_FILE,
|
|
Path(current_user.preferences.USER_DATA_SOURCES_FILE),
|
|
]
|
|
initialized = False
|
|
|
|
|
|
def init_userdata():
|
|
"""
|
|
Initializes the user data folder
|
|
"""
|
|
global initialized # noqa
|
|
if not initialized:
|
|
create_paths(dirs_list)
|
|
create_files(dirs_files)
|
|
initialized = True
|