Skip to main content

Tefas Crawler

PyPI version License: MIT Python Versions Package Status CI Build

Crawl public investment fund information from Turkey Electronic Fund Trading Platform (TEFAS) with ease.

Heads up — API rewrite (2026): TEFAS retired the legacy fundturkey.com.tr/api/DB/BindHistory* endpoints. This library now talks to the new tefas.gov.tr/api/funds/... JSON API. The new backend exposes prices per-fund only, with a fixed look-back enum ({1, 3, 6, 12, 36, 60} months, max 5 years). As a result:

  • fetch(start, end, name="YAC") is fast and complete.
  • fetch(start) with no name now fans out one HTTP request per fund and is capped at 50 funds by default with a UserWarning. Raise the cap with Crawler(fund_limit=N).
  • market_cap, number_of_shares, number_of_investors and the asset-allocation breakdown columns are no longer returned — the new API doesn't publish them as historical series. Calls that request these columns still run; missing columns are dropped with a warning.

Installation

pip install tefas-crawler

Usage

Import the Crawler object and create an instance of it.

from tefas import Crawler

tefas = Crawler()

API

fetch(start, end, name, columns, kind)

Argument Type Description Required
start string or datetime.datetime The date that fund information is crawled for. Yes
end string or datetime.datetime End of the period that fund information is crawled for. No
name string Name of the fund. If not given, all funds will be returned. No
columns[] list of string List of columns to be returned. No
kind string Type of the fund. One of YAT, EMK, or BYF. Defaults to YAT. No

Examples

Get all funds for a given day.

data = tefas.fetch(start="2020-11-20")

Get a specific fund for a time period, and select columns.

data = tefas.fetch(start="2020-11-15", end="2020-11-20", name="YAC", columns=["code", "date", "price"])

Data Schema

As of today, we support the following data schema from Tefas:

Column Description Type
date Sate date
price Price of the fund for a given date string
code Short code of the fund string
title Full name of the fund string
market_cap Total value of the fund float
number_of_shares Number of outstanding shares float
number_of_investors Number of participants float
bank_bills Share of bank bills float
exchange_traded_fund Share of exchange traded fund float
other Share of other float
fx_payable_bills Share of fx payable bills float
government_bond Share of government bond float
foreign_currency_bills Share of foreign currency bills float
eurobonds Share of eurobonds float
commercial_paper Share of commercial paper float
fund_participation_certificate Share of fund participation certificate float
real_estate_certificate Share of real estate certificate float
venture_capital_investment_fund_participation Share of venture capital investment fund float
real_estate_investment_fund_participation Share of real estate investment fund float
treasury_bill Share of treasury bill float
stock Share of stock float
government_bonds_and_bills_fx Share of government bonds and bills (fx) float
participation_account Share of participation account float
participation_account_au Share of gold participation account float
participation_account_d Share of foreign currency participation account float
participation_account_tl Share of Turkish Lira participation account float
government_lease_certificates Share of government lease certificates float
government_lease_certificates_d Share of foreign currency government lease certificates float
government_lease_certificates_tl Share of Turkish Lira government lease certificates float
government_lease_certificates_foreign Share of government foreign lease certificates float
precious_metals Share of precious metals float
precious_metals_byf Share of precious metals stock market investment fund float
precious_metals_kba Share of precious metals government dept instrument float
precious_metals_kks Share of precious metals public lease certificates float
public_domestic_debt_instruments Share of foreign exchange public domestic debt instruments float
private_sector_lease_certificates Share of private sector lease certificates float
private_sector_bond Share of private sector bond float
repo Share of repo float
derivatives Share of derivatives float
tmm Share of tmm float
reverse_repo Share of reverse-repo float
asset_backed_securities Share of asset-backed securities float
term_deposit Share of term deposit float
term_deposit_au Share of gold term deposit float
term_deposit_d Share of foreign currency term deposit float
term_deposit_tl Share of Turkish Lira term deposit float
futures_cash_collateral Share of futures cash collateral float
foreign_debt_instruments Share of foreign debt instruments float
foreign_domestic_debt_instruments Share of foreign domestic debt instruments float
foreign_private_sector_debt_instruments Share of foreign private sector debt instruments float
foreign_exchange_traded_funds Share of foreign exchange traded funds float
foreign_equity Share of foreign equity float
foreign_securities Share of foreign securities float
foreign_investment_fund_participation_shares Share of foreign investment fund participation float
private_sector_international_lease_certificate Share of private sector international lease certificate float
private_sector_foreign_debt_instruments Share of private sector foreign dept instruments float

To-do

  • Increase test coverage
  • Request error handling
  • Cache query results

License

MIT

Metadata

Release files for tefas-crawler 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tefas-crawler 0.6.0
File Size Uploaded Provenance Actions
tefas_crawler-0.6.0.tar.gz 10.6 kB Without provenance Details for tefas_crawler-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tefas-crawler 0.6.0
File Interpreter ABI Platform Actions
tefas_crawler-0.6.0-py3-none-any.whl Python 3 none any Details for tefas_crawler-0.6.0-py3-none-any.whl

Total release size: 20.3 kB

Release files / tefas_crawler-0.6.0.tar.gz

Download URL tefas_crawler-0.6.0.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9a56cbc2cabbcc8bd1fac663f9099406f2e182fd537ceeac58ba81ff13496410
BLAKE2b-256 checksum
How to use checksums
73c860ddc5533dce414d034f645d4dc56a53c08cab23d5d7b72e14c388739e27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / tefas_crawler-0.6.0-py3-none-any.whl

Download URL tefas_crawler-0.6.0-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
204138ec85f7a8f3450f6cf40174ad9e36042c8269fb067ba85c3d067f8b6d8f
BLAKE2b-256 checksum
How to use checksums
5c5068ff839cc1291a4f97ef6d83a7da28d550a3fb37405303aaaa165f5fbd88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for tefas-crawler 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page