Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date in Fipiran #1

Closed
alikhodarahmii opened this issue Aug 25, 2023 · 1 comment
Closed

Date in Fipiran #1

alikhodarahmii opened this issue Aug 25, 2023 · 1 comment

Comments

@alikhodarahmii
Copy link

Hi, thanks for amazing library
In this library can we specify date to get data for specific time period?
Such as NAV for specific fund from 2020/1/1 to 2023/1/1.

@5j9
Copy link
Owner

5j9 commented Aug 26, 2023

Hi!
As far as I know fipiran website does not provide any way to specify a time period for fetching history (if you know otherwise, please let me know how it is done and I will try to implement it), but you can use Fund.issue_cancel_history to fetch the full NAV history of a fund and then filter the result for a specific time period.

Here is a sample script that plots the NAV history of آساس fund for the given period:

from asyncio import run
from fipiran.funds import Fund
from matplotlib import pyplot as plt


async def main():
    # You can find fund's regNo using `fipiran.funds.funds()` function or from fipiran's website
    fund = Fund(11195)  # آساس
    hist_df = await fund.issue_cancel_history()
    hist_df.sort_index(inplace=True)
    cancel_nav = hist_df['2020-01-01':'2023-01-01']['cancelNav']
    cancel_nav.plot()
    plt.show()


run(main())

@5j9 5j9 closed this as completed Aug 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants