From 1f80bce426c03b952d7b576b9053bcf7863057e5 Mon Sep 17 00:00:00 2001 From: Sermet Pekin Date: Fri, 19 Apr 2024 08:26:11 +0300 Subject: [PATCH] 1.1.21 --- docs/requirements.txt | 2 +- docs/source/get_series.rst | 56 ++++++++++++++----- .../index_requests/get_series_indexes.py | 16 +----- evdspy/__version__.py | 2 +- pyproject.toml | 2 +- 5 files changed, 47 insertions(+), 31 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 6126518..55cf737 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,3 @@ -evdspy +evdspy==1.1.21 sphinx_rtd_theme sphinx_book_theme \ No newline at end of file diff --git a/docs/source/get_series.rst b/docs/source/get_series.rst index eebe6d2..8e14eae 100644 --- a/docs/source/get_series.rst +++ b/docs/source/get_series.rst @@ -1,6 +1,7 @@ get_series Function =================== -The ``get_series`` function is designed to fetch economic data series from a specified API and return it formatted as a pandas DataFrame, making extensive use of various parameters to fine-tune the data retrieval process. + +The ``get_series`` function fetches economic data series from a specified API and returns it formatted as a pandas DataFrame, making extensive use of various parameters to fine-tune the data retrieval process. .. autofunction:: evdspy.get_series @@ -8,24 +9,60 @@ Parameters ---------- index : str or tuple Identifier(s) for the data series to fetch. This can be a single string for one series or a tuple of strings for multiple series. + start_date : str, optional The start date for the data retrieval in 'DD-MM-YYYY' format. By default, this calls ``default_start_date_fnc()``. + end_date : str, optional The end date for the data retrieval in 'DD-MM-YYYY' format. By default, this calls ``default_end_date_fnc()``. + frequency : str, optional - The frequency at which data should be retrieved, options include 'monthly', 'weekly', 'annually', 'semimonthly', 'semiannually', and 'business'. + The frequency at which data should be retrieved. Options include: + + - **daily (1)**: Data retrieved every day. + - **business (2)**: Data retrieved only on business days. + - **weekly (3)**: Data retrieved weekly on Fridays. + - **semimonthly (4)**: Data retrieved twice a month. + - **monthly (5)**: Data retrieved once a month. + - **quarterly (6)**: Data retrieved every quarter. + - **semiannually (7)**: Data retrieved twice a year. + - **annual/annually (8)**: Data retrieved once a year. + formulas : str or tuple, optional - Computation methods to apply to the data series, such as 'level', 'percentage_change', 'difference', 'year_to_year_percent_change', or 'year_to_year_differences'. + Computation methods to apply to the data series. Options include: + + - **level (0)**: Raw data values. + - **percentage change (1)**: Percent change between consecutive data points. + - **difference (2)**: Difference between consecutive data points. + - **year to year percent change (3)**: Percent change from the same date in the previous year. + - **year to year differences (4)**: Difference from the same date in the previous year. + - **percentage change compared to end-of-previous year (5)**: Percent change relative to the end of the previous year. + - **difference compared to end-of-previous year (6)**: Difference relative to the end of the previous year. + - **moving average (7)**: Moving average of data points. + - **moving sum (8)**: Moving sum of data points. + aggregation : str or tuple, optional - Aggregation methods to apply to the data, options include 'avg', 'min', 'max', 'first', 'last', and 'sum'. + Aggregation methods to apply to the data, options include: + + - **avg**: Average value over the specified period. + - **min**: Minimum value over the specified period. + - **max**: Maximum value over the specified period. + - **first**: First value within the specified period. + - **last**: Last value within the specified period. + - **sum**: Sum of all values within the specified period. + cache : bool, optional If True, uses cached data when available to speed up the data retrieval process. Default is False. + proxy : str, optional The URL of the proxy server to use for the requests. Default is None. + proxies : dict, optional A dictionary of proxies to use for the request. Default is None. + debug : bool, optional If True, runs the function in debug mode, providing additional debug information without making a real API request. Default is False. + api_key : str, optional The API key required for accessing the data. Initially, it can be saved using the ``save("APIKEY")`` function or via command line with ``$ evdspy save``. @@ -57,19 +94,12 @@ Using multiple indexes and cache: df = get_series(indexes, start_date="01-01-2020", frequency="monthly", cache=True) print(df.head()) -.. code-block:: python - - template = """ - TP.ODEMGZS.BDTTOPLAM - TP.ODEMGZS.ABD - """ - df = get_series(template, start_date="01-01-2020", frequency="monthly", cache=True) - print(df.head()) - Applying formulas and aggregation: .. code-block:: python + template = "TP.ODEMGZS.BDTTOPLAM" df = get_series(template, start_date="01-01-2020", formulas="level", aggregation="sum") print(df.head()) + diff --git a/evdspy/EVDSlocal/index_requests/get_series_indexes.py b/evdspy/EVDSlocal/index_requests/get_series_indexes.py index 01f125b..59aea88 100644 --- a/evdspy/EVDSlocal/index_requests/get_series_indexes.py +++ b/evdspy/EVDSlocal/index_requests/get_series_indexes.py @@ -63,21 +63,7 @@ def get_series( ------ ValueError If an invalid API key is provided or required parameters are missing. - Examples - -------- - Basic usage: - # >>> template = "TP.ODEMGZS.BDTTOPLAM" - # >>> df = get_series(template, start_date="01-01-2020", end_date="01-01-2021", frequency="monthly") - # >>> print(df.head()) - # - # Using multiple indexes and cache: - # >>> indexes = ("TP.ODEMGZS.BDTTOPLAM", "TP.ODEMGZS.ABD") - # >>> df = get_series(indexes, start_date="01-01-2020", frequency="monthly", cache=True) - # >>> print(df.head()) - # - # Applying formulas and aggregation: - # >>> df = get_series(template, start_date="01-01-2020", formulas="level", aggregation="sum") - # >>> print(df.head()) + """ # ............initial_api_process_when_given............... initial_api_process_when_given(api_key) diff --git a/evdspy/__version__.py b/evdspy/__version__.py index c2aebb8..4e5c486 100644 --- a/evdspy/__version__.py +++ b/evdspy/__version__.py @@ -1,2 +1,2 @@ -#1.1.20 \ No newline at end of file +#1.1.21 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index f204093..c94e322 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "evdspy" -version = "1.1.20" +version = "1.1.21" description = "A versatile interface for the 'EDDS' (EVDS) API of the Central Bank of the Republic of Türkiye (https://evds2.tcmb.gov.tr/index.php?/evds/userDocs). 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." authors = ["Sermet Pekin "] license = "MIT"