https://github.com/kaymal/tcmb-py
Python API client to for Central Bank of the Republic of Türkiye (TCMB - CBRT) web service.
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.9%) to scientific vocabulary
Keywords
Repository
Python API client to for Central Bank of the Republic of Türkiye (TCMB - CBRT) web service.
Basic Info
- Host: GitHub
- Owner: kaymal
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://kaymal.github.io/tcmb-py/
- Size: 186 KB
Statistics
- Stars: 11
- Watchers: 2
- Forks: 2
- Open Issues: 0
- Releases: 4
Topics
Metadata Files
README.md
tcmb
tcmb is a Python API wrapper around the Central Bank of the Republic of Türkiye (TCMB) Web Service. It is an unofficial open-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ı).
Quickstart
shell
pip install tcmb
```python import tcmb
client = tcmb.Client(api_key="...")
data = client.read(series="TP.DK.USD.S.YTL") ```
Overview
Data Hierarchy
- Categories:
Categories are at the top level of the TCMB data hierarchy.
```python client = tcmb.Client(api_key="...")
show categories
Client.categories
{'CATEGORYID': 1.0, 'TOPICTITLEENG': 'MARKET STATISTICS', 'TOPICTITLE_TR': 'PİYASA VERİLERİ'} ```
It is also possible to get the same information using the client.get_categories_metadata() method.
- Data Groups:
Each category consists of a number of data groups.
```python client = tcmb.Client(api_key="...")
show data groups
Client.datagroups
[{'DATAGROUPCODE': 'biepyrepo', 'CATEGORYID': 1, 'DATAGROUPNAME': 'Açık Piyasa Repo ve Ters Repo İşlemleri', 'DATAGROUPNAMEENG': 'Open Market Repo and Reverse Repo Transactions', ...} {'DATAGROUPCODE': 'biemkbral', 'CATEGORYID': 0, 'DATAGROUPNAME': 'Altın Borsası İşlemleri-İstanbul (TL-ABD Doları)(Arşiv)', 'DATAGROUPNAMEENG': 'Istanbul Gold Exchange (TRY-USD)(Archive)', ...}] ```
It is also possible to filter the datagroups metadata using the client.get_datagroups_metadata() method.
- Series
Datagroups consist of time series, each having a series key such as TP.YSSK.A1 or TP.DK.USD.S.YTL. Series is read using the .read() method.
```python import tcmb
client = tcmb.Client(api_key="...")
read one time series
data = client.read("TP.YSSK.A1")
read multiple time series
data = 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 the read() function in the core.py module.
```python import tcmb
read one time series
data = tcmb.read("TP.YSSK.A1", api_key="...")
read multiple time series
data = tcmb.read(["TP.YSSK.A1", "TP.YSSK.A2", "TP.YSSK.A3"], api_key="...") ```
Series metadata can be fetched with .get_series_metadata() method.
```python
show metadata of each series within a data group
client.getseriesmetadata(datagroup="bie_yssk")
[{'SERIECODE': 'TP.YSSK.A1', 'DATAGROUPCODE': 'bieyssk', 'SERIENAME': '1-2 Yıl(ABD doları)', 'SERIENAMEENG': '1-2 Years(USD)', ...}, {'SERIECODE': 'TP.YSSK.A2', 'DATAGROUPCODE': 'bieyssk', 'SERIENAME': '3 Yıl(ABD doları)', 'SERIENAMEENG': '3 Years(USD)', ...}]
show metadata of a specific time series
client.getseriesmetadata(series="TP.YSSK.A1")
[{'SERIECODE': 'TP.YSSK.A1', 'DATAGROUPCODE': 'bieyssk', 'SERIENAME': '1-2 Yıl(ABD doları)', 'SERIENAMEENG': '1-2 Years(USD)', ...}] ```
Wildcard Characters
The 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 the tcmb package and depends on the package data.
```python
data = tcmb.read("TP.DK.USD.*.YTL") print(data.columns)
Index(['TPDKUSDAYTL', 'TPDKUSDSYTL', 'TPDKUSDCYTL', 'TPDKUSDAEFYTL', 'TPDKUSDSEFYTL'], dtype='object') ```
Installation
sh
pip install tcmb
Authentication
An API key is required to access the Web Service. Users can sign up from the login page. Once logged in, API Key is generated from the Profile page.
There are two ways of providing API key to the tcmb client.
- Using environment variables:
shell
$ export TCMB_API_KEY="..."
python
import os
os.environ["TCMB_API_KEY"] = "..."
- Passing
api_keywhen initializing theClientclass.
python
client = Client(api_key="...")
Disclaimer
tcmb is an unofficial open-source package intended for personal use and research purposes. Please see TCMB's EVDS Disclaimer for the official terms of use of the EVDS Web Service.
Owner
- Name: Kaymal
- Login: kaymal
- Kind: user
- Repositories: 3
- Profile: https://github.com/kaymal
Data Science | Computer Science | Operations Research
GitHub Events
Total
- Watch event: 2
Last Year
- Watch event: 2
Packages
- Total packages: 1
-
Total downloads:
- pypi 51 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 5
- Total maintainers: 1
pypi.org: tcmb
Central Bank of the Republic of Türkiye (TCMB) Python API.
- Documentation: https://tcmb.readthedocs.io/
- License: MIT License Copyright (c) 2022 T.Kaymal Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
Latest release: 0.4.1
published almost 2 years ago
Rankings
Maintainers (1)
Dependencies
- numpy *
- pandas *
- requests *
- numpy *
- pandas *
- requests *
- certifi ==2023.5.7
- charset-normalizer ==3.1.0
- idna ==3.4
- numpy ==1.24.3
- pandas ==2.0.2
- python-dateutil ==2.8.2
- pytz ==2023.3
- requests ==2.31.0
- six ==1.16.0
- tzdata ==2023.3
- urllib3 ==2.0.2