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

Not able to fetch historical stock data of the scripts for specific date #63

Open
yogeshrajgolkr opened this issue Dec 1, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@yogeshrajgolkr
Copy link

Issue description

when I am running the code it is working fine but the issue is it is not giving the data for the date which I have mentioned in the to_date variable of stock_df function, even after NSE have updated the data for the date. Instead it is giving previous days data.
See the code and output i have given below, in the output data is there but till 28-11-2023 but i have asked till 01-12-2023. Not today only but previously many times i have encountered with this issue.

Example Code

from datetime import date
from jugaad_data.nse import stock_df
import pandas as pd
stock = ['SBIN', 'TCS']

for stock in stock:
    data = stock_df(symbol=stock, from_date=date(2023, 1, 1),
                    to_date=date(2023, 12, 1), series="EQ")
    df = pd.DataFrame(data)
    print(df)

Error snippet

DATE SERIES    OPEN    HIGH     LOW  PREV. CLOSE     LTP   CLOSE    VWAP   52W H   52W L    VOLUME         VALUE  NO OF TRADES SYMBOL
0   2023-11-28     EQ  563.60  565.20  561.10       560.35  564.80  564.45  563.42  629.55  499.35   8153314  4.593728e+09        186090   SBIN
1   2023-11-24     EQ  561.95  562.45  559.25       559.95  560.70  560.35  560.63  629.55  499.35   6529851  3.660805e+09        155259   SBIN
2   2023-11-23     EQ  561.75  563.50  558.30       558.95  560.50  559.95  560.72  629.55  499.35   6376210  3.575283e+09        198344   SBIN
3   2023-11-22     EQ  562.95  564.50  555.15       561.50  559.50  558.95  559.00  629.55  499.35  14909071  8.334245e+09        247815   SBIN
4   2023-11-21     EQ  566.00  566.65  561.00       563.75  561.40  561.50  563.11  629.55  499.35  14280013  8.041232e+09        223495   SBIN
..         ...    ...     ...     ...     ...          ...     ...     ...     ...     ...     ...       ...           ...           ...    ...
218 2023-01-06     EQ  607.40  607.45  597.00       605.10  601.00  600.65  601.57  629.55  425.00   7972036  4.795747e+09        154179   SBIN
219 2023-01-05     EQ  607.00  611.60  601.95       605.20  605.75  605.10  605.84  629.55  425.00   8241475  4.992982e+09        146571   SBIN
220 2023-01-04     EQ  611.85  614.95  604.00       612.40  605.60  605.20  607.74  629.55  425.00   7011191  4.260969e+09        113548   SBIN
221 2023-01-03     EQ  614.50  616.60  610.00       612.20  612.95  612.40  613.26  629.55  425.00   6818062  4.181258e+09        122799   SBIN
222 2023-01-02     EQ  614.95  619.20  611.20       613.70  612.60  612.20  614.42  629.55  425.00   6726084  4.132615e+09        125418   SBIN

[223 rows x 15 columns]
          DATE SERIES     OPEN     HIGH      LOW  PREV. CLOSE      LTP    CLOSE     VWAP   52W H    52W L   VOLUME         VALUE  NO OF TRADES SYMBOL
0   2023-11-28     EQ  3457.10  3481.25  3433.00      3457.10  3473.30  3470.15  3454.10  3679.0  3070.25  1689195  5.834649e+09        120747    TCS
1   2023-11-24     EQ  3494.25  3504.55  3453.00      3508.25  3454.00  3457.10  3474.52  3679.0  3070.25  1989733  6.913360e+09        137682    TCS
2   2023-11-23     EQ  3530.00  3544.00  3500.00      3530.15  3507.00  3508.25  3516.84  3679.0  3070.25  2729804  9.600272e+09        170315    TCS
3   2023-11-22     EQ  3500.00  3532.65  3481.10      3510.20  3530.50  3530.15  3510.71  3679.0  3070.25  1798051  6.312428e+09        121170    TCS
4   2023-11-21     EQ  3519.60  3539.05  3501.00      3519.60  3510.00  3510.20  3525.61  3679.0  3070.25  1807236  6.371610e+09        141954    TCS
..         ...    ...      ...      ...      ...          ...      ...      ...      ...     ...      ...      ...           ...           ...    ...
218 2023-01-06     EQ  3300.00  3301.55  3200.00      3311.10  3213.90  3211.55  3239.59  4043.0  2926.10  2488376  8.061309e+09        177937    TCS
219 2023-01-05     EQ  3330.20  3337.30  3281.95      3314.65  3302.65  3311.10  3311.44  4043.0  2926.10  1826057  6.046883e+09        128658    TCS
220 2023-01-04     EQ  3306.70  3327.35  3286.20      3311.35  3313.10  3314.65  3306.45  4043.0  2926.10  1231668  4.072443e+09         76844    TCS
221 2023-01-03     EQ  3252.00  3320.00  3245.30      3261.45  3312.00  3311.35  3300.29  4043.0  2926.10  1245178  4.109452e+09         78401    TCS
222 2023-01-02     EQ  3261.00  3266.85  3235.20      3256.70  3263.00  3261.45  3254.07  4043.0  2926.10   709547  2.308912e+09         51003    TCS
@yogeshrajgolkr yogeshrajgolkr added the bug Something isn't working label Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant