swapniljariwala / nsepy

Python Library to get publicly available data on NSE website ie. stock quotes, historical data, live indices
https://nsepy-xyz.web.app
Other
754 stars 376 forks source link

get_history not working for a stock #132

Open InfestusLeo opened 4 years ago

InfestusLeo commented 4 years ago

Hi, I'm unable to fetch any recent data for DMART. The code for all other stock tickers that I have tested works fine. Data is available only till 3rd March'20.

Snippet of the code: tick = nse.get_history(symbol='DMART', start=start, end=end)

avnishbm commented 4 years ago

Also, not giving any data for following shares/indices, where as data exists: Stocks: JITFINFRA PVR SHRIPISTON WIPL

Indices: NIFTY Smallcap 100 Nifty50 Dividend Points Nifty Financial Services Nifty India Consumption Nifty Dividend Opportunities 50 Nifty Infrastructure Nifty Services Sector Nifty100 Liquid 15 Nifty Midcap Liquid 15 Nifty Growth Sectors 15 Nifty50 TR 1x Inverse Nifty50 TR 2x Leverage Nifty50 PR 1x Inverse Nifty50 PR 2x Leverage Nifty Private Bank Nifty 8-13 yr G-Sec Nifty 4-8 yr G-Sec Index Nifty 11-15 yr G-Sec Index Nifty 15 yr and above G-Sec Index Nifty Composite G-sec Index Nifty 10 yr Benchmark G-Sec Nifty 10 yr Benchmark G-Sec (Clean Price)

I am trying for the date range 2000-01-01 till date, fetched in incremental manner 1000 days at a time i.e. multiple calls to get_history(). Can this be looked into for it to work for these shares as well? FYI, my code does work well for all other shares.

shashankTwr commented 4 years ago

@avnishbm Are you dynamically fetching symbol to the get_history function? Cause when I do dynamically function fails

avnishbm commented 4 years ago

@avnishbm Are you dynamically fetching symbol to the get_history function? Cause when I do dynamically function fails

Yes, fetch the symbols using nsepy.symbols.get_symbol_list() function.

shashankTwr commented 4 years ago

@avnishbm Are you dynamically fetching symbol to the get_history function? Cause when I do dynamically function fails

Yes, fetch the symbols using nsepy.symbols.get_symbol_list() function. `AttributeError Traceback (most recent call last)

in 1 import nsepy ----> 2 x=nsepy.symbols.get_symbol_list()

AttributeError: module 'nsepy' has no attribute 'symbols' `

shashankTwr commented 4 years ago

@avnishbm Are you dynamically fetching symbol to the get_history function? Cause when I do dynamically function fails

Yes, fetch the symbols using nsepy.symbols.get_symbol_list() function.

I have found a workaround by fetching the list of nifty50 stocks from their archives and then feeding them separately

avnishbm commented 4 years ago

@avnishbm Are you dynamically fetching symbol to the get_history function? Cause when I do dynamically function fails

Yes, fetch the symbols using nsepy.symbols.get_symbol_list() function.

I have found a workaround by fetching the list of nifty50 stocks from their archives and then feeding them separately

This is what i had in code to import the function: from nsepy.symbols import get_symbol_list

nsesymbols = get_symbol_list() nsesymbols.columns = nsesymbols.columns.str.strip() // as some column names have an extra space character