Skip to main content

Fetches fund data from the TEFAS website.

Project description

tefasfon v0.2.0

Türkçe tercih edenler için:

Those who prefer English can scroll down the page.

Açıklama

tefasfon, Türkiye Elektronik Fon Alım Satım Platformu'nun (TEFAS) resmi web sitesinde yayımlanan yatırım fonu ve emeklilik fonu verilerini programatik olarak çekmenizi sağlayan bir Python kütüphanesidir. Kütüphane, fon türü ve tarih aralığı seçimiyle esnek veri çekimi sunar. Mesajlar ve hata bildirimleri Türkçe/İngilizce desteklidir; çıktı doğrudan kullanıma hazır pandas DataFrame olarak döner ve isteğe bağlı olarak Excel dosyasına kaydedilebilir.

Özellikler

  • İstenilen tarih aralığında ve fon türüne göre TEFAS verilerini hızlıca çekebilirsiniz.
  • Fon bilgisi veya portföy dağılımı (iki farklı sekme) için veri alabilirsiniz.
  • Mesajlar ve hata uyarıları Türkçe/İngilizce gösterilir.
  • Kolay kullanım, çıktı olarak doğrudan pandas.DataFrame döner.
  • Çekilen verileri opsiyonel olarak Excel dosyasına kaydedebilirsiniz.
  • Selenium ile gerçek tarayıcı üzerinden veriler alınır, böylece web arayüzündeki tüm güncel verilere ulaşabilirsiniz.

Kurulum

Kütüphaneyi yüklemek için şu adımları izleyin:

  1. Python'ı yükleyin: https://www.python.org/downloads/
  2. Terminal veya komut istemcisinde aşağıdaki komutu çalıştırın:
pip install tefasfon

Belirli bir versiyonu yüklemek için:

pip install tefasfon==0.2.0

Yüklü versiyonu görüntülemek için:

pip show tefasfon

Fonksiyonlar

fetch_tefas_data

TEFAS web sitesinden fon veya portföy verisi çeker.

Parametreler:

  • fund_type_code (int): Fon tipi kodu
    • 0: Menkul Kıymet Yatırım Fonları
    • 1: Emeklilik Fonları
    • 2: Borsa Yatırım Fonları
    • 3: Gayrimenkul Yatırım Fonları
    • 4: Girişim Sermayesi Yatırım Fonları
  • tab_code (int): Sekme kodu
    • 0: Genel Bilgiler
    • 1: Portföy Dağılımı
  • start_date (str): Başlangıç tarihi, 'gg.aa.yyyy' formatında (örn. '17.07.2025')
  • end_date (str): Bitiş tarihi, 'gg.aa.yyyy' formatında (örn. '18.07.2025')
  • lang (str): "tr" veya "en" (varsayılan "tr")
  • save_to_excel (bool): True verilirse, Excel dosyasına kaydeder (varsayılan: False)
  • wait_seconds (int): Web işlemleri arası bekleme süresi (varsayılan: 3)

Dönüş:

  • pandas.DataFrame (veya veri yoksa boş DataFrame)

Örnek Kullanım

from tefasfon import fetch_tefas_data

df = fetch_tefas_data(
    fund_type_code=0,
    tab_code=0,
    start_date="17.08.2025",
    end_date="18.07.2025",
    lang="tr",
    save_to_excel=True
)

Notlar

  • Kütüphane, TEFAS'ın web sitesindeki verilere bağımlıdır. Herhangi bir değişiklikte veya bakımda, veri çekilemeyebilir. Lütfen TEFAS adresinden veri durumu ve güncelliğini kontrol edin.
  • Selenium ve ChromeDriver kullanılır. Bilgisayarınızda Google Chrome kurulu olmalı ve güncel olmalıdır.
  • Kütüphanenin geliştirilmesi ve iyileştirilmesi için geri bildirimlerinizi bekliyorum. GitHub reposuna katkıda bulunun: GitHub Repo
  • Herhangi bir sorun veya öneride lütfen GitHub reposundaki "Issue" bölümünden yeni bir konu açarak bildirim sağlayın: GitHub Issues

Sürüm Notları

v0.2.0 - 05/09/2025

  • Veri bulunmadığında güvenli dönüş sağlandı.
  • WebDriver/TFLite logları kaldırıldı.
  • Gün bazında ilerleme panelleri eklendi.
  • Açılır menü hata mesajı yerelleştirildi.

v0.1.0 - 20/07/2025

  • İlk sürüm yayınlandı.

Lisans

Bu proje MIT Lisansı altında lisanslanmıştır.

For those who prefer English:

Description

tefasfon is a Python package that enables you to programmatically fetch investment fund and pension fund data published on the official TEFAS website. The library offers flexible data fetching by fund type and date range. All messages and errors are displayed in Turkish or English. The output is delivered as a ready-to-use pandas DataFrame and can optionally be saved as an Excel file.

Features

  • Easily fetch TEFAS data for any desired date range and fund type.
  • Fetch either general fund information or portfolio breakdown (two separate tabs).
  • Errors and status messages are shown in Turkish or English.
  • Simple usage; output is directly returned as a pandas.DataFrame.
  • Optionally save the fetched data as an Excel file.
  • Uses Selenium for browser automation, ensuring access to up-to-date data from the web interface.

Installation

To use the package, follow these steps:

  1. Install Python: https://www.python.org/downloads/
  2. Open your terminal or command prompt and run:
pip install tefasfon

To install a specific version:

pip install tefasfon==0.2.0

To check the installed version:

pip show tefasfon

Functions

fetch_tefas_data

Fetches fund or portfolio data from the TEFAS website.

Parameters:

  • fund_type_code (int): Fund type code
    • 0: Securities Mutual Funds
    • 1: Pension Funds
    • 2: Exchange Traded Funds
    • 3: Real Estate Investment Funds
    • 4: Venture Capital Investment Funds
  • tab_code (int): Tab code
    • 0: General Information
    • 1: Portfolio Breakdown
  • start_date (str): Start date, in 'dd.mm.yyyy' format (e.g. '17.07.2025')
  • end_date (str): End date, in 'dd.mm.yyyy' format (e.g. '18.07.2025')
  • lang (str): "tr" or "en" (default "tr")
  • save_to_excel (bool): If True, saves the result to an Excel file (default: False)
  • wait_seconds (int): Wait time between web actions (default: 3)

Returns:

  • pandas.DataFrame (or an empty DataFrame if no data)

Example

from tefasfon import fetch_tefas_data

df = fetch_tefas_data(
    fund_type_code=0,
    tab_code=0,
    start_date="17.08.2025",
    end_date="18.07.2025",
    lang="en",
    save_to_excel=True
)

Notes

  • The library depends on data from the TEFAS official website. In case of any changes or maintenance, data fetching may not be possible. Please check the data status and availability on TEFAS.
  • Selenium and ChromeDriver are used. Google Chrome must be installed and up-to-date on your system.
  • I welcome your feedback to improve and develop the library. You can contribute to the GitHub repository: GitHub Repo
  • For any issues or suggestions, please open a new topic in the "Issue" section of the GitHub repository: GitHub Issues

Release Notes

v0.2.0 - 05/09/2025

  • Safe return when no data.
  • Suppressed WebDriver/TFLite logs.
  • Added per-date progress panels.
  • Localized dropdown error message.

v0.1.0 - 20/07/2025

  • First release published.

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tefasfon-0.2.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tefasfon-0.2.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file tefasfon-0.2.0.tar.gz.

File metadata

  • Download URL: tefasfon-0.2.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for tefasfon-0.2.0.tar.gz
Algorithm Hash digest
SHA256 97d18a1457ac3302c75e758692f793cb4ea03ea05f4ea1dc11be386d07645836
MD5 0fcd7b93e93500e78776dc86bad408ca
BLAKE2b-256 6a40c14be4b9f1bd74d6cccefa13aa636d5d8b49f3609ba767b6a090c8496ed6

See more details on using hashes here.

File details

Details for the file tefasfon-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: tefasfon-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for tefasfon-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f379185fd3010260cfb92b611d305504e235a9c1e2e18df48170acf199f4636
MD5 92fdad2f3fcc7304f78b1528560713f1
BLAKE2b-256 0cd59b37327126e0d488fc34b81d92723359d840ebff217cbd81b24832a91c42

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page