Skip to main content

TEFAS (Türkiye Elektronik Fon Alım Satım Platformu) için modern Python istemcisi — yeni resmi API'leri kullanır.

Project description

pytefas

PyPI version Python versions License: MIT canary

TEFAS (Türkiye Elektronik Fon Alım Satım Platformu) için modern Python istemcisi.

Yeni TEFAS sitesinin (Next.js tabanlı, 2026'da yenilendi) doğrudan resmi API endpoint'lerini kullanır. Authorization, login veya API anahtarı gerektirmez.

API endpoints

  • https://www.tefas.gov.tr/api/funds/fonGnlBlgSiraliGetir - fund info (price / shares / size)
  • https://www.tefas.gov.tr/api/funds/dagilimSiraliGetirT - portfolio breakdown

Kurulum

pip install pytefas

Kullanım

Tek bir gün, fiyat bilgisi

from pytefas import Crawler

tefas = Crawler()
df = tefas.fetch("2026-04-24", columns="info", kind="YAT")
print(df.head())
        date kind fund_code                              fund_name      price  shares_outstanding  investor_count  portfolio_size
0 2026-04-24  YAT       AAK  ATA PORTFÖY ÇOKLU VARLIK DEĞİŞKEN FON   35.46418            999934.0           769.0    35461839.75
1 2026-04-24  YAT       AAL    ATA PORTFÖY PARA PİYASASI (TL) FONU   ...

Portföy varlık dağılımı

df = tefas.fetch("2026-04-24", columns="breakdown", kind="YAT")
# Sütunlar: stock_pct, government_bond_pct, repo_pct, foreign_stock_pct, ...

Tarih aralığı

df = tefas.fetch(start="2026-04-22", end="2026-04-24", columns="info", kind="YAT")

Tüm fon tiplerini birlikte (YAT + EMK + BYF)

df = tefas.fetch_many("2026-04-24", columns="info")
# 'kind' sütunu YAT/EMK/BYF değerlerini içerir

Parametreler

Crawler.fetch(start, end=None, kind="YAT", columns="info")

Parametre Tip Açıklama
start str veya datetime Başlangıç tarihi ('YYYY-MM-DD' formatı).
end str veya datetime veya None Bitiş tarihi. None = start ile aynı.
kind "YAT", "EMK", "BYF" Fon tipi: Yatırım / Emeklilik / Borsa Yatırım Fonu.
columns "info" veya "breakdown" Genel bilgi vs. portföy dağılımı.

Dönen DataFrame

  • columns="info" → 8 sütun: date, kind, fund_code, fund_name, price, shares_outstanding, investor_count, portfolio_size, exchange_bulletin_price
  • columns="breakdown" → 50+ sütun: tüm varlık sınıflarının yüzdeleri (ör. stock_pct, repo_pct, foreign_stock_pct, precious_metals_pct, vs.)

Tatil/hafta sonu için boş DataFrame döner.

Rate limiting

TEFAS API'si dakikada 6 istek sınırına sahiptir. Paket bunu otomatik handle eder - limit aşılırsa bekler ve yeniden dener. Manuel bir şey yapmanıza gerek yok.

Stabilite

TEFAS API'si halen genel kullanıma açıktır ancak resmi olarak dokümante edilmemiştir. TEFAS site değişikliği yaparsa paket güncellenmesi gerekebilir - issue açın veya PR gönderin.

Lisans

MIT - bkz. LICENSE.

Katkı

Pull request'ler memnuniyetle karşılanır. Major değişiklikler için önce issue açıp tartışalım.

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

pytefas-0.2.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

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

pytefas-0.2.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytefas-0.2.0.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for pytefas-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4a847f38f95ce67a151855e57e7924d47c9df0aed17eb7f668e82a654952c93a
MD5 4ef86ca6e3b4a04a5583a480592cf31d
BLAKE2b-256 2471b604e5b4613734ac50d02446279db967a1e8ab23134ba005f85ddc69fc55

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytefas-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for pytefas-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 14f7c96620d32dcee866897d9c2de82ad53d6ce9b397385779cf160081c56782
MD5 6c85c0b5de1c650965d0309f8b767487
BLAKE2b-256 c6f04fe925a861e8e96250f76e42d450fc86e68a8086a8f19e3db3d82a701a1d

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