evdspy 2.1.4__tar.gz → 2.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {evdspy-2.1.4 → evdspy-2.2.0}/PKG-INFO +39 -7
- {evdspy-2.1.4 → evdspy-2.2.0}/README.md +38 -6
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/components/evds_files.py +1 -1
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/config/apikey_class.py +26 -6
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/config/config.py +3 -5
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/index_requests/df_operations.py +1 -1
- evdspy-2.2.0/evdspy/EVDSlocal/index_requests/get_series_indexes.py +332 -0
- evdspy-2.2.0/evdspy/EVDSlocal/index_requests/get_series_indexes_exp.py +224 -0
- evdspy-2.2.0/evdspy/EVDSlocal/index_requests/get_series_indexes_utils.py +330 -0
- evdspy-2.2.0/evdspy/EVDSlocal/index_requests/index_util_funcs.py +96 -0
- evdspy-2.2.0/evdspy/EVDSlocal/index_requests/user_requests/Api_requester.py +208 -0
- evdspy-2.2.0/evdspy/EVDSlocal/index_requests/user_requests/Data_processor.py +70 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/index_requests/user_requests/Request_config.py +15 -5
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/index_requests/user_requests/Url_builder.py +6 -1
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/index_requests/user_requests/User_request_utils.py +3 -5
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/index_requests/user_requests/_Tables.py +1 -1
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/initial/load_commands_cmds_to_load.py +3 -4
- evdspy-2.2.0/evdspy/EVDSlocal/messages/error_classes.py +100 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/requests_/my_cache.py +3 -1
- evdspy-2.2.0/evdspy/EVDSlocal/tests/test_frequency.py +77 -0
- evdspy-2.2.0/evdspy/EVDSlocal/tests/test_multifreq_edge_cases.py +701 -0
- evdspy-2.2.0/evdspy/EVDSlocal/tests/test_v220_improvements.py +599 -0
- evdspy-2.2.0/evdspy/__init__.py +93 -0
- evdspy-2.2.0/evdspy/__version__.py +1 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/skills/evdspy/SKILL.md +58 -28
- {evdspy-2.1.4 → evdspy-2.2.0}/pyproject.toml +1 -1
- evdspy-2.1.4/evdspy/EVDSlocal/index_requests/get_series_indexes.py +0 -254
- evdspy-2.1.4/evdspy/EVDSlocal/index_requests/get_series_indexes_exp.py +0 -215
- evdspy-2.1.4/evdspy/EVDSlocal/index_requests/get_series_indexes_utils.py +0 -160
- evdspy-2.1.4/evdspy/EVDSlocal/index_requests/index_util_funcs.py +0 -131
- evdspy-2.1.4/evdspy/EVDSlocal/index_requests/user_requests/Api_requester.py +0 -194
- evdspy-2.1.4/evdspy/EVDSlocal/index_requests/user_requests/Data_processor.py +0 -65
- evdspy-2.1.4/evdspy/EVDSlocal/messages/error_classes.py +0 -28
- evdspy-2.1.4/evdspy/__init__.py +0 -54
- evdspy-2.1.4/evdspy/__version__.py +0 -1
- {evdspy-2.1.4 → evdspy-2.2.0}/LICENSE +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/__init__.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/common/__init__.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/common/clear_cache_folder.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/common/colors.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/common/common_imports.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/common/file_classes.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/common/files.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/common/folder_name_checks.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/common/prog.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/common/table.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/common/url_clean.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/components/__init__.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/components/api_params.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/components/api_params_enums.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/components/bucket_from_series.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/components/evds_seri_files.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/components/excel_class.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/components/options_class.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/components/request_or_cache.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/components/url_class.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/config/__init__.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/config/credentials_file.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/config/dotenv.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/console/__init__.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/console/menu.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/console/menu_async.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/console/menu_logo_header.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/console/panel.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/console/proxy_for_menu.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/console/screen.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/helper/__init__.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/helper/print_m.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/index_requests/__init__.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/index_requests/categories.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/index_requests/data_models.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/index_requests/datagroup_individual.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/index_requests/datagroups.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/index_requests/datagroups_extra.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/index_requests/datagroups_initial.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/index_requests/error_classes_index.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/index_requests/index_classes.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/index_requests/real_reqs_tests.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/index_requests/user_requests/Proxy_manager.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/index_requests/user_requests/Serialize.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/index_requests/user_requests/Url_series.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/index_requests/user_requests/User_req_typings.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/index_requests/user_requests/__init__.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/initial/__init__.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/initial/cache_folder.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/initial/cmd_line_classes.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/initial/command_pictures.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/initial/load_commands_.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/initial/load_modules.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/initial/sample_series_content.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/initial/start_args.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/initial/start_options.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/initial/try_loading_initial_commands.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/initial_setup/__init__.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/initial_setup/api_key_save.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/initial_setup/initial_setups.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/initial_setup/setup_folders.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/log_classes/__init__.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/log_classes/log_template.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/main_.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/manual_requests/__init__.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/manual_requests/prepare.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/messages/__init__.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/messages/cmd_formats.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/messages/current_menu_message.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/messages/error_messages.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/messages/help_messages.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/requests_/__init__.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/requests_/ev_request.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/requests_/lower_energy.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/requests_/mock_req.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/requests_/real_requests.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/requests_/request_error_classes.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/requests_/test_reg_result.pickle +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/series_format/__init__.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/series_format/populate_series.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/series_format/populate_series_helper.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/series_format/read_config_series.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/series_format/sample_series_content.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/series_format/series_creator.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/series_format/series_creator_on_setup.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/series_format/series_examples.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/series_format/series_format_config_funcs.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/series_format/stats/save_stats_of_requests.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/session/__init__.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/session/session_.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/setup_project/__init__.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/setup_project/read_config_series.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/setup_project/user_options_config.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/setup_project/user_series_config.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/setup_project/user_setup.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/setup_project/user_setup_helper.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/state/__init__.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/state/current_state.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/state/test_or_real.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/stats/__init__.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/stats/save_stats_of_requests.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/tests/__init__.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/tests/core_options_test.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/tests/test_apikey_checks.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/tests/test_categories.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/tests/test_datagroups.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/tests/test_get_proxies_env.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/tests/test_get_series.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/tests/test_get_series_exp.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/tests/test_get_series_exp_cache.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/tests/test_log_session.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/tests/test_main_load.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/tests/test_manual_series.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/tests/test_requests.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/tests/test_user_requests.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/tests/testing_mock_credentials.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/tests_main.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/utils/__init__.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/utils/github_actions.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/utils/utils_general.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/EVDSlocal/utils/utils_test.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/main.py +0 -0
- {evdspy-2.1.4 → evdspy-2.2.0}/evdspy/main_t.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: evdspy
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: A versatile interface for the 'EDDS' (EVDS) API of the Central Bank of the Republic of Türkiye (https://evds3.tcmb.gov.tr/dokumanlar). This package allows users to easily access and manage economic data through a user-friendly menu function. It features a robust caching mechanism to enhance the efficiency of data requests by storing frequently accessed data for selected periods. Required API keys can be obtained by registering on the EVDS website.
|
|
5
5
|
License: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -52,8 +52,15 @@ Description-Content-Type: text/markdown
|
|
|
52
52
|
pip install evdspy -U
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
### Updated on this version
|
|
56
|
-
-
|
|
55
|
+
### Updated on this version (2.2.0)
|
|
56
|
+
- **Built-in pagination** (`paginate=True` by default): `get_series` / `get_series_exp` automatically page backwards past EVDS's 1,000-row response limit so long daily/weekly ranges never silently lose history.
|
|
57
|
+
- **Consistent dates & flexible date inputs**: `Tarih` is always used as the date column (never `index`), `parse_dates=True` (default) normalizes all frequencies and aggregations into clean period-start `Timestamp`s, and `start_date`/`end_date` accept ISO `"YYYY-MM-DD"`, `datetime.date`/`datetime.datetime`, and `"DD-MM-YYYY"`.
|
|
58
|
+
- **Lazy `EVDS_API_KEY` resolution**: `EVDS_API_KEY` is read at request time rather than import time, so calling `load_dotenv()` or setting `os.environ["EVDS_API_KEY"]` after `import evdspy` works immediately.
|
|
59
|
+
- **Typed exceptions**: raises `EvdsAuthError`, `EvdsEmptyDataError`, and `EvdsRequestError` (all inheriting from `EvdsError`) instead of returning `False`/`None`.
|
|
60
|
+
- **Metadata-only helper**: `get_metadata(codes)` fetches series/datagroup metadata (`START.DATE`, `END.DATE`, `UNIT`, `FREQUENCY.STR`, etc.) without downloading observations.
|
|
61
|
+
- **Pandas 3 / 4 compatibility & clean exports**: removed all `inplace=True` deprecation warnings, exposed `evdspy.__version__`, and defined a clean `__all__`.
|
|
62
|
+
- ***frequency*** accepts aliases such as `yearly`, `quarter`, `month`, `week`, `semi-annual` and codes 1-8; unknown values raise a `ValueError` instead of silently returning daily data (2.1.5).
|
|
63
|
+
- ***AI agent skill*** added: `evdspy` ships a [`SKILL.md`](evdspy/skills/evdspy/SKILL.md) that teaches AI coding assistants (Claude Code, Cursor, Codex, Copilot, …) how to use this package correctly. See [Using evdspy with AI assistants](#using-evdspy-with-ai-assistants-skill).
|
|
57
64
|
- ***get_series_exp*** function was added
|
|
58
65
|
|
|
59
66
|
see [Documentation](https://evdspy-repo.readthedocs.io/en/latest/home.html) for its usage and result data types
|
|
@@ -268,16 +275,21 @@ from typing import Union
|
|
|
268
275
|
import pandas as pd
|
|
269
276
|
def get_series(
|
|
270
277
|
index: Union[str, tuple[str]],
|
|
271
|
-
start_date: str = '01-01-2000',
|
|
272
|
-
end_date: str = '01-01-2100',
|
|
273
|
-
frequency: str = None, # |
|
|
278
|
+
start_date: Union[str, date, datetime] = '01-01-2000', # 'DD-MM-YYYY', ISO 'YYYY-MM-DD', or date/datetime
|
|
279
|
+
end_date: Union[str, date, datetime] = '01-01-2100',
|
|
280
|
+
frequency: str = None, # | daily | business | weekly | semimonthly | monthly | quarterly | semiannually | annually (or code 1-8)
|
|
274
281
|
formulas: str = None, # | level | percentage_change | difference |
|
|
275
282
|
# | year_to_year_percent_change | year_to_year_differences |
|
|
276
283
|
aggregation: str = None, # | avg |min | max | first | last | sum
|
|
277
284
|
cache: bool = False,
|
|
278
285
|
proxy: str = None,
|
|
279
286
|
proxies: dict = None,
|
|
280
|
-
|
|
287
|
+
no_proxy: bool = False,
|
|
288
|
+
debug: bool = False,
|
|
289
|
+
api_key: str = None,
|
|
290
|
+
basic: bool = True,
|
|
291
|
+
paginate: bool = True,
|
|
292
|
+
parse_dates: bool = True,
|
|
281
293
|
) -> pd.DataFrame:
|
|
282
294
|
...
|
|
283
295
|
"""proxy
|
|
@@ -291,6 +303,26 @@ proxies = {
|
|
|
291
303
|
"""
|
|
292
304
|
```
|
|
293
305
|
|
|
306
|
+
### frequency names and aliases
|
|
307
|
+
|
|
308
|
+
`frequency` accepts the canonical names, common aliases (case, spaces, `-` and `_` are ignored) or the EVDS codes 1-8.
|
|
309
|
+
Unknown values raise a `ValueError` (before 2.1.5 they silently returned daily data).
|
|
310
|
+
|
|
311
|
+
| Code | Name | Also accepted |
|
|
312
|
+
|---|---|---|
|
|
313
|
+
| 1 | `daily` | `day`, `d` |
|
|
314
|
+
| 2 | `business` | `business day`, `workday`, `b` |
|
|
315
|
+
| 3 | `weekly` | `week`, `w` |
|
|
316
|
+
| 4 | `semimonthly` | `semi-monthly`, `twice monthly` |
|
|
317
|
+
| 5 | `monthly` | `month`, `m` |
|
|
318
|
+
| 6 | `quarterly` | `quarter`, `q` |
|
|
319
|
+
| 7 | `semiannually` | `semiannual`, `semi-annual`, `half-yearly`, `biannual` |
|
|
320
|
+
| 8 | `annually` | `annual`, `yearly`, `year`, `a`, `y` |
|
|
321
|
+
|
|
322
|
+
```python
|
|
323
|
+
get_series("TP.DK.USD.A.YTL", frequency="yearly", aggregation="avg") # same as "annually" or 8
|
|
324
|
+
```
|
|
325
|
+
|
|
294
326
|
## Documentation
|
|
295
327
|
|
|
296
328
|
Here is the documentation for other functions and details.
|
|
@@ -14,8 +14,15 @@
|
|
|
14
14
|
pip install evdspy -U
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
### Updated on this version
|
|
18
|
-
-
|
|
17
|
+
### Updated on this version (2.2.0)
|
|
18
|
+
- **Built-in pagination** (`paginate=True` by default): `get_series` / `get_series_exp` automatically page backwards past EVDS's 1,000-row response limit so long daily/weekly ranges never silently lose history.
|
|
19
|
+
- **Consistent dates & flexible date inputs**: `Tarih` is always used as the date column (never `index`), `parse_dates=True` (default) normalizes all frequencies and aggregations into clean period-start `Timestamp`s, and `start_date`/`end_date` accept ISO `"YYYY-MM-DD"`, `datetime.date`/`datetime.datetime`, and `"DD-MM-YYYY"`.
|
|
20
|
+
- **Lazy `EVDS_API_KEY` resolution**: `EVDS_API_KEY` is read at request time rather than import time, so calling `load_dotenv()` or setting `os.environ["EVDS_API_KEY"]` after `import evdspy` works immediately.
|
|
21
|
+
- **Typed exceptions**: raises `EvdsAuthError`, `EvdsEmptyDataError`, and `EvdsRequestError` (all inheriting from `EvdsError`) instead of returning `False`/`None`.
|
|
22
|
+
- **Metadata-only helper**: `get_metadata(codes)` fetches series/datagroup metadata (`START.DATE`, `END.DATE`, `UNIT`, `FREQUENCY.STR`, etc.) without downloading observations.
|
|
23
|
+
- **Pandas 3 / 4 compatibility & clean exports**: removed all `inplace=True` deprecation warnings, exposed `evdspy.__version__`, and defined a clean `__all__`.
|
|
24
|
+
- ***frequency*** accepts aliases such as `yearly`, `quarter`, `month`, `week`, `semi-annual` and codes 1-8; unknown values raise a `ValueError` instead of silently returning daily data (2.1.5).
|
|
25
|
+
- ***AI agent skill*** added: `evdspy` ships a [`SKILL.md`](evdspy/skills/evdspy/SKILL.md) that teaches AI coding assistants (Claude Code, Cursor, Codex, Copilot, …) how to use this package correctly. See [Using evdspy with AI assistants](#using-evdspy-with-ai-assistants-skill).
|
|
19
26
|
- ***get_series_exp*** function was added
|
|
20
27
|
|
|
21
28
|
see [Documentation](https://evdspy-repo.readthedocs.io/en/latest/home.html) for its usage and result data types
|
|
@@ -230,16 +237,21 @@ from typing import Union
|
|
|
230
237
|
import pandas as pd
|
|
231
238
|
def get_series(
|
|
232
239
|
index: Union[str, tuple[str]],
|
|
233
|
-
start_date: str = '01-01-2000',
|
|
234
|
-
end_date: str = '01-01-2100',
|
|
235
|
-
frequency: str = None, # |
|
|
240
|
+
start_date: Union[str, date, datetime] = '01-01-2000', # 'DD-MM-YYYY', ISO 'YYYY-MM-DD', or date/datetime
|
|
241
|
+
end_date: Union[str, date, datetime] = '01-01-2100',
|
|
242
|
+
frequency: str = None, # | daily | business | weekly | semimonthly | monthly | quarterly | semiannually | annually (or code 1-8)
|
|
236
243
|
formulas: str = None, # | level | percentage_change | difference |
|
|
237
244
|
# | year_to_year_percent_change | year_to_year_differences |
|
|
238
245
|
aggregation: str = None, # | avg |min | max | first | last | sum
|
|
239
246
|
cache: bool = False,
|
|
240
247
|
proxy: str = None,
|
|
241
248
|
proxies: dict = None,
|
|
242
|
-
|
|
249
|
+
no_proxy: bool = False,
|
|
250
|
+
debug: bool = False,
|
|
251
|
+
api_key: str = None,
|
|
252
|
+
basic: bool = True,
|
|
253
|
+
paginate: bool = True,
|
|
254
|
+
parse_dates: bool = True,
|
|
243
255
|
) -> pd.DataFrame:
|
|
244
256
|
...
|
|
245
257
|
"""proxy
|
|
@@ -253,6 +265,26 @@ proxies = {
|
|
|
253
265
|
"""
|
|
254
266
|
```
|
|
255
267
|
|
|
268
|
+
### frequency names and aliases
|
|
269
|
+
|
|
270
|
+
`frequency` accepts the canonical names, common aliases (case, spaces, `-` and `_` are ignored) or the EVDS codes 1-8.
|
|
271
|
+
Unknown values raise a `ValueError` (before 2.1.5 they silently returned daily data).
|
|
272
|
+
|
|
273
|
+
| Code | Name | Also accepted |
|
|
274
|
+
|---|---|---|
|
|
275
|
+
| 1 | `daily` | `day`, `d` |
|
|
276
|
+
| 2 | `business` | `business day`, `workday`, `b` |
|
|
277
|
+
| 3 | `weekly` | `week`, `w` |
|
|
278
|
+
| 4 | `semimonthly` | `semi-monthly`, `twice monthly` |
|
|
279
|
+
| 5 | `monthly` | `month`, `m` |
|
|
280
|
+
| 6 | `quarterly` | `quarter`, `q` |
|
|
281
|
+
| 7 | `semiannually` | `semiannual`, `semi-annual`, `half-yearly`, `biannual` |
|
|
282
|
+
| 8 | `annually` | `annual`, `yearly`, `year`, `a`, `y` |
|
|
283
|
+
|
|
284
|
+
```python
|
|
285
|
+
get_series("TP.DK.USD.A.YTL", frequency="yearly", aggregation="avg") # same as "annually" or 8
|
|
286
|
+
```
|
|
287
|
+
|
|
256
288
|
## Documentation
|
|
257
289
|
|
|
258
290
|
Here is the documentation for other functions and details.
|
|
@@ -162,7 +162,7 @@ ___________________
|
|
|
162
162
|
self.request_or_cache_resultInfo_.columns = df.columns
|
|
163
163
|
UnixTime = 'UNIXTIME'
|
|
164
164
|
if UnixTime in df.columns:
|
|
165
|
-
df.drop(UnixTime
|
|
165
|
+
df = df.drop(columns=[UnixTime])
|
|
166
166
|
if config.current_mode_is_test:
|
|
167
167
|
self.save_excel("testpytest2.xlsx")
|
|
168
168
|
return df
|
|
@@ -45,8 +45,11 @@ class ApiKeyValue:
|
|
|
45
45
|
|
|
46
46
|
def dot_get_env_evds():
|
|
47
47
|
api_key_env = os.getenv("EVDS_API_KEY")
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
if isinstance(api_key_env, str):
|
|
49
|
+
api_key_env = api_key_env.strip()
|
|
50
|
+
if len(api_key_env) > 5:
|
|
51
|
+
return ApiKeyValue("dotenv", api_key_env)
|
|
52
|
+
return ApiKeyValue("dotenv", False)
|
|
50
53
|
|
|
51
54
|
|
|
52
55
|
# assert dot_get_env_evds().value
|
|
@@ -169,16 +172,33 @@ class ApikeyClass(object):
|
|
|
169
172
|
print("set api not implemented")
|
|
170
173
|
raise "set api not implemented"
|
|
171
174
|
|
|
172
|
-
def
|
|
175
|
+
def get_stored_api_key(cls):
|
|
176
|
+
"""Return a stored (runtime/file/options) API key without env or test fallbacks."""
|
|
177
|
+
keys = [
|
|
178
|
+
cls.instance.APIKEYDict.runtime_apikey,
|
|
179
|
+
cls.instance.APIKEYDict.from_file_apikey,
|
|
180
|
+
cls.instance.APIKEYDict.from_file_options_api_key,
|
|
181
|
+
]
|
|
182
|
+
for key_obj in keys:
|
|
183
|
+
if isinstance(key_obj, ApiKeyValue):
|
|
184
|
+
if isinstance(key_obj.value, str) and key_obj.value.strip():
|
|
185
|
+
return key_obj.value.strip()
|
|
186
|
+
elif isinstance(key_obj, str) and key_obj.strip():
|
|
187
|
+
return key_obj.strip()
|
|
188
|
+
return False
|
|
173
189
|
|
|
190
|
+
def get_api_keys(cls):
|
|
191
|
+
# Always read EVDS_API_KEY lazily at call time so load_dotenv() or
|
|
192
|
+
# os.environ assignments made after importing evdspy take effect.
|
|
193
|
+
dotenv_key = dot_get_env_evds()
|
|
194
|
+
cls.instance.APIKEYDict.dotenv_api_key = dotenv_key
|
|
174
195
|
keys = [
|
|
175
|
-
|
|
176
|
-
cls.instance.APIKEYDict.dotenv_api_key,
|
|
196
|
+
dotenv_key,
|
|
177
197
|
cls.instance.APIKEYDict.runtime_apikey,
|
|
178
198
|
cls.instance.APIKEYDict.from_file_apikey,
|
|
179
199
|
cls.instance.APIKEYDict.from_file_options_api_key,
|
|
180
200
|
]
|
|
181
|
-
return [x for x in keys if x.value is not False]
|
|
201
|
+
return [x for x in keys if isinstance(x, ApiKeyValue) and x.value is not False]
|
|
182
202
|
|
|
183
203
|
def get_api_keys_dict(cls):
|
|
184
204
|
return cls.instance.APIKEYDict
|
|
@@ -8,11 +8,9 @@ from ..common.colors import *
|
|
|
8
8
|
from dataclasses import dataclass
|
|
9
9
|
from abc import ABC
|
|
10
10
|
def get_develop_vers_main():
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
v = v.replace("#", "")
|
|
15
|
-
return v
|
|
11
|
+
from evdspy.__version__ import __version__
|
|
12
|
+
|
|
13
|
+
return __version__
|
|
16
14
|
def version_raw():
|
|
17
15
|
v = get_develop_vers_main()
|
|
18
16
|
return v
|
|
@@ -34,7 +34,7 @@ class DFOperations():
|
|
|
34
34
|
df.columns = self.get_columns_from_first_row()
|
|
35
35
|
UnixTime = 'UNIXTIME'
|
|
36
36
|
if UnixTime in df.columns:
|
|
37
|
-
df.drop(UnixTime
|
|
37
|
+
df = df.drop(columns=[UnixTime])
|
|
38
38
|
if config.current_mode_is_test:
|
|
39
39
|
...
|
|
40
40
|
# self.save_excel("testpytest2.xlsx")
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from typing import Any, Literal, Optional, Sequence, Union
|
|
3
|
+
|
|
4
|
+
import pandas as pd
|
|
5
|
+
|
|
6
|
+
from evdspy.EVDSlocal.index_requests.get_series_indexes_utils import (
|
|
7
|
+
DateLike,
|
|
8
|
+
default_end_date_fnc,
|
|
9
|
+
default_start_date_fnc,
|
|
10
|
+
normalize_date,
|
|
11
|
+
parse_evds_dates,
|
|
12
|
+
)
|
|
13
|
+
from evdspy.EVDSlocal.index_requests.user_requests.Request_config import RequestConfig
|
|
14
|
+
from evdspy.EVDSlocal.messages.error_classes import EvdsEmptyDataError
|
|
15
|
+
|
|
16
|
+
# EVDS silently truncates long daily/weekly ranges to the latest 1,000 rows.
|
|
17
|
+
EVDS_PAGE_LIMIT = 1000
|
|
18
|
+
MAX_PAGINATION_PAGES = 100
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _extract_date_index(df: pd.DataFrame) -> Optional[pd.DatetimeIndex]:
|
|
22
|
+
if not isinstance(df, pd.DataFrame) or df.empty:
|
|
23
|
+
return None
|
|
24
|
+
if "Tarih" in df.columns:
|
|
25
|
+
return parse_evds_dates(df["Tarih"], name="Tarih")
|
|
26
|
+
if df.index.name == "Tarih" or isinstance(df.index, pd.DatetimeIndex):
|
|
27
|
+
return parse_evds_dates(df.index, name="Tarih")
|
|
28
|
+
return None
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _earliest_timestamp(df: pd.DataFrame) -> Optional[pd.Timestamp]:
|
|
32
|
+
dates = _extract_date_index(df)
|
|
33
|
+
if dates is None or len(dates) == 0:
|
|
34
|
+
return None
|
|
35
|
+
valid = dates.dropna()
|
|
36
|
+
if len(valid) == 0:
|
|
37
|
+
return None
|
|
38
|
+
return valid.min()
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _combine_pages(pages: Sequence[pd.DataFrame], basic: bool) -> pd.DataFrame:
|
|
42
|
+
ordered = list(reversed(pages))
|
|
43
|
+
if basic:
|
|
44
|
+
combined = pd.concat(ordered, ignore_index=True)
|
|
45
|
+
if "Tarih" in combined.columns:
|
|
46
|
+
sort_keys = parse_evds_dates(combined["Tarih"], name="_evds_sort_key")
|
|
47
|
+
combined = combined.assign(_evds_sort_key=sort_keys)
|
|
48
|
+
combined = combined.sort_values("_evds_sort_key", kind="mergesort")
|
|
49
|
+
combined = combined.drop_duplicates(subset=["_evds_sort_key"], keep="last")
|
|
50
|
+
combined = combined.drop(columns=["_evds_sort_key"]).reset_index(drop=True)
|
|
51
|
+
return combined
|
|
52
|
+
|
|
53
|
+
combined = pd.concat(ordered, ignore_index=False)
|
|
54
|
+
sort_keys = parse_evds_dates(combined.index, name="_evds_sort_key")
|
|
55
|
+
if not sort_keys.isna().all():
|
|
56
|
+
order = sort_keys.argsort(kind="mergesort")
|
|
57
|
+
combined = combined.iloc[order]
|
|
58
|
+
dedup_keys = sort_keys[order]
|
|
59
|
+
combined = combined.loc[~dedup_keys.duplicated(keep="last")]
|
|
60
|
+
return combined
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def get_series(
|
|
64
|
+
index: Union[str, tuple[Any, ...], list[Any]],
|
|
65
|
+
start_date: Optional[DateLike] = None,
|
|
66
|
+
end_date: Optional[DateLike] = None,
|
|
67
|
+
frequency: Union[
|
|
68
|
+
Literal[
|
|
69
|
+
"daily",
|
|
70
|
+
"monthly",
|
|
71
|
+
"quarterly",
|
|
72
|
+
"weekly",
|
|
73
|
+
"annually",
|
|
74
|
+
"semimonthly",
|
|
75
|
+
"semiannually",
|
|
76
|
+
"business",
|
|
77
|
+
None,
|
|
78
|
+
],
|
|
79
|
+
int,
|
|
80
|
+
str,
|
|
81
|
+
] = None,
|
|
82
|
+
formulas: Union[
|
|
83
|
+
Literal["level", "percentage_change", "difference"],
|
|
84
|
+
str,
|
|
85
|
+
int,
|
|
86
|
+
tuple[Any, ...],
|
|
87
|
+
list[Any],
|
|
88
|
+
None,
|
|
89
|
+
] = None,
|
|
90
|
+
aggregation: Union[
|
|
91
|
+
Literal["avg", "min", "max", "first", "last", "sum", None],
|
|
92
|
+
str,
|
|
93
|
+
tuple[Any, ...],
|
|
94
|
+
list[Any],
|
|
95
|
+
None,
|
|
96
|
+
] = None,
|
|
97
|
+
cache: bool = False,
|
|
98
|
+
proxy: Optional[str] = None,
|
|
99
|
+
proxies: Optional[dict[str, str]] = None,
|
|
100
|
+
no_proxy: bool = False,
|
|
101
|
+
debug: bool = False,
|
|
102
|
+
api_key: Optional[str] = None,
|
|
103
|
+
basic: bool = True,
|
|
104
|
+
paginate: bool = True,
|
|
105
|
+
parse_dates: bool = True,
|
|
106
|
+
) -> Union[pd.DataFrame, RequestConfig]:
|
|
107
|
+
"""Retrieve economic data series from the CBRT EVDS API as a pandas DataFrame.
|
|
108
|
+
|
|
109
|
+
Parameters
|
|
110
|
+
----------
|
|
111
|
+
index : str or sequence of str
|
|
112
|
+
Series code(s), multi-line template string, or datagroup code (``bie_...``).
|
|
113
|
+
start_date : str, datetime.date, datetime.datetime, or pd.Timestamp, optional
|
|
114
|
+
Start date in ``'DD-MM-YYYY'`` or ISO ``'YYYY-MM-DD'`` format, or a date object.
|
|
115
|
+
Defaults to ``default_start_date_fnc()``.
|
|
116
|
+
end_date : str, datetime.date, datetime.datetime, or pd.Timestamp, optional
|
|
117
|
+
End date in ``'DD-MM-YYYY'`` or ISO ``'YYYY-MM-DD'`` format, or a date object.
|
|
118
|
+
Defaults to ``default_end_date_fnc()``.
|
|
119
|
+
frequency : str or int, optional
|
|
120
|
+
Frequency name, alias (e.g. ``'yearly'``, ``'quarter'``, ``'month'``), or EVDS code 1-8.
|
|
121
|
+
formulas : str, int, or tuple, optional
|
|
122
|
+
Formula(s) applied per series.
|
|
123
|
+
aggregation : str or tuple, optional
|
|
124
|
+
Aggregation method(s) applied per series: ``avg``, ``min``, ``max``, ``first``, ``last``, ``sum``.
|
|
125
|
+
cache : bool, default False
|
|
126
|
+
If True, cache HTTP responses on disk.
|
|
127
|
+
proxy / proxies / no_proxy : optional
|
|
128
|
+
Proxy configuration.
|
|
129
|
+
debug : bool, default False
|
|
130
|
+
If True, perform a dry run and return ``RequestConfig`` without making an HTTP request.
|
|
131
|
+
api_key : str, optional
|
|
132
|
+
EVDS API key. Resolved lazily at request time from ``api_key``, ``EVDS_API_KEY``
|
|
133
|
+
environment variable, or saved key.
|
|
134
|
+
basic : bool, default True
|
|
135
|
+
If True, return ``'Tarih'`` as a regular column; if False, keep ``'Tarih'`` as the index.
|
|
136
|
+
paginate : bool, default True
|
|
137
|
+
If True, automatically page backwards past EVDS's 1,000-row response limit so long
|
|
138
|
+
daily/weekly ranges do not silently lose history.
|
|
139
|
+
parse_dates : bool, default True
|
|
140
|
+
If True, parse ``'Tarih'`` into clean period-start ``pd.Timestamp`` values across all
|
|
141
|
+
frequencies and aggregations. If False, keep the raw EVDS date labels in ``'Tarih'``.
|
|
142
|
+
|
|
143
|
+
Raises
|
|
144
|
+
------
|
|
145
|
+
ValueError
|
|
146
|
+
If ``frequency`` or ``start_date``/``end_date`` is invalid.
|
|
147
|
+
EvdsAuthError
|
|
148
|
+
If the API key is missing or rejected (HTTP 401/403).
|
|
149
|
+
EvdsEmptyDataError
|
|
150
|
+
If EVDS returns no observations for the requested series/date range.
|
|
151
|
+
EvdsRequestError
|
|
152
|
+
If the HTTP/network request fails or returns malformed JSON.
|
|
153
|
+
"""
|
|
154
|
+
resolved_start = normalize_date(
|
|
155
|
+
default_start_date_fnc() if start_date is None else start_date
|
|
156
|
+
)
|
|
157
|
+
resolved_end = normalize_date(
|
|
158
|
+
default_end_date_fnc() if end_date is None else end_date
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
first_page = get_series_internal(
|
|
162
|
+
index=index,
|
|
163
|
+
start_date=resolved_start,
|
|
164
|
+
end_date=resolved_end,
|
|
165
|
+
frequency=frequency,
|
|
166
|
+
formulas=formulas,
|
|
167
|
+
aggregation=aggregation,
|
|
168
|
+
cache=cache,
|
|
169
|
+
proxy=proxy,
|
|
170
|
+
proxies=proxies,
|
|
171
|
+
no_proxy=no_proxy,
|
|
172
|
+
debug=debug,
|
|
173
|
+
api_key=api_key,
|
|
174
|
+
basic=basic,
|
|
175
|
+
parse_dates=parse_dates,
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
if debug or not paginate or not isinstance(first_page, pd.DataFrame):
|
|
179
|
+
return first_page
|
|
180
|
+
|
|
181
|
+
start_ts = pd.Timestamp(datetime.strptime(resolved_start, "%d-%m-%Y"))
|
|
182
|
+
pages = [first_page]
|
|
183
|
+
current_page = first_page
|
|
184
|
+
prev_earliest: Optional[pd.Timestamp] = None
|
|
185
|
+
|
|
186
|
+
for _ in range(MAX_PAGINATION_PAGES - 1):
|
|
187
|
+
if len(current_page) < EVDS_PAGE_LIMIT:
|
|
188
|
+
break
|
|
189
|
+
|
|
190
|
+
earliest_ts = _earliest_timestamp(current_page)
|
|
191
|
+
if earliest_ts is None or pd.isna(earliest_ts):
|
|
192
|
+
break
|
|
193
|
+
if earliest_ts <= start_ts:
|
|
194
|
+
break
|
|
195
|
+
if prev_earliest is not None and earliest_ts >= prev_earliest:
|
|
196
|
+
break
|
|
197
|
+
prev_earliest = earliest_ts
|
|
198
|
+
|
|
199
|
+
window_end_ts = earliest_ts - pd.Timedelta(days=1)
|
|
200
|
+
if window_end_ts < start_ts:
|
|
201
|
+
break
|
|
202
|
+
window_end_str = window_end_ts.strftime("%d-%m-%Y")
|
|
203
|
+
|
|
204
|
+
try:
|
|
205
|
+
next_page = get_series_internal(
|
|
206
|
+
index=index,
|
|
207
|
+
start_date=resolved_start,
|
|
208
|
+
end_date=window_end_str,
|
|
209
|
+
frequency=frequency,
|
|
210
|
+
formulas=formulas,
|
|
211
|
+
aggregation=aggregation,
|
|
212
|
+
cache=cache,
|
|
213
|
+
proxy=proxy,
|
|
214
|
+
proxies=proxies,
|
|
215
|
+
no_proxy=no_proxy,
|
|
216
|
+
debug=False,
|
|
217
|
+
api_key=api_key,
|
|
218
|
+
basic=basic,
|
|
219
|
+
parse_dates=parse_dates,
|
|
220
|
+
)
|
|
221
|
+
except EvdsEmptyDataError:
|
|
222
|
+
break
|
|
223
|
+
|
|
224
|
+
if not isinstance(next_page, pd.DataFrame) or next_page.empty:
|
|
225
|
+
break
|
|
226
|
+
|
|
227
|
+
next_earliest = _earliest_timestamp(next_page)
|
|
228
|
+
if next_earliest is not None and next_earliest >= earliest_ts:
|
|
229
|
+
break
|
|
230
|
+
|
|
231
|
+
pages.append(next_page)
|
|
232
|
+
current_page = next_page
|
|
233
|
+
|
|
234
|
+
if len(pages) == 1:
|
|
235
|
+
return pages[0]
|
|
236
|
+
|
|
237
|
+
return _combine_pages(pages, basic=basic)
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
def get_series_internal(
|
|
241
|
+
index: Union[str, tuple[Any, ...], list[Any]],
|
|
242
|
+
start_date: Optional[DateLike] = None,
|
|
243
|
+
end_date: Optional[DateLike] = None,
|
|
244
|
+
frequency: Union[
|
|
245
|
+
Literal[
|
|
246
|
+
"daily",
|
|
247
|
+
"monthly",
|
|
248
|
+
"quarterly",
|
|
249
|
+
"weekly",
|
|
250
|
+
"annually",
|
|
251
|
+
"semimonthly",
|
|
252
|
+
"semiannually",
|
|
253
|
+
"business",
|
|
254
|
+
None,
|
|
255
|
+
],
|
|
256
|
+
int,
|
|
257
|
+
str,
|
|
258
|
+
] = None,
|
|
259
|
+
formulas: Union[
|
|
260
|
+
Literal["level", "percentage_change", "difference"],
|
|
261
|
+
str,
|
|
262
|
+
int,
|
|
263
|
+
tuple[Any, ...],
|
|
264
|
+
list[Any],
|
|
265
|
+
None,
|
|
266
|
+
] = None,
|
|
267
|
+
aggregation: Union[
|
|
268
|
+
Literal["avg", "min", "max", "first", "last", "sum", None],
|
|
269
|
+
str,
|
|
270
|
+
tuple[Any, ...],
|
|
271
|
+
list[Any],
|
|
272
|
+
None,
|
|
273
|
+
] = None,
|
|
274
|
+
cache: bool = False,
|
|
275
|
+
proxy: Optional[str] = None,
|
|
276
|
+
proxies: Optional[dict[str, str]] = None,
|
|
277
|
+
no_proxy: bool = False,
|
|
278
|
+
debug: bool = False,
|
|
279
|
+
api_key: Optional[str] = None,
|
|
280
|
+
basic: bool = True,
|
|
281
|
+
parse_dates: bool = True,
|
|
282
|
+
) -> Union[pd.DataFrame, RequestConfig]:
|
|
283
|
+
"""Execute a single EVDS series request without pagination."""
|
|
284
|
+
from evdspy.EVDSlocal.index_requests.user_requests import (
|
|
285
|
+
RequestConfig,
|
|
286
|
+
ProxyManager,
|
|
287
|
+
UrlBuilder,
|
|
288
|
+
DataProcessor,
|
|
289
|
+
)
|
|
290
|
+
from evdspy.EVDSlocal.index_requests.user_requests.Api_requester import ApiRequester
|
|
291
|
+
|
|
292
|
+
# ............RequestConfig................................
|
|
293
|
+
config = RequestConfig(
|
|
294
|
+
index=index,
|
|
295
|
+
start_date=start_date,
|
|
296
|
+
end_date=end_date,
|
|
297
|
+
frequency=frequency,
|
|
298
|
+
formulas=formulas,
|
|
299
|
+
aggregation=aggregation,
|
|
300
|
+
cache=cache,
|
|
301
|
+
)
|
|
302
|
+
# ............ProxyManager................................
|
|
303
|
+
proxy_manager = ProxyManager(proxy=proxy, proxies=proxies, no_proxy=no_proxy)
|
|
304
|
+
# ............UrlBuilder..................................
|
|
305
|
+
url_builder = UrlBuilder(config, url_type=None)
|
|
306
|
+
# ............ApiRequester................................
|
|
307
|
+
api_requester = ApiRequester(url_builder, proxy_manager, api_key=api_key)
|
|
308
|
+
|
|
309
|
+
if debug:
|
|
310
|
+
return api_requester.dry_request()
|
|
311
|
+
# ............DataProcessor................................
|
|
312
|
+
data_processor = DataProcessor(
|
|
313
|
+
api_requester(), config=config, parse_dates=parse_dates
|
|
314
|
+
)
|
|
315
|
+
df = data_processor()
|
|
316
|
+
if basic:
|
|
317
|
+
df = convert(df)
|
|
318
|
+
return df
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
def convert(df: pd.DataFrame) -> pd.DataFrame:
|
|
322
|
+
if not isinstance(df, pd.DataFrame):
|
|
323
|
+
return df
|
|
324
|
+
if df.index.name is not None:
|
|
325
|
+
df = df.reset_index()
|
|
326
|
+
if "Tarih_string" in df.columns:
|
|
327
|
+
df = df.drop(columns=["Tarih_string"])
|
|
328
|
+
return df
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
__all__ = ("get_series",)
|
|
332
|
+
|