Skip to content

5j9/fipiran

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

269 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fipiran

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

Note

This package is incomplete and still in its initial development phase. The API may change without deprecation.

Installation

Requires Python 3.13+. Available on PyPI.

$ uv add fipiran

Usage

import asyncio
from fipiran.symbols import Symbol

async def main():
    symbol = await Symbol.from_name('فملی')
    company_info = await symbol.info()
    print(company_info.model_dump_json(indent=2))

asyncio.run(main())

There are two main modules:

  • funds
  • symbols

Most tabular data functions return a Polars LazyFrame for optimized, lazy query evaluations. Use an asyncio-aware REPL, like python -m asyncio, to run the code samples below.

Example 1: Historical Data via Polars LazyFrames

Because symbol.history() returns a Polars LazyFrame, you append .collect() to process or inspect the records eagerly:

>>> from fipiran.symbols import Symbol
>>> symbol = await Symbol.from_name('فملی')
>>> history_lf = await symbol.history(limit=1)
>>> history_lf.collect()
shape: (1, 16)
┌───────────────────┬─────────────────┬──────────────────────┬───┬────────────┬────────────┬────────────┬───────┐
│ insCodetransactionDatenumberOfTransactions ┆ … ┆ priceFirstpriceYest… ┆ lastStatushEven │
│ ---------                  ┆   ┆ ------------   │
│ strdatetime[μs]    ┆ f64                  ┆   ┆ f64f64i64i64   │
╞═══════════════════╪═════════════════╪══════════════════════╪═══╪════════════╪════════════╪════════════╪═══════╡
│ 354255876443374502025-10-0111586.0              ┆ … ┆ 6530.06530.00122949 │
└───────────────────┴─────────────────┴──────────────────────┴───┴────────────┴────────────┴────────────┴───────┘

Example 2: Querying Fund Records

Getting a listing of mutual funds as a LazyFrame. You can run expressions or filters before calling .collect() to grab the final data frame:

>>> from fipiran.funds import funds
>>> lf = await funds()
>>> lf.select(["regNo", "name", "isCompleted"]).limit(5).collect()
shape: (5, 3)
┌───────┬──────────────────────────┬─────────────┐
│ regNonameisCompleted │
│ ---------         │
│ strstrbool        │
╞═══════╪══════════════════════════╪═════════════╡
│ 11726جسورانه فیروزهtrue        │
│ 11603جسورانه فناوری بازنشستگیtrue        │
│ 11780گروه زعفران سحرخیزtrue        │
│ 11772طلای سرخ نو ویراtrue        │
│ 11480جسورانه یکم آرمان آتیtrue        │
└───────┴──────────────────────────┴─────────────┘

There are many other functions and methods. Please explore the code-base for more info.

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

See also

About

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

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages