mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-01 15:01:18 +00:00
* Start * QA controller tests * Unit tests batch 1 * ruff * More tests * Economy unit tests * Tests: economy * table fixes (#4666) * fix: table fixes * fix: tablaroni * fix: pagination protection * fix: dm much more * fix: colors * fix: colors * fix: colors * fix Timestamp on stocks `get_quote` * fix `call_tob` having `quote` as prog/docstring --------- Co-authored-by: teh_coderer <me@tehcoderer.com> * bug as default flair if no login (#4681) * init (#4683) * Feature: Ultima Insights NewsMonitor Integration (#4685) * fix typing issue that prevents running * news monitor integration for news * UX improvements with news monitor integration * italicize riskExtDesc * minor cosmetic changes * minor cosmetic changes * minor cosmetic changes * Update ultima_newsmonitor_view.py * minor fixes to launch properly * setting Ultima API key * Ultima NewsMonitor integration into terminal done * integration of the commands is done * add Ultima to SDK trailmap, but SDK generation failed on M1 Mac * add tests * add unit tests * Linting and sdk * display message if not supported by Ultima News Monitor * Update api-keys.md * fix stock controller problem + remove source filtering from Ultima * remove source filtering from Ultima * add report issue message * add some error handling in the view to ensure unsupported companies don't get fetched * remove powered by Ultima Insights from console output * ran black formatter to fix linting issues * fix ruff issues * fix pylint issues * lint fix * fixed linting issue and changed keys in the Feedparser model * get all tests to pass * proper testing with --record-mode=rewrite * re-run tests for updated VCRs * redid black formatting * re-run test_print_help in stocks controller * make breaking news output consistent and re-run tests * remove unused import time * reran tests with --rewrite-expected --------- Co-authored-by: ovidysus0 <111447781+ovidysus0@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> Co-authored-by: andrewkenreich <andrew.kenreich@gmail.com> * Terminal/hub QA (#4678) * move update flair * sort repr * remove packaged sys model var * update decorator for check api key * ruff * change if stat * ruff * no need for new var * pylint * Refactor sources menu (#4668) * add data sources defaults to model * fix f string * refactor sources controller * write sources to file * write to user file * add user data sources file inside OpenBBUserData * append to user file, don't rewrite * fix when sources folder does not exist * codespell * change func name * change path to str * ruff * Add method to upload entire user field * change clear func args * update get_ordered_list_sources function * move flatten * move flatten * change extend func name * remove comment * clean sources utils funcs * mypy * Update utils.py * spacing * docs --------- Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt> * Move tradier from hub to local (#4700) * Move tradier from hub to local * Flake error * Disable error * Update stocks_helper.py * Update stocks_helper.py --------- Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> * Unit tests batch * Unit tests batch * ruff * Unit tests batch * Tests : Economy ; moving csv file * Apply black * Apply ruff --------- Co-authored-by: Chavithra PARANA <chavithra@gmail.com> Co-authored-by: jose-donato <43375532+jose-donato@users.noreply.github.com> Co-authored-by: teh_coderer <me@tehcoderer.com> Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Adi Sai <adithya.sairam1@gmail.com> Co-authored-by: ovidysus0 <111447781+ovidysus0@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> Co-authored-by: andrewkenreich <andrew.kenreich@gmail.com> Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>
101 lines
2.8 KiB
Python
101 lines
2.8 KiB
Python
# IMPORTATION THIRDPARTY
|
|
import pandas as pd
|
|
import pytest
|
|
|
|
# IMPORTATION INTERNAL
|
|
from openbb_terminal.economy import econdb_model
|
|
|
|
|
|
@pytest.mark.vcr
|
|
@pytest.mark.parametrize(
|
|
"parameter, country, transform, start_date, end_date, convert_currency",
|
|
[
|
|
["RGDP", "United States", "", "2005-05-05", "2006-01-01", False],
|
|
["EMP", "Germany", "", "2020-01-01", "2020-10-10", False],
|
|
["GDP", "France", "", "2015-01-01", "2020-10-10", False],
|
|
],
|
|
)
|
|
def test_get_macro_data(
|
|
parameter, country, transform, start_date, end_date, convert_currency
|
|
):
|
|
result_df, units = econdb_model.get_macro_data(
|
|
parameter, country, transform, start_date, end_date, convert_currency
|
|
)
|
|
|
|
assert isinstance(result_df, pd.Series)
|
|
assert isinstance(units, str)
|
|
assert not result_df.empty
|
|
|
|
|
|
@pytest.mark.vcr
|
|
@pytest.mark.parametrize(
|
|
"parameters, countries, transform, start_date, end_date, convert_currency",
|
|
[
|
|
[["RGDP"], ["United States", "Germany"], "", "2020-01-01", "2020-10-10", False],
|
|
[["EMP", "PPI"], ["France"], "", "2018-01-01", "2019-01-01", False],
|
|
[
|
|
["RGDP", "GDP"],
|
|
["Italy", "Netherlands"],
|
|
"",
|
|
"2010-01-01",
|
|
"2010-10-08",
|
|
False,
|
|
],
|
|
],
|
|
)
|
|
def test_get_aggregated_macro_data(
|
|
parameters, countries, transform, start_date, end_date, convert_currency
|
|
):
|
|
result_df, units, denomination = econdb_model.get_aggregated_macro_data(
|
|
parameters, countries, transform, start_date, end_date, convert_currency
|
|
)
|
|
|
|
assert isinstance(result_df, pd.DataFrame)
|
|
assert isinstance(units, dict)
|
|
assert isinstance(denomination, str)
|
|
assert not result_df.empty
|
|
|
|
|
|
@pytest.mark.vcr
|
|
@pytest.mark.parametrize(
|
|
"instruments, maturities, frequency, start_date, end_date",
|
|
[
|
|
[["nominal", "inflation"], ["3y", "5y"], "monthly", "2020-01-01", "2020-04-05"],
|
|
[["nominal"], ["1m", "30y"], "annually", "2015-01-04", "2015-01-28"],
|
|
[["average", "inflation"], ["3y", "5y"], "weekly", "2018-06-05", "2018-07-06"],
|
|
],
|
|
)
|
|
def test_get_treasuries(
|
|
recorder, instruments, maturities, frequency, start_date, end_date
|
|
):
|
|
result_df = econdb_model.get_treasuries(
|
|
instruments, maturities, frequency, start_date, end_date
|
|
)
|
|
|
|
recorder.capture(pd.DataFrame(result_df))
|
|
|
|
|
|
@pytest.mark.vcr
|
|
def test_get_treasury_maturities(recorder):
|
|
result_df = econdb_model.get_treasury_maturities()
|
|
|
|
recorder.capture(result_df)
|
|
|
|
|
|
def test_get_macro_countries():
|
|
result_dict = econdb_model.get_macro_countries()
|
|
|
|
assert isinstance(result_dict, dict)
|
|
|
|
|
|
def test_macro_parameters():
|
|
result_dict = econdb_model.get_macro_parameters()
|
|
|
|
assert isinstance(result_dict, dict)
|
|
|
|
|
|
def test_macro_transform():
|
|
result_dict = econdb_model.get_macro_transform()
|
|
|
|
assert isinstance(result_dict, dict)
|