Library / SDK
saidsurucu/borsapy avatar
saidsurucu/borsapy

borsapy gives BIST data a yfinance shaped API, with a licence caveat

Python library for Turkish financial markets - BIST stocks, forex, crypto, funds, inflation

745 stars91 forksPythonApache-2.0

At a glance

What is it?
borsapy is a Python library for Turkish financial markets covering BIST stocks, forex, crypto, investment funds, inflation and the central bank EVDS macro database, with a yfinance-like API and a 25 command CLI. It suits a developer building analysis tools for Turkish markets, and its own disclaimer restricts the package to personal and educational use.
Who is it for?
Adopt borsapy when you are building analysis tooling for Turkish markets and want a familiar yfinance style surface over BIST, forex, crypto, funds, inflation and the EVDS macro catalogue, and when the personal and educational use restriction fits your situation.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 77 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.

Editorial analysis

The API mirrors yfinance on purpose

borsapy describes itself as a Python data library for Turkish financial markets, a yfinance-like API for BIST stocks, forex, crypto and investment funds plus economic data. The design choice to copy yfinance is the whole point of the project, because a Turkish developer who has used yfinance for US equities should not have to learn a new shape. The entry point is a Ticker object:

python
import borsapy as bp

hisse = bp.Ticker("THYAO")
print(hisse.info)
print(hisse.history(period="1ay"))
print(hisse.balance_sheet)

The same pattern covers multiple assets, with bp.download taking a list of tickers and a period, and the other asset classes get their own objects, bp.FX for a currency pair, bp.Crypto for a crypto pair, bp.Fund for an investment fund and bp.Inflation for the consumer price index. The package is on PyPI, the version is 0.11.0, it requires Python 3.10 or newer, and the packaging metadata marks it as Development Status 3 - Alpha, which is an honest signal about where to place your expectations. The dependencies are the standard data stack, with pandas for the frames, httpx for HTTP, websocket-client for the streaming path, beautifulsoup4 with lxml for scraping, pydantic for models, openpyxl for spreadsheet output, tradingview-screener, pymupdf4llm for PDF extraction, and typer with rich for the command line.

Price history comes from TradingView over a websocket, with a delay

The data source is the detail that changes how you use the library. A note in the documentation states that BIST price data is provided through the TradingView WebSocket API, with a default delay of about 15 minutes, and that a TradingView authentication section covers getting real time data. That delay is a hard constraint for anyone thinking of this as a trading data source. The history method takes a period, a start and end pair, an adjust flag and an interval, and the intervals cover the usual grid, with one minute, three minute, five minute, 15 minute, 30 minute and 45 minute candles, hourly candles over five days, and daily candles as the default. The adjust parameter defaults to split adjusted prices and can be turned off with adjust=False for raw prices. A dataframe comes back, so anything you can do with pandas you can do here.

Statements, bank formats and the TTM views

The financial statement coverage is wide and has one sharp edge. There are the annual statements, balance sheet, income statement and cash flow, the quarterly variants of each, and the trailing twelve month versions of the income statement and cash flow. The get_ methods let you pull more history than the current statements carry, with last_n taking a number of years, a quarterly flag and, for cash flow, the string all for every available period. The edge is the UFRS format for banks. Industrial companies default to the XI_29 format, and banks require the financial_group parameter set to UFRS, which produces a larger balance sheet of 130 rows and an income statement of 62 rows. A cash flow statement does not exist in the UFRS bank format, so get_cashflow is not available for them, and a bank ticker such as AKBNK is the case to remember. The fast_info attribute is a separate and cheaper read, returning last price, previous close, volume, market cap, price to earnings, free float and foreign ratio from a cache without an API call, while info loads everything.

A CLI with 25 plus commands and a screen language

The command line interface is not a thin wrapper. It covers price queries, history export, technical signals, live watching, screeners and financial statements:

bash
borsapy price THYAO GARAN ASELS
borsapy history THYAO --period 1y --output csv > thyao.csv
borsapy signals THYAO --interval 1h
borsapy watch THYAO GARAN --interval 0.5
borsapy scan "rsi < 30 and volume > 1000000" --index XU100
borsapy screen --template high_dividend --index XU030

Two of those lines are worth a second look. The scan command takes a condition string and an index, so you can express a filter over a market index rather than a hand-written list of tickers. The screen command takes a template by name, and high_dividend is one of them, so there is a library of ready made screeners behind that name. The CLI documentation in CLI.md covers 25 plus commands across price, history, technical analysis, financial statements and screening. The console output uses rich, which is what makes a terminal tool with tables and coloured output pleasant to use, and typer handles the argument parsing, so the entry point is registered as a single console script.

EVDS reaches the central bank's macro database

The part of the library that goes beyond market prices is EVDS, the Elektronik Veri Dağıtım Sistemi of the Turkish central bank, which the documentation describes as having 145 categories and tens of thousands of macro series. Access needs a key, which is described as free and obtainable from the central bank's EVDS portal, and the setup is a single call:

python
bp.set_evds_key("YOUR_EVDS_KEY")
print(bp.evds_series("TP.DK.USD.A.YTL", period="1y"))
print(bp.evds_series("TP.FG.J0", period="2y", formula="yoy_pct"))
print(bp.EVDS().categories)
print(bp.EVDS().search("dolar"))

The series identifiers are the central bank's own codes, and the formula argument computes derived values such as year on year percentage change, so you ask for the consumer price index series and get the inflation rate. The categories and search calls are the discovery mechanism, and the documentation notes that listing categories needs no key, which is a sensible way to design a catalogue endpoint. The library also exposes inflation directly through bp.Inflation, where latest returns the most recent consumer price index data.

The licence text and the package tag do not agree

This is the point to read carefully before you build anything on it. The package metadata records the licence as Apache-2.0 and the repository is listed under that licence, but the README opens with a disclaimer in both Turkish and English. The English text says the library is for personal and educational use only, that it cannot be used for developing commercial software products, commercial services, or any commercial purposes, and that for commercial use you must contact Borsa Istanbul to purchase an appropriate license. A permissive licence tag and a restriction that forbids commercial use are two different things, and when a project ships both the restriction is the one that binds a user in practice. The version 0.11.0 release note says the TEFAS asset allocation data now comes through a JSON endpoint, and the packaging metadata explains that the allocation extra is kept as an empty extra so existing install commands keep working, because the earlier Scrapling and Chromium based approach is no longer needed. The python-twitter extra pulls in Scweet for the Twitter and X tweet search, and the project also depends on the openai package, which is consistent with the AI features the API reference documents.

Editorial conclusion

Adopt borsapy when you are building analysis tooling for Turkish markets and want a familiar yfinance style surface over BIST, forex, crypto, funds, inflation and the EVDS macro catalogue, and when the personal and educational use restriction fits your situation. Do not adopt it for a commercial product, because the project states the library cannot be used for commercial software products or services and that commercial use requires buying a licence from Borsa Istanbul, whatever the Apache-2.0 tag in the package metadata says. Verify first that the delay and authentication model for TradingView price data fits your use, that the UFRS financial group parameter is set for bank statements, and that the EVDS key you obtain covers the series you need.

Frequently asked questions

How do I install borsapy and fetch a BIST stock?

Install with pip install borsapy, optionally pip install borsapy[twitter] for the tweet search extra, then create a Ticker and read its attributes: hisse = bp.Ticker("THYAO") gives you info, history and balance_sheet. The package requires Python 3.10 or newer and pandas 2.0 or newer.

Is borsapy allowed for commercial use?

The project states in its disclaimer that the library is for personal and educational use only and cannot be used for developing commercial software products, commercial services or any commercial purposes, and that commercial use requires contacting Borsa Istanbul to purchase an appropriate licence, even though the package metadata carries an Apache-2.0 licence field.

How fresh is the price data in borsapy?

BIST price data is provided through the TradingView WebSocket API and is delayed by about 15 minutes by default. The documentation points to a TradingView authentication section for real time data instead.

What financial statement formats does borsapy support for banks?

Industrial companies default to the XI_29 format, while banks need the financial_group parameter set to UFRS, which gives a balance sheet of 130 rows and an income statement of 62 rows. A cash flow statement does not exist in the UFRS bank format, so get_cashflow is not available for bank tickers.

Official sources

  1. Issues
  2. License: Apache-2.0
  3. README
  4. Releases
  5. saidsurucu/borsapy on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/saidsurucu-borsapy.svg)](https://hysenlabs.com/projects/saidsurucu-borsapy)

Was this useful?