urazakgul / isyatirimhisse

https://pypi.org/project/isyatirimhisse/
MIT License
101 stars 14 forks source link

isyatirimhisse v4.0.0

Türkçe tercih edenler için:

Those who prefer English can scroll down the page.

Açıklama

isyatirimhisse, İş Yatırım'ın web sitesinden veri çekme işlemlerini kolaylaştırmak amacıyla geliştirilmiş, isteğe göre özelleştirilebilir bir Python kütüphanesidir.

UYARI

isyatirimhisse, resmi İş Yatırım Menkul Değerler A.Ş. kütüphanesi değildir ve şirket tarafından doğrulanmamıştır. Kullanıcılar, kütüphaneyi kullanmadan önce ilgili tüm verilere erişim için İş Yatırım Menkul Değerler A.Ş.'nin kullanım koşullarını ve haklarını incelemelidir. isyatirimhisse, yalnızca kişisel kullanım amaçları için tasarlanmıştır.

İş Yatırım web sitesinden hisse senedi verileri ve finansal tablolara erişmek için Python paketini kullanırken, aşırı talep göndermenin potansiyel sonuçlarına dikkat etmek çok önemlidir. Aşırı talep aşağıdaki çeşitli olumsuz etkilere neden olabilir:

Bu sorunlardan kaçınmak ve sorunsuz bir işlem sağlamak için aşağıdaki önerileri dikkate alabilirsiniz.

Bu kurallara uymak, kesinti riskini en aza indirgeyebilir ve İş Yatırım web sitesinin hem sizin hem de diğer kullanıcılar için güvenilir bir deneyim sunmasını sağlar.

Kurulum

Kütüphaneyi kullanmak için aşağıdaki adımları izleyin:

  1. Python'ı sisteminize yükleyin: https://www.python.org/downloads/
  2. Terminali açın ve paketi yüklemek için aşağıdaki komutu çalıştırın:
pip install isyatirimhisse

Spesifik bir versiyona ait kurulum yapacaksanız aşağıdaki örnekte olduğu gibi komutu çalıştırabilirsiniz.

pip install isyatirimhisse==4.0.0

Yüklü paketin versiyonuna aşağıdaki komut yardımıyla ulaşabilirsiniz.

pip show isyatirimhisse

Kullanım

Kütüphanenin İçeri Aktarılması

from isyatirimhisse import StockData, Financials

Tanımlar

Metot Parametreleri ve Örnekler

StockData

StockData sınıfına ait get_data metodu bir pandas veri çerçevesi döndürür.

# Örnek 1: Tek hisse senedine ait başlangıç tarihi belli ve son işlem gününe kadar olan kapanış fiyatlarını al.

stock_data = StockData()

df = stock_data.get_data(
    symbols='THYAO',
    start_date='02-01-2023'
)
print(df)
# Örnek 2: Birden fazla hisse senedine ait başlangıç tarihi belli ve son işlem gününe kadar olan haftalık ortalama kapanış fiyatlarını TL bazında al.

stock_data = StockData()

df = stock_data.get_data(
    symbols=['THYAO','PGSUS'],
    start_date = '02-01-2023',
    exchange='0',
    frequency='1w',
    observation='mean'
)
print(df)

# Haftalık frekansta veriler Pazar günleri başlangıç kabul edilerek ayarlanmaktadır.
# Örnek 3: Birden fazla hisse senedine ait başlangıç ve bitiş tarihleri belli aylık USD fiyatları üzerinden logaritmik getirileri al.

stock_data = StockData()

df = stock_data.get_data(
    symbols=['THYAO','PGSUS'],
    start_date='01-01-2023',
    end_date='29-09-2023',
    exchange='1',
    frequency='1mo',
    return_type='1'
)
print(df)
# Örnek 4: Birden fazla hisse senedine ait başlangıç ve bitiş tarihleri belli çeyreklik USD fiyatları üzerinden basit getirileri al.

stock_data = StockData()

df = stock_data.get_data(
    symbols=['THYAO','PGSUS'],
    start_date='01-01-2023',
    end_date='29-09-2023',
    exchange='1',
    frequency='3mo',
    return_type='2'
)
print(df)
# Örnek 5: Birden fazla hisse senedine ait başlangıç ve bitiş tarihleri belli yıllık ortalama USD fiyatlarını al. Sonucu excel dosyasına kaydet.

stock_data = StockData()

df = stock_data.get_data(
    symbols=['THYAO','EUPWR'],
    start_date='01-01-2012',
    end_date='06-10-2023',
    exchange='1',
    frequency='1y',
    return_type='1',
    save_to_excel=True
)
print(df)

# Not: Örnekte bulunan EUPWR hisse senedinin 2023 yılı öncesi verileri olmadığı için çıktıda görünmeyecektir.

Financials

Financials fonksiyonunun get_data metodu bir sözlük döndürür.

# Örnek 1: Tek bir hisse senedi için finansal tabloları istenilen başlangıç yılından itibaren çek.

financials = Financials()

df = financials.get_data(
    symbols='THYAO',
    start_year='2020'
)
print(df)
# Örnek 2: Birden fazla hisse senedi için finansal tabloları istenilen başlangıç ve bitiş yılı aralığında çek.
# Sözlük tipinde saklanan verilerden istenen şirket aşağıdaki gibi çekilebilir.

financials = Financials()

df = financials.get_data(
    symbols=['THYAO','PGSUS'],
    start_year='2019',
    end_year='2023',
    exchange='TRY',
    financial_group='1',
    save_to_excel=True
)

import pandas as pd

df_thyao = pd.DataFrame(df['THYAO'])
# Örnek 3: Birden fazla hisse senedi için finansal tabloları istenilen başlangıç ve bitiş yılı aralığında çek.

financials = Financials()

df = financials.get_data(
    symbols=['THYAO','AKBNK'],
    start_year='2019',
    end_year='2023',
    exchange='TRY',
    financial_group='1',
    save_to_excel=True
)

# Not: Örnekte bulunan AKBNK hisse senedi Seri XI NO:29'a uymadığı için (UFRS kullanılmalı) çıktıda görünmeyecektir.

Notlar

Sürüm Notları

v0.1.0 - 25/07/2023

v0.1.1 - 27/07/2023

v0.2.0 - 30/07/2023

v0.2.1 - 31/07/2023

v1.0.0 - 05/08/2023

v2.0.0 - 10/08/2023

v2.1.0 - 12/08/2023

v2.1.1 - 13/08/2023

v2.1.2 - 13/08/2023

v2.1.3 - 13/08/2023

v3.0.0 - 19/08/2023

v3.0.1 - 20/08/2023

v3.0.2 - 05/10/2023

v4.0.0 - 07/10/2023

Lisans

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

Katkıda Bulunanlar

For those who prefer English:

Description

isyatirimhisse is a customizable Python library developed to simplify data fetching from Is Investment's website.

WARNING

isyatirimhisse is not the official Is Investment Securities library and has not been verified by the company. Users should review Is Investment Securities' terms of use and rights to access all relevant data before using the library. isyatirimhisse is intended for personal use only.

When using the Python package to access stock data and financial statements from the Is Investment website, it is crucial to be mindful of the potential consequences of excessive requests. Excessive requests can lead to various adverse effects:

To avoid these issues and ensure smooth operations, consider the following recommendations:

Adhering to these guidelines can minimize the risk of interruptions and ensure that the Is Investment website provides a reliable experience for both you and other users.

Installation

Follow the steps below to use the library:

  1. Install Python on your system: https://www.python.org/downloads/
  2. Open the terminal and run the following command to install the package:
pip install isyatirimhisse

If you want to install a specific version, you can run the command as in the example below.

pip install isyatirimhisse==4.0.0

You can find the version of the installed package with the following command.

pip show isyatirimhisse

Usage

Importing the Library

from isyatirimhisse import StockData, Financials

Definitions

Method Parameters and Examples

StockData

The get_data method of the StockData class returns a pandas DataFrame.

# Example 1: Retrieve the closing prices for a single stock with a specified start date and up to the last trading day.

stock_data = StockData()

df = stock_data.get_data(
    symbols='THYAO',
    start_date='02-01-2023'
)
print(df)
# Example 2: Retrieve the weekly average closing prices in Turkish Lira for multiple stocks with specified start dates and up to the last trading day.

stock_data = StockData()

df = stock_data.get_data(
    symbols=['THYAO','PGSUS'],
    start_date = '02-01-2023',
    exchange='0',
    frequency='1w',
    observation='mean'
)
print(df)

# The data is adjusted with a weekly frequency, considering Sunday as the starting point.
# Example 3: Compute the logarithmic returns for multiple stocks with known start and end dates, using monthly USD prices.

stock_data = StockData()

df = stock_data.get_data(
    symbols=['THYAO','PGSUS'],
    start_date='01-01-2023',
    end_date='29-09-2023',
    exchange='1',
    frequency='1mo',
    return_type='1'
)
print(df)
# Example 4: Compute the simple returns for multiple stocks with known start and end dates, using quarterly USD prices.

stock_data = StockData()

df = stock_data.get_data(
    symbols=['THYAO','PGSUS'],
    start_date='01-01-2023',
    end_date='29-09-2023',
    exchange='1',
    frequency='3mo',
    return_type='2'
)
print(df)
# Example 5: Retrieve the annual average USD prices for multiple stocks with known start and end dates. Save the result to an Excel file.

stock_data = StockData()

df = stock_data.get_data(
    symbols=['THYAO','EUPWR'],
    start_date='01-01-2012',
    end_date='06-10-2023',
    exchange='1',
    frequency='1y',
    return_type='1',
    save_to_excel=True
)
print(df)

# Note: Data for the EUPWR stock before the year 2023 is unavailable, and therefore, it will not be displayed in the output.

Financials

The get_data method of the Financials class returns a dictionary.

# Example 1: Retrieve financial statements for a single stock starting from the desired start year.

financials = Financials()

df = financials.get_data(
    symbols='THYAO',
    start_year='2020'
)
print(df)
# Example 2: Retrieve financial statements for multiple stocks within the desired start and end year range.
# The desired company can be extracted from data stored in a dictionary as shown below.

financials = Financials()

df = financials.get_data(
    symbols=['THYAO','PGSUS'],
    start_year='2019',
    end_year='2023',
    exchange='TRY',
    financial_group='1',
    save_to_excel=True
)

import pandas as pd

df_thyao = pd.DataFrame(df['THYAO'])
# Example 3: Retrieve financial statements for multiple stocks within the desired start and end year range.

financials = Financials()

df = financials.get_data(
    symbols=['THYAO','AKBNK'],
    start_year='2019',
    end_year='2023',
    exchange='TRY',
    financial_group='1',
    save_to_excel=True
)

# Note: The AKBNK stock featured in the example will not appear in the output due to non-compliance with Series XI NO:29 (IFRS should be used).

Notes

Release Notes

v0.1.0 - 25/07/2023

v0.1.1 - 27/07/2023

v0.2.0 - 30/07/2023

v0.2.1 - 31/07/2023

v1.0.0 - 05/08/2023

v2.0.0 - 10/08/2023

v2.1.0 - 12/08/2023

v2.1.1 - 13/08/2023

v2.1.2 - 13/08/2023

v2.1.3 - 13/08/2023

v3.0.0 - 19/08/2023

v3.0.1 - 20/08/2023

v3.0.2 - 05/10/2023

v4.0.0 - 07/10/2023

License

This project is licensed under the MIT License.

Contributors