BennyThadikaran / NseIndiaApi

Unofficial Python Api for NSE India stock exchange
https://bennythadikaran.github.io/NseIndiaApi/
GNU General Public License v3.0
31 stars 6 forks source link

RuntimeError('NSE file is unavailable or not yet updated.') #3

Closed prakasharyaman closed 4 days ago

prakasharyaman commented 4 days ago

When i run this sweet piece of code, i get this error.! :(

RuntimeError('NSE file is unavailable or not yet updated.')

from nse import NSE
from datetime import datetime

with NSE("C:/Users/jugie/download/ss/les") as nse:
    try:
        bhavFile = nse.equityBhavcopy(date=datetime.now())
        dlvFile = nse.deliveryBhavcopy(date=datetime.now())
        raise RuntimeError('Some error')  # force an exception
    except RuntimeError as e:
        # continue execution or exit the script
        print(repr(e))

    # execution continues if handled without exit
    actions = nse.actions()

# NSE request session closed - continue processing
BennyThadikaran commented 4 days ago

The current day bhavcopy is only available after 7pm Indian time. Pass a date for any past sessions and it should download bhavcopy for that session correctly.

Run this code today after 7pm today and it should work. Regards, Benny Thadikaran

prakasharyaman commented 4 days ago

Oh ! now i get it . oops Thanks !

the lib is awesome af 10/10.👏🏻