Skip to content

Commit

Permalink
Merge pull request #10 from SermetPekin/get_series
Browse files Browse the repository at this point in the history
docs
  • Loading branch information
SermetPekin authored Apr 16, 2024
2 parents 5b7759b + 7631109 commit d6e66c8
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions evdspy/EVDSlocal/index_requests/get_series_indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ def initial_api_process_when_given(api_key: str = None):
save_apikey(api_key)


"""
frequency: str = None, # monthly | weekly | annually | semimonthly | semiannually | business
formulas: str = None,
# level | percentage_change | difference | year_to_year_percent_change | year_to_year_differences |
aggregation: str = None, # avg |min | max | first | last | sum
"""


def get_series(
index: Union[str, tuple[Any, ...]],
start_date: str = default_start_date_fnc(),
Expand All @@ -28,7 +37,7 @@ def get_series(
debug: bool = False,
api_key: Optional[str] = None

) -> Union[pd.DataFrame, str]:
) -> Union[pd.DataFrame, RequestConfig]:
"""
Retrieves economic data series from the specified API and returns it as a pandas DataFrame.
Expand All @@ -41,11 +50,14 @@ def get_series(
end_date : str, optional
The end date for the data retrieval in 'DD-MM-YYYY' format, by default calls default_end_date_fnc().
frequency : str, optional
The frequency at which data should be retrieved. Examples include 'daily', 'monthly', 'yearly', etc.
The frequency at which data should be retrieved.
monthly | weekly | annually | semimonthly | semiannually | business
formulas : str or tuple of str, optional
The computation methods to apply to the data series, such as 'average', 'sum', etc.
The computation methods to apply to the data series
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, similar to formulas.
avg |min | max | first | last | sum
cache : bool, optional
If True, uses cached data when available to speed up the data retrieval process, by default False.
proxy : str, optional
Expand Down Expand Up @@ -109,24 +121,22 @@ def get_series(
return api_requester.dry_request()
"""DataProcessor"""
data_processor = DataProcessor(api_requester())
df = data_processor()
print(df.head())
return df
return data_processor()


def test_get_series2(capsys):
with capsys.disabled():
# setup()
df = get_series("TP.ODEMGZS.BDTTOPLAM",
cache=False)
cache=False)
assert isinstance(df, pd.DataFrame)


def t_stream():
import streamlit as st

df = get_series("TP.ODEMGZS.BDTTOPLAM",
cache=True)
cache=True)

st.write(df)

Expand Down

0 comments on commit d6e66c8

Please sign in to comment.