Package: tcmb
tcmbtcmbis a Python API wrapper around the Central Bank of the Republic of Türkiye (TCMB) Web Service. It is anunofficialopen-source Python package intended for personal use (Disclaimer).tcmb, Türkiye Cumhuriyeti Merkez Bankası (TCMB) Web Servisi'ne Python aracılığıyla erişimi sağlayan resmi olmayan API uygulamasıdır. Kişisel kullanım ve araştırma maksadıyla hazırlanmıştır (Elektronik Veri Dağıtım Sistemi (EVDS) Kullanım Koşulları).Quickstartpipinstalltcmbimporttcmbclient=tcmb.Client(api_key="...")data=client.read(series="TP.DK.USD.S.YTL")OverviewData HierarchyCategories:Categories are at the top level of the TCMB data hierarchy.client=tcmb.Client(api_key="...")# show categoriesClient.categories{'CATEGORY_ID':1.0,'TOPIC_TITLE_ENG':'MARKET STATISTICS','TOPIC_TITLE_TR':'PİYASA VERİLERİ'}It is also possible to get the same information using theclient.get_categories_metadata()method.Data Groups:Each category consists of a number of data groups.client=tcmb.Client(api_key="...")# show data groupsClient.datagroups[{'DATAGROUP_CODE':'bie_pyrepo','CATEGORY_ID':1,'DATAGROUP_NAME':'Açık Piyasa Repo ve Ters Repo İşlemleri','DATAGROUP_NAME_ENG':'Open Market Repo and Reverse Repo Transactions',...}{'DATAGROUP_CODE':'bie_mkbral','CATEGORY_ID':0,'DATAGROUP_NAME':'Altın Borsası İşlemleri-İstanbul (TL-ABD Doları)(Arşiv)','DATAGROUP_NAME_ENG':'Istanbul Gold Exchange (TRY-USD)(Archive)',...}]It is also possible to filter the datagroups metadata using theclient.get_datagroups_metadata()method.SeriesDatagroups consist of time series, each having a series key such asTP.YSSK.A1orTP.DK.USD.S.YTL. Series is read using the.read()method.importtcmbclient=tcmb.Client(api_key="...")# read one time seriesdata=client.read("TP.YSSK.A1")# read multiple time seriesdata=client.read(["TP.YSSK.A1","TP.YSSK.A2","TP.YSSK.A3"])A convenient way to read time series without initializing the Client instance is using theread()function in thecore.pymodule.importtcmb# read one time seriesdata=tcmb.read("TP.YSSK.A1",api_key="...")# read multiple time seriesdata=tcmb.read(["TP.YSSK.A1","TP.YSSK.A2","TP.YSSK.A3"],api_key="...")Series metadata can be fetched with.get_series_metadata()method.# show metadata of each series within a data groupclient.get_series_metadata(datagroup="bie_yssk")[{'SERIE_CODE':'TP.YSSK.A1','DATAGROUP_CODE':'bie_yssk','SERIE_NAME':'1-2 Yıl(ABD doları)','SERIE_NAME_ENG':'1-2 Years(USD)',...},{'SERIE_CODE':'TP.YSSK.A2','DATAGROUP_CODE':'bie_yssk','SERIE_NAME':'3 Yıl(ABD doları)','SERIE_NAME_ENG':'3 Years(USD)',...}]# show metadata of a specific time seriesclient.get_series_metadata(series="TP.YSSK.A1")[{'SERIE_CODE':'TP.YSSK.A1','DATAGROUP_CODE':'bie_yssk','SERIE_NAME':'1-2 Yıl(ABD doları)','SERIE_NAME_ENG':'1-2 Years(USD)',...}]Wildcard CharactersThe wildcard characters are represented as an asterisk*or a question mark?. The asterisk*represents any number of characters, while the question mark?represents a single character. Additionally, omitting the value has the same effect as using an asterisk. Note that, wildcard character option is not a feature of TCMB web service. Wildcard pattern search is implemented within thetcmbpackage and depends on the package data.InstallationpipinstalltcmbAuthenticationAn API key is required to access the Web Service. Users can sign up from theloginpage. Once logged in, API Key is generated from the Profile page.There are two ways of providing API key to thetcmbclient.Using environment variables:$exportTCMB_API_KEY="..."importosos.environ["TCMB_API_KEY"]="..."Passingapi_keywhen initializing theClientclass.client=Client(api_key="...")Disclaimertcmbis anunofficialopen-source package intended for personal use and research purposes. Please see TCMB'sEVDS Disclaimerfor the official terms of use of the EVDS Web Service.