### setup Source: https://context7.com/sermetpekin/evdspy-repo/llms.txt Initializes the application environment by creating necessary folders, configuration files, and example templates. ```APIDOC ## setup ### Description Initializes the application environment by creating necessary folders, configuration files, and example templates. This function should be called once when first setting up evdspy in a new project. ### Method GET (Implicit) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python from evdspy import setup # Initialize evdspy environment setup() # This will: # - Create cache folders for storing API responses # - Generate example series configuration file # - Create user options configuration file # - Set up necessary directory structure ``` ### Command Line Interface ```bash # Setup from command line $ evdspy setup # Individual setup commands $ evdspy create series # Create series file template $ evdspy create options # Create options configuration file ``` ``` -------------------------------- ### Python Setup and Configuration Functions Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_modules/evdspy/EVDSlocal/initial/load_commands_cmds_to_load.html Manages the setup and configuration process for the application. It includes functions to perform initial setup, re-setup, and create example data. ```python def easy_setup(): setup() def setup_again(): setup() def setup(): SetupInitial().setup() start_setup_config(onsetup=True) create_series_text_example(onsetup=True) ``` -------------------------------- ### Library Initialization and Utility Functions Source: https://github.com/sermetpekin/evdspy-repo/blob/main/README.md Examples of how to import the library and access core utility functions like check, get, and help_evds. ```python from evdspy import * check() get() help_evds() ``` -------------------------------- ### Quick Start: Using get_series Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_sources/home.rst A basic example demonstrating how to fetch economic data using the `get_series` function. ```APIDOC ## Quick Start Here's a quick example to get you started with using **evdspy**: Using the ``get_series`` function from evdspy: .. code-block:: python from evdspy import get_series index = "TP.ODEMGZS.BDTTOPLAM" df = get_series(index, start_date="2020-01-21", end_date="2021-12-31", frequency="monthly") print(df.head()) ``` -------------------------------- ### Python Setup and API Key Check Functions Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_modules/evdspy/EVDSlocal/initial/load_commands_cmds_to_load.html Checks if the runtime setup is complete and if the API key is set before attempting to retrieve data. It guides the user through setting up the API key if it's missing. ```python def check_setup_runtime(): return not check_folders_setup_necessary() def check_if_api_set_before_get(): if not check_api_key(): print_with_failure_style(api_key_not_set_msg) wait(2) if get_input("yes/no ? ").lower() not in ["yes", "y"]: wait(2) return # below the function checks # if api key is valid then saves it if not set_apikey_input(): return False print_with_success_style("finished") return True return True ``` -------------------------------- ### Initialize evdspy Environment Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/setup.html Demonstrates how to import and execute the setup function to prepare the application environment. This function is intended to be called at the start of the application lifecycle. ```python from evdspy import setup # Initialize the application environment setup() ``` -------------------------------- ### Setup User Options and Create File (Python) Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_modules/evdspy/EVDSlocal/initial/load_commands_cmds_to_load.html These functions handle the setup of user options and the creation of a corresponding configuration file. `setup_user_options` initiates the setup process, and `create_options_file` calls it. `cof` is a shorthand alias. ```Python def setup_user_options(): start_setup_config(onsetup=False) def create_options_file(): setup_user_options() def cof(): create_options_file() ``` -------------------------------- ### Setup Series Steps (Python) Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_modules/evdspy/EVDSlocal/initial/load_commands_cmds_to_load.html This function initiates the setup process for series, likely involving multiple steps or configurations. It calls `start_setup_series` to begin the process. ```Python def setup_series(): start_setup_series() def setup_series_steps(): return setup_series() ``` -------------------------------- ### Quick Start: Using get_series_exp Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_sources/home.rst An example showing how to fetch economic data and its metadata using the `get_series_exp` function, with an option to export to Excel. ```APIDOC ## Quick Start Here's a quick example to get you started with using **evdspy**: Using the ``get_series_exp`` function from evdspy: .. code-block:: python from evdspy import get_series, get_series_exp index = "TP.ODEMGZS.BDTTOPLAM" result = get_series_exp(index, start_date="2020-01-21", end_date="2021-12-31", frequency="monthly") print(result.data) # data frame of data print(result.metadata) # metadata frame of data result.to_excel('filename.xlsx') # write output as excel file data and metadata in sheets ``` -------------------------------- ### Environment Variable Setup Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_sources/get_series_exp.rst Instructions on how to set up environment variables for API keys and proxies. ```APIDOC ## Environment Variable Setup ### Description Create a `.env` file in the root directory of your project to define your API key and proxies. ### Example `.env` file content: ```bash EVDS_API_KEY=AxByCzDsFoGmHeIgJaKrLbMaNgOe ``` ### Usage - **EVDS_API_KEY**: Your API key for accessing the EVDSPY service. - **PROXIES**: A dictionary defining proxy servers if needed. Example: `PROXIES={'http': 'http://user:pass@host:port', 'https': 'http://user:pass@host:port'}` ``` -------------------------------- ### evdspy Command Line Interface Examples Source: https://context7.com/sermetpekin/evdspy-repo/llms.txt Provides examples of using the evdspy command-line interface (CLI) for common operations. This includes displaying help, initializing the project environment, and launching the interactive menu. ```bash # Display help and documentation $ evdspy help # Initialize project environment $ evdspy setup # Launch interactive menu $ evdspy menu ``` -------------------------------- ### Data Fetching Examples Source: https://context7.com/sermetpekin/evdspy-repo/llms.txt Examples demonstrating how to fetch various types of economic data, including inflation expectations and CPI tables, with options for caching and exporting. ```APIDOC ## Fetch inflation expectations with metadata ### Description Fetches market and real sector inflation expectations data with associated metadata. ### Method GET (Implicit) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python from evdspy import get_series_exp inf_exp_market = """ TP.ENFBEK.PKA12ENF # Market participants inflation expectations (12-month ahead, %) """ inf_exp_real_sector = """ TP.ENFBEK.IYA12ENF # Real sector inflation expectations (12-month ahead, %) """ # Fetch market inflation expectations res_market = get_series_exp(inf_exp_market, cache=True, start_date="01-01-2010") print(f"Market Data shape: {res_market.data.shape}") print(f"Market Metadata: {res_market.metadata.columns.tolist()}") # Fetch real sector inflation expectations res_real = get_series_exp(inf_exp_real_sector, cache=True, start_date="01-01-2010") print(f"Real Sector Data shape: {res_real.data.shape}") print(f"Real Sector Metadata: {res_real.metadata.columns.tolist()}") ``` ## Fetch entire data groups by code ### Description Retrieves entire data tables for CPI and reserves, exporting them to Excel files. ### Method GET (Implicit) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python from evdspy import get_series_exp cpi_table = "bie_tukfiy4" # CPI table reserves_table = "bie_abres2" # Reserves table # Fetch and export CPI data result_cpi = get_series_exp(cpi_table, cache=True, start_date="01-01-2015") result_cpi.to_excel(f"{cpi_table.replace(' ', '_')}.xlsx") print(f"Exported {cpi_table}: {result_cpi.data.shape[0]} rows, {result_cpi.data.shape[1]} columns") # Fetch and export Reserves data result_reserves = get_series_exp(reserves_table, cache=True, start_date="01-01-2015") result_reserves.to_excel(f"{reserves_reserves.replace(' ', '_')}.xlsx") print(f"Exported {reserves_table}: {result_reserves.data.shape[0]} rows, {result_reserves.data.shape[1]} columns") ``` ## Multiple series with frequency and aggregation ### Description Fetches multiple series data within a specified date range, with options for frequency and metadata caching. ### Method GET (Implicit) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python from evdspy import get_series_exp indexes = ("TP.ENFBEK.PKA12ENF", "TP.ENFBEK.IYA12ENF") result = get_series_exp( indexes, start_date="01-01-2020", end_date="01-01-2024", frequency="monthly", cache=True, meta_cache=True # Cache metadata separately ) print(result.data.head()) result.write('inflation_expectations.xlsx') ``` ``` -------------------------------- ### Command Line Interface Source: https://context7.com/sermetpekin/evdspy-repo/llms.txt Provides a comprehensive CLI for setup, data retrieval, and configuration management. ```APIDOC ## Command Line Interface ### Description evds provides a comprehensive CLI for all major operations including setup, data retrieval, and configuration management. ### Method Not applicable (CLI commands) ### Endpoint Not applicable (CLI commands) ### Parameters None ### Request Example ```bash # Display help and documentation $ evdspy help # Initialize project environment $ evdspy setup # Launch interactive menu $ evdspy menu ``` ``` -------------------------------- ### Define and Check Command Line Commands (Python) Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_modules/evdspy/EVDSlocal/initial/load_commands_cmds_to_load.html This Python code defines a set of command-line commands using CommandLineCommandClass, including 'create series', 'help', 'create options', 'get', 'setup', 'menu', 'save', and 'console'. It also includes a function to check if a given command matches the defined command list. ```python import platform import sys import time import pandas as pd from evdspy.EVDSlocal.console.menu import MenuMaker, MenuItem from .cmd_line_classes import CommandLineCommandClass from evdspy.EVDSlocal.initial_setup.api_key_save import save_api_key_to_file from typing import Callable from ..common.prog import rich_sim from ..common.table import Table2_ from ..index_requests.categories import get_category_name from ..index_requests.datagroup_individual import get_series_list_of_subject, \ get_df_datagroup from ..messages.error_messages import * from ..messages.error_classes import * from evdspy.EVDSlocal.initial.load_modules import LoadModulesClass from ..initial_setup.initial_setups import * from ..requests.my_cache import delete_cache_folder from ..setup_project.user_setup import start_setup_series, start_setup_config from evdspy.EVDSlocal.initial_setup.setup_folders import check_folders_setup_necessary, check_setup from ..messages.help_messages import welcome_message from ..utils.utils_general import * from ..index_requests.datagroups import get_datagroups_with_code assert get_datagroups_with_code assert get_category_name assert get_series_list_of_subject """ Loaded functions for DF get_df_datagroup """ assert callable(get_df_datagroup) def check_which_command_params(params, extra_params: dict): create_series_cmd = CommandLineCommandClass(name_list=('create', 'series',), func=setup_series) help_cmd = CommandLineCommandClass(name_list=('help',), func=help_evds) create_options_cmd = CommandLineCommandClass(name_list=('create', 'options',), func=create_options_file) get_cmd = CommandLineCommandClass(name_list=('get',), func=get) setup_cmd = CommandLineCommandClass(name_list=('setup',), func=setup) menu_cmd = CommandLineCommandClass(name_list=('menu',), func=menu) save_cmd = CommandLineCommandClass(name_list=('save',), func=save) console_cmd = CommandLineCommandClass(name_list=('console',), func=console_load) menu_list = (create_series_cmd, create_options_cmd, get_cmd, setup_cmd, menu_cmd, help_cmd, save_cmd, console_cmd) def check_item_exists(element, format_cmd_list): return element in format_cmd_list def check_item_exists_wrapper(item): return check_item_exists(item, params) def check_cmd_will_apply(cmd_class: CommandLineCommandClass): # return check_item_exists, items return all(map(check_item_exists_wrapper, cmd_class.name_list)) ``` -------------------------------- ### Fetch Series with Date Range and Frequency - Python Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/source/get_series.md Shows how to retrieve data series for a specific date range and frequency. This example uses a list of series identifiers and specifies start and end dates along with the desired frequency. ```python from evdspy import get_series , get_series_exp , menu index = ["TP.MEVDUAT.I006", "TP.MEVDUAT.I012"] df = get_series( index, start_date="01-01-2010", end_date="01-01-2020", frequency="monthly" ) print(df.head()) ``` -------------------------------- ### Install and Import evdspy Source: https://github.com/sermetpekin/evdspy-repo/blob/main/Example_get_series_exp.ipynb This snippet shows how to install the evdspy library using pip and import necessary functions. ```python # !pip install evdspy -U from evdspy import get_series_exp, get_series ``` -------------------------------- ### evdspy Installation Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_sources/home.rst Instructions on how to install the evdspy Python package using pip. ```APIDOC ## Installation To install **evdspy**, simply run the following command: .. code-block:: bash pip install evdspy -U ``` -------------------------------- ### Access Interactive Menu Source: https://github.com/sermetpekin/evdspy-repo/blob/main/README.md Shows how to trigger the interactive menu for project setup and data requests, available both via Python script and the command line. ```python from evdspy import menu menu() ``` ```bash $ evdspy menu ``` -------------------------------- ### Install evdspy package Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_sources/home.rst Command to install or upgrade the evdspy library using pip. ```bash pip install evdspy -U ``` -------------------------------- ### Fetch Series with Formulas and Aggregation - Python Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/source/get_series.md Demonstrates applying specific formulas and aggregation methods to the data series. This example fetches raw data ('level') and aggregates it using the 'sum' method. ```python from evdspy import get_series template = """ TP.KREDI.L002 TP.BFTUKKRE.L004 TP.BFTUKKRE.L056 TP.BFTUKKRE.L193 TP.BFTUKKRE.L234 """ df = get_series(template, start_date="01-01-2020", formulas="level", aggregation="sum") print(df.head()) ``` -------------------------------- ### Streamlit Integration Example Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_modules/evdspy/EVDSlocal/index_requests/get_series_indexes.html Demonstrates how to display retrieved EVDS data series directly within a Streamlit application using the get_series function. ```python import streamlit as st def t_stream(): df = get_series("TP.ODEMGZS.BDTTOPLAM", cache=True) st.write(df) ``` -------------------------------- ### check Source: https://context7.com/sermetpekin/evdspy-repo/llms.txt Verifies the evdspy installation and configuration status. ```APIDOC ## check ### Description Verifies the evdspy installation and configuration status. Checks for required dependencies, API key configuration, and folder setup. ### Method GET (Implicit) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python from evdspy import check # Run configuration check check() # Output shows: # - Python version compatibility # - Required package availability # - API key configuration status # - Cache folder setup status ``` ``` -------------------------------- ### Environment File Configuration (.env) Source: https://github.com/sermetpekin/evdspy-repo/blob/main/Example_get_series_exp[2].ipynb This snippet shows an example of an .env file used for storing environment variables, such as API keys and proxy settings. It's important to restart the kernel after saving changes to this file. ```dotenv EVDS_API_KEY=AxByCzDsFoGmHeIgJaKrLbMaNgOe # while working behind proxy http_proxy=http://proxy.example.com:80 https_proxy=http://proxy.example.com:80 ``` -------------------------------- ### Comprehensive Data Retrieval Workflow Source: https://context7.com/sermetpekin/evdspy-repo/llms.txt A complete workflow demonstrating API key setup, data series definition, fetching data with caching, and exporting results to Excel. ```python from evdspy import get_series, get_series_exp, clear_cache, save save("YOUR_API_KEY_HERE") clear_cache() exchange_rates = "TP.DK.USD.A\nTP.DK.EUR.A\nTP.DK.GBP.A" df_fx = get_series(exchange_rates, start_date="01-01-2020", end_date="31-12-2023", frequency="monthly", aggregation="avg", cache=True) result_inflation = get_series_exp("TP.FG.J0", start_date="01-01-2015", frequency="monthly", cache=True, meta_cache=True) result_inflation.to_excel('inflation_analysis.xlsx') ``` -------------------------------- ### Retrieving Multiple Economic Indicators with Caching Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/source/examples.md This example demonstrates fetching various economic indicators like CPI, inflation expectations, and real sector inflation using `get_series_exp` with caching enabled. It iterates through a list of index strings, retrieves data and metadata for each, and prints them. Dependencies include the evdspy library. ```python from evdspy import get_series , get_series_exp CPI = """ TP.FG.J0 # Consumer Price Index """ inf_exp_market_part = """ TP.ENFBEK.PKA12ENF # Annual inflation expectations of market participants (12-month ahead, %) """ inf_exp_real_sector = """ TP.ENFBEK.IYA12ENF # Annual inflation expectations of real sector (12-month ahead, %) """ for index in [CPI, inf_exp_market_part, inf_exp_real_sector]: res = get_series_exp(index , cache = True , start_date = "01-01-2010" ) print(res.data) print(res.metadata) ``` -------------------------------- ### Launch Interactive evdspy Menu Source: https://context7.com/sermetpekin/evdspy-repo/llms.txt Launches an interactive text-based menu for evdspy functionalities, including setup, API key management, data retrieval, and cache management. This is useful for exploratory data analysis and initial configuration. ```python from evdspy import menu # Launch interactive menu menu() ``` -------------------------------- ### Retrieve Time Series Data with Caching using get_series_exp (Python) Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_sources/examples.rst Illustrates the use of the `cache=True` parameter with the `get_series_exp` function. Enabling caching can significantly speed up repeated requests for the same data within a single day by storing and reusing previous results. This example retrieves data and prints the result. ```python from evdspy import get_series_exp index = """ TP.DK.USD.A TP.DK.EUR.A TP.DK.CHF.A TP.DK.GBP.A TP.DK.JPY.A """ result = get_series_exp(index, cache = True , start_date="01-01-2017", end_date="31-12-2017" ) print(result.data) ``` -------------------------------- ### Check evdspy Installation and Configuration Source: https://context7.com/sermetpekin/evdspy-repo/llms.txt Verifies the evdspy installation and configuration status. It checks for required dependencies, API key configuration, and folder setup, providing output on the compatibility and status of the environment. ```python from evdspy import check # Run configuration check check() ``` -------------------------------- ### evdspy.setup() Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_sources/setup.rst Initializes the application environment by performing preparatory steps such as configuring settings, initializing data structures, and preparing necessary resources. ```APIDOC ## evdspy.setup() ### Description Initializes the application environment by performing multiple preparatory steps essential for the application's operation. This function encapsulates tasks such as configuring settings, initializing data structures, and preparing necessary resources. ### Purpose The function is designed to: - Initialize base settings and configurations via ``SetupInitial().setup()`` - Configure additional settings specific to the application setup phase with ``start_setup_config(onsetup=True)`` - Create initial data examples necessary for the application with ``create_series_text_example(onsetup=True)`` ### Usage The ``setup`` function is typically called at the beginning of the application's lifecycle, before any other operations or user interactions occur. ### Example Usage This function is generally used without arguments and does not return any value: ```python from evdspy import setup setup() ``` This call ensures that all initial configurations and setups are correctly executed, preparing the application for use. ``` -------------------------------- ### Get Series Data Source: https://github.com/sermetpekin/evdspy-repo/blob/main/Example_get_series_exp.ipynb Retrieves economic and financial time series data from EVDSPY. Allows specifying a start date and whether to use cached data. ```APIDOC ## GET /api/series ### Description Retrieves economic and financial time series data. You can specify a list of series IDs, a start date, and choose whether to use cached data. ### Method GET ### Endpoint /api/series ### Parameters #### Query Parameters - **ID** (string) - Required - A string containing one or more series IDs, separated by newlines. - **cache** (boolean) - Optional - If true, uses cached data. Defaults to true. - **start_date** (string) - Optional - The start date for the series in DD-MM-YYYY format. ### Request Example ```json { "ID": "TP_DK_usd_a.YTL\nTP_DK_eur_a.YTL", "cache": false, "start_date": "01-01-2005" } ``` ### Response #### Success Response (200) - **DataFrame** (pandas.DataFrame) - A DataFrame containing the requested time series data with a 'Tarih' column for dates. #### Response Example ```json { "DataFrame": [ {"TP_DK_USD_A_YTL": null, "TP_DK_EUR_A_YTL": null, "Tarih": "01-01-2005"}, {"TP_DK_USD_A_YTL": null, "TP_DK_EUR_A_YTL": null, "Tarih": "02-01-2005"}, {"TP_DK_USD_A_YTL": 1.3363, "TP_DK_EUR_A_YTL": 1.8233, "Tarih": "03-01-2005"} // ... more rows ] } ``` ``` -------------------------------- ### Initialize EVDSPY Application Environment Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_sources/setup.rst The setup function initializes the application environment by configuring settings, initializing data structures, and preparing necessary resources. It calls internal functions like SetupInitial().setup(), start_setup_config(onsetup=True), and create_series_text_example(onsetup=True) to perform these tasks. This function is typically called once at the beginning of the application's lifecycle and does not return any value. ```python from evdspy import setup setup() ``` -------------------------------- ### CLI Configuration and Data Retrieval Source: https://context7.com/sermetpekin/evdspy-repo/llms.txt Demonstrates the command-line interface usage for initializing configuration files, fetching data, and saving API credentials. ```bash evdspy create series evdspy create options evdspy get evdspy save ``` -------------------------------- ### Create Series File (Python) Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_modules/evdspy/EVDSlocal/initial/load_commands_cmds_to_load.html This function serves as a wrapper to create a series file by calling `create_series_text_example`. It's part of the series formatting utilities. ```Python from ..series_format.series_creator import * def create_series_file(): return create_series_text_example() def csf(): return create_series_file() ``` -------------------------------- ### GET evdspy.get_series_exp Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/source/get_series_exp.md Fetches economic data series and returns them as a pandas DataFrame. ```APIDOC ## GET evdspy.get_series_exp ### Description Retrieves economic data series from the specified API and returns it as a pandas DataFrame. Supports multiple series, custom date ranges, and data transformations. ### Method Python Function Call ### Parameters #### Arguments - **index** (str | tuple) - Required - The identifier(s) for the data series to fetch. - **start_date** (str) - Optional - Start date in 'DD-MM-YYYY' format (default: '01-01-2000'). - **end_date** (str) - Optional - End date in 'DD-MM-YYYY' format (default: '01-01-2100'). - **frequency** (str) - Optional - Data frequency: monthly, weekly, annually, semimonthly, semiannually, business. - **formulas** (str) - Optional - Transformation: level, percentage_change, difference, year_to_year_percent_change, year_to_year_differences. - **aggregation** (str) - Optional - Aggregation method: avg, min, max, first, last, sum. - **cache** (bool) - Optional - Use local cache for data (default: False). - **api_key** (str) - Optional - API key for authentication. ### Request Example ```python import evdspy df = evdspy.get_series_exp(index=('TP.DK.USD.A', 'TP.DK.EUR.A'), frequency='monthly', formulas='percentage_change') ``` ### Response #### Success Response (200) - **pd.DataFrame** - A pandas DataFrame containing the retrieved economic data series. #### Response Example ```python # Returns a pandas DataFrame indexed by date with series columns # TP.DK.USD.A TP.DK.EUR.A # 2023-01-01 0.012 0.008 ``` ``` -------------------------------- ### Configure API Key and Proxies using .env File Source: https://github.com/sermetpekin/evdspy-repo/blob/main/README.md Demonstrates how to configure the API key and proxy settings for the evdspy package by creating a .env file in the working directory. The library automatically loads these settings if the file is present. ```bash # filename : `.env` EVDS_API_KEY=AxByCzDsFoGmHeIgJaKrLbMaNgOe ``` ```bash # example `.env` file content EVDS_API_KEY=AxByCzDsFoGmHeIgJaKrLbMaNgOe http_proxy=http://proxy.example.com:80 https_proxy=http://proxy.example.com:80 ``` -------------------------------- ### Set Environment Variables on Windows Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/source/proxy.md Demonstrates how to set environment variables, including API keys and proxy settings, using the 'setx' command in the Windows Command Prompt. These variables are typically used by applications to access configuration. ```batch set EVDS_API_KEY=AxByCzDsFoGmHeIgJaKrLbMaNgOe set http_proxy=http://proxy.example.com:80 set https_proxy=http://proxy.example.com:80 ``` -------------------------------- ### Display Menu and Get User Choice Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/menu.html The menu function displays a user-friendly menu screen for various functionalities like saving API keys, getting data, and managing categories. It returns the index of the user's selected option. It expects a list of strings as options and raises a ValueError if the input is invalid. ```python from evdspy import menu menu() ``` -------------------------------- ### Configure API Key and Proxies Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/get_series.html Shows how to set up the environment for evdspy by creating a .env file for the API key and using the save function for persistence. ```bash evdspy save "YOUR_API_KEY" ``` ```text EVDS_API_KEY=AxByCzDsFoGmHeIgJaKrLbMaNgOe ``` -------------------------------- ### Main Menu Display and Functionality (Python) Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_modules/evdspy/EVDSlocal/initial/load_commands_cmds_to_load.html This function sets up and displays the main menu for the application. It defines a list of functions and their corresponding menu item descriptions, then uses `MenuMaker` to render the interactive menu. ```Python def main_exit_function(): ... def menu_display(): funcs = [ ("check setup", check), ("setup", setup), ("create user options file", create_options_file), ("create series file", create_series_file), ("add new series group ", setup_series_steps), ("get data", get), ("get categories (get all series of a datagroup)", get_categories_main), # next version # ("get data groups (on development) ", get_datagroups_data_main), # next version ("help", help_), ("show api key", show_apikey), ("save api key to file", set_apikey_input), ("remove cache folders", remove_cache), ("evdspy as a command line prompt", console_main_from_the_menu), ("version", version), ("py version", py_version), ("check compatibility of your python version", check_compat), ] menu_items = list(map(lambda x: MenuItem(x[1], x[0]), funcs)) MenuMaker( menu_items=menu_items, exit_item=True, exit_menu_call_back=main_exit_function ).display() ``` -------------------------------- ### GET /get_series Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/source/get_series.md Retrieves economic data series as a pandas DataFrame based on specified parameters. ```APIDOC ## GET get_series ### Description Fetches economic data series from the API and returns a pandas DataFrame. Supports multiple series, date ranges, and data transformations. ### Method GET (Internal Function Call) ### Parameters #### Path Parameters - **index** (str | tuple) - Required - The identifier(s) for the data series to fetch. #### Query Parameters - **start_date** (str) - Optional - Start date in 'DD-MM-YYYY' format (default: '01-01-2000'). - **end_date** (str) - Optional - End date in 'DD-MM-YYYY' format (default: '01-01-2100'). - **frequency** (str) - Optional - Data frequency: monthly, weekly, annually, semimonthly, semiannually, business. - **formulas** (str) - Optional - Transformation method: level, percentage_change, difference, year_to_year_percent_change, year_to_year_differences. - **aggregation** (str) - Optional - Aggregation method: avg, min, max, first, last, sum. - **cache** (bool) - Optional - Whether to use cached data (default: True). - **api_key** (str) - Optional - API key for authentication. ### Request Example ```python import evdspy df = evdspy.get_series('TP.DK.USD.A', start_date='01-01-2023', frequency='monthly') ``` ### Response #### Success Response (200) - **DataFrame** (pd.DataFrame) - A pandas DataFrame containing the requested economic data. #### Response Example ```json { "data": "DataFrame object containing columns for the requested series" } ``` ``` -------------------------------- ### Configure API Key and Proxies (.env file) Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_sources/get_series.rst This snippet demonstrates how to create a .env file to store sensitive information like API keys and proxy configurations for the evdspy library. This is a common practice for managing environment-specific settings. ```bash # Example .env file content EVDS_API_KEY=AxByCzDsFoGmHeIgJaKrLbMaNgOe ``` -------------------------------- ### GET /series/expanded Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_sources/examples.rst Retrieves economic data series with additional metadata and optional caching support. ```APIDOC ## GET /series/expanded ### Description Fetches time series data along with metadata, supporting efficient requests via a local cache. ### Method GET ### Endpoint get_series_exp(index, start_date, end_date, cache) ### Parameters #### Path Parameters - **index** (string) - Required - A newline-separated string of series codes. #### Query Parameters - **start_date** (string) - Optional - Start date in DD-MM-YYYY format. - **end_date** (string) - Optional - End date in DD-MM-YYYY format. - **cache** (boolean) - Optional - If True, enables caching of request results for the current day. ### Request Example result = get_series_exp(index, cache=True, start_date="01-01-2017", end_date="31-12-2017") ### Response #### Success Response (200) - **data** (DataFrame) - The requested time series data. - **metadata** (dict) - Metadata associated with the requested series. #### Response Example print(result.data) print(result.metadata) ``` -------------------------------- ### GET /evdspy/get_series_exp Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/get_series_exp.html Retrieves economic data series from the specified API and returns it as a dictionary of pandas DataFrames. ```APIDOC ## GET /evdspy/get_series_exp ### Description Fetches economic data series from the EVDS API based on provided identifiers and transformations. Returns a dictionary where keys are series identifiers and values are pandas DataFrames. ### Method GET ### Parameters #### Query Parameters - **index** (str | tuple) - Required - The identifier(s) for the data series to fetch. - **start_date** (str) - Optional - Start date in 'DD-MM-YYYY' format (default: '01-01-2000'). - **end_date** (str) - Optional - End date in 'DD-MM-YYYY' format (default: '01-01-2100'). - **frequency** (str) - Optional - Data frequency: monthly, weekly, annually, semimonthly, semiannually, business. - **formulas** (str) - Optional - Computation methods: level, percentage_change, difference, year_to_year_percent_change, year_to_year_differences. - **aggregation** (str) - Optional - Aggregation methods: avg, min, max, first, last, sum. - **cache** (bool) - Optional - Use cached data if available (default: False). - **proxy** (str) - Optional - Proxy server URL. ### Response #### Success Response (200) - **dict[str, DataFrame]** - A dictionary containing the requested data series mapped to their identifiers. ### Response Example { "TP.FG.J01": "" } ``` -------------------------------- ### Using API Key Parameter Source: https://github.com/sermetpekin/evdspy-repo/blob/main/Example_api_key[parameter].ipynb Demonstrates how to pass the API key directly as a parameter to the `get_series` function as an alternative to using environment variables. ```APIDOC ## Using API Key Parameter ### Description As an alternative to saving your API key in an environment file, you can provide it directly to the function using the `api_key` parameter. ### Method ```python from evdspy import get_series index = """ TP.DK.USD.A TP.DK.EUR.A TP.DK.CHF.A TP.DK.GBP.A TP.DK.JPY.A """ df = get_series(index, api_key = 'ABCDEFGH' , start_date="01-01-2017", end_date="31-12-2017" ) print(df.head()) ``` ### Response Example ``` TP_DK_USD_A TP_DK_EUR_A TP_DK_CHF_A TP_DK_GBP_A TP_DK_JPY_A Tarih 0 NaN NaN NaN NaN NaN 01-01-2017 1 3.5192 3.7099 3.4454 4.3189 3.0025 02-01-2017 2 3.5338 3.7086 3.4522 4.3488 3.0065 03-01-2017 3 3.5737 3.7278 3.4744 4.3840 3.0220 04-01-2017 4 3.5764 3.7291 3.4751 4.3794 3.0292 05-01-2017 ``` ``` -------------------------------- ### GET /get_series Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/source/get_series.md Retrieves economic data series based on specified indexes, dates, and transformation parameters. ```APIDOC ## GET /get_series ### Description Fetches one or more economic data series from the EVDS platform. Returns a pandas DataFrame containing the requested data. ### Method GET ### Endpoint get_series(index, start_date, end_date, frequency, formulas, aggregation, cache, api_key) ### Parameters #### Query Parameters - **index** (string/tuple) - Required - Identifier(s) for the data series. - **start_date** (string) - Optional - Start date in 'DD-MM-YYYY' format. - **end_date** (string) - Optional - End date in 'DD-MM-YYYY' format. - **frequency** (integer) - Optional - Data frequency (1: daily, 2: business, 3: weekly, 4: semimonthly, 5: monthly, 6: quarterly, 7: semiannually, 8: annual). - **formulas** (integer) - Optional - Transformation method (0: level, 1: percentage change, 2: difference, 3: year-to-year percent change, etc.). - **aggregation** (string) - Optional - Aggregation method (avg, min, max, first, last, sum). - **cache** (boolean) - Optional - Whether to use cached data. - **api_key** (string) - Required - The API key for authentication. ### Request Example ```python from evdspy import get_series df = get_series("TP.DK.USD.A", start_date="01-01-2020", api_key="YOUR_API_KEY") ``` ### Response #### Success Response (200) - **pd.DataFrame** (object) - A pandas DataFrame containing the requested time series data. #### Response Example ```json { "TP.DK.USD.A": [6.5, 6.6, 6.7] } ``` ``` -------------------------------- ### Apply Formulas and Aggregation to Data Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/source/get_series_exp.md Demonstrates how to apply specific mathematical formulas and aggregation methods to the retrieved data series using a template string. ```python from evdspy import get_series_exp template = """ TP.KREDI.L002 TP.BFTUKKRE.L004 TP.BFTUKKRE.L056 TP.BFTUKKRE.L193 TP.BFTUKKRE.L234 """ result = get_series_exp(template, formulas="level", aggregation="sum") print(result.data.head()) print(result.metadata) result.write('output.xlsx') result.to_excel('output2.xlsx') ``` -------------------------------- ### GET /series_exp Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/source/home.md Retrieves expanded data including metadata and provides utility methods for exporting to Excel. ```APIDOC ## GET /series_exp ### Description Retrieves both data and metadata for a series. The returned object includes methods to export the results directly to Excel. ### Method GET ### Endpoint get_series_exp(index, start_date, end_date, frequency) ### Parameters #### Query Parameters - **index** (string) - Required - The series identifier - **start_date** (string) - Optional - Start date - **end_date** (string) - Optional - End date - **frequency** (string) - Optional - Data frequency ### Request Example from evdspy import get_series_exp result = get_series_exp("TP.ODEMGZS.BDTTOPLAM", start_date="2020-01-21", end_date="2021-12-31") result.to_excel('output.xlsx') ### Response #### Success Response (200) - **data** (DataFrame) - The time series data - **metadata** (DataFrame) - Associated metadata for the series ``` -------------------------------- ### Get Series Data Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_modules/evdspy/EVDSlocal/index_requests/get_series_indexes_exp.html Retrieves economic data series from the specified API and returns it as a pandas DataFrame. ```APIDOC ## GET /api/series ### Description Retrieves economic data series from the specified API and returns it as a pandas DataFrame. ### Method GET ### Endpoint /api/series ### Parameters #### Query Parameters - **index** (str or tuple of str) - Required - The identifier(s) for the data series to fetch. 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. - **end_date** (str) - Optional - The end date for the data retrieval in 'DD-MM-YYYY' format. - **frequency** (str) - Optional - The frequency at which data should be retrieved. Allowed values: "monthly", "weekly", "annually", "semimonthly", "semiannually", "business", None. - **formulas** (str or tuple of str) - Optional - The computation methods to apply to the data series. Allowed values: "level", "percentage_change", "difference", "year_to_year_percent_change", "year_to_year_differences". - **aggregation** (str or tuple of str) - Optional - The aggregation methods to apply to the data. Allowed values: "avg", "min", "max", "first", "last", "sum", None. - **cache** (bool) - Optional - If True, uses cached data when available to speed up the data retrieval process. - **meta_cache** (bool) - Optional - If True, uses cached data for metadata when available to speed up the data retrieval process. - **proxy** (str) - Optional - The URL of the proxy server to use for the requests. - **proxies** (dict) - Optional - A dictionary of proxies to use for the request. - **debug** (bool) - Optional - If True, runs the function in debug mode, providing additional debug information without making a real API request. - **api_key** (str) - Optional - The API key required for accessing the data. It will be saved to a file for subsequent requests. ### Request Example ```json { "index": "SP500", "start_date": "01-01-2020", "end_date": "31-12-2020", "frequency": "monthly", "formulas": "level", "aggregation": "avg" } ``` ### Response #### Success Response (200) - **data** (pd.DataFrame) - A pandas DataFrame containing the retrieved data series. #### Response Example ```json { "data": "[Pandas DataFrame representation]" } ``` ### Error Handling - **ValueError**: If an invalid API key is provided or required parameters are missing. ``` -------------------------------- ### GET /series Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_sources/examples.rst Retrieves economic data series based on provided index strings and date ranges. ```APIDOC ## GET /series ### Description Fetches time series data for specified economic indicators within a defined date range. ### Method GET ### Endpoint get_series(index, start_date, end_date) ### Parameters #### Path Parameters - **index** (string) - Required - A newline-separated string of series codes (e.g., TP.DK.USD.A). #### Query Parameters - **start_date** (string) - Optional - Start date in DD-MM-YYYY format. - **end_date** (string) - Optional - End date in DD-MM-YYYY format. ### Request Example index = """ TP.DK.USD.A TP.DK.EUR.A """ df = get_series(index, start_date="01-01-2017", end_date="31-12-2017") ### Response #### Success Response (200) - **data** (DataFrame) - The requested time series data in a pandas DataFrame format. #### Response Example print(df.head()) ``` -------------------------------- ### Environment Variable Configuration Source: https://github.com/sermetpekin/evdspy-repo/blob/main/Example_api_key[parameter].ipynb This section shows how to configure your API key and proxy settings using a .env file. ```APIDOC ## Environment Variable Configuration ### Description Configure your API key and proxy settings by creating a `.env` file in your project directory. This method may require restarting your kernel after saving the file. ### File Content Example (.env) ```bash EVDS_API_KEY=AxByCzDsFoGmHeIgJaKrLbMaNgOe # while working behind proxy http_proxy=http://proxy.example.com:80 https_proxy=http://proxy.example.com:80 ``` ``` -------------------------------- ### GET /get_series_exp Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_modules/evdspy/EVDSlocal/index_requests/get_series_indexes_exp.html Retrieves series data and metadata using the evdspy library's internal request handling. ```APIDOC ## GET get_series_exp ### Description Fetches time series data and metadata from the EVDS API. Returns a Result object containing dataframes for both data and metadata, with helper methods to export to Excel. ### Method Python Function Call ### Parameters #### Arguments - **index** (Union[str, tuple]) - Required - The series code or list of codes to retrieve. - **proxy_manager** (Any) - Required - The proxy configuration manager instance. - **cache** (bool) - Optional - Whether to use cached results. Defaults to True. ### Request Example ```python result = get_series_exp(index="TP.DK.USD.A", proxy_manager=my_proxy) ``` ### Response #### Success Response (Result Object) - **data** (pd.DataFrame) - The time series data. - **metadata** (pd.DataFrame) - The metadata associated with the series. - **write** (Callable) - Method to export data and metadata to an Excel file with two sheets. #### Response Example { "data": "", "metadata": "", "write": "" } ``` -------------------------------- ### Configure EVDS API Key in .env Source: https://github.com/sermetpekin/evdspy-repo/blob/main/docs/build/html/_sources/get_series_exp.rst Shows how to store the EVDS API key in a .env file for secure access within the project environment. ```bash EVDS_API_KEY=AxByCzDsFoGmHeIgJaKrLbMaNgOe ```