5j9 / tsetmc

An async Python library to fetch data from https://tsetmc.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

An async Python library to fetch data from http://tsetmc.com.

Note: The API is provisional and may change rapidly without deprecation.

Installation

Requires Python 3.12 or later.

pip install tsetmc

Overview

Let's start with a simple script:

The Instrument class provides many methods for getting information about an instrument. The following code blocks try to demonstrate some of its capabilities.

Note: You need an asyncio capable REPL, like python -m asyncio or IPython, to run the following code samples, otherwise you'll have to run them inside an async function like the sample code above.

Getting the latest price information:

Getting the daily trade history for the last n days: (as a DataFrame)

Getting adjusted daily prices:

Getting intraday data for a specific date:

Searching for an instrument:

The instruments.price_adjustments function gets all the price adjustments for a specified flow.

The market_watch module contains several function to fetch market watch data. They include:

  • market_watch_init
  • market_watch_plus
  • closing_price_all
  • client_type_all
  • key_stats
  • ombud_messages
  • status_changes

Use market_watch.MarketWatch for watching the market. Here is how:

There are many other functions and methods that are not covered here. Explore the codebase to learn more.

If you are interested in other information available on tsetmc.com that this library has no API for, please open an issue for them.

See also

About

An async Python library to fetch data from https://tsetmc.com/

License:GNU General Public License v3.0


Languages

Language:Python 100.0%