Spaces:
Running
Running
Update app/nsepythonmodified.py
Browse files- app/nsepythonmodified.py +29 -0
app/nsepythonmodified.py
CHANGED
|
@@ -290,6 +290,35 @@ def nse_largedeals_historical(f,t,mode="bulk_deals"):
|
|
| 290 |
def nse_stock_hist(f,t,symbol,series="ALL"):
|
| 291 |
url=f"https://www.nseindia.com/api/historical/securityArchives?from={f}&to={t}&symbol={symbol.upper()}&dataType=priceVolumeDeliverable&series={series}"
|
| 292 |
return pd.DataFrame(nsefetch(url)['data']).to_html()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 293 |
|
| 294 |
def nse_index_live(name="NIFTY 50"):
|
| 295 |
p=nsefetch(f"https://www.nseindia.com/api/equity-stockIndices?index={name.replace(' ','%20')}")
|
|
|
|
| 290 |
def nse_stock_hist(f,t,symbol,series="ALL"):
|
| 291 |
url=f"https://www.nseindia.com/api/historical/securityArchives?from={f}&to={t}&symbol={symbol.upper()}&dataType=priceVolumeDeliverable&series={series}"
|
| 292 |
return pd.DataFrame(nsefetch(url)['data']).to_html()
|
| 293 |
+
def nse_stock_hist(start, end, symbol, series="ALL"):
|
| 294 |
+
"""
|
| 295 |
+
NSE Stock historical data (OR API)
|
| 296 |
+
|
| 297 |
+
start : 'DD-MM-YYYY'
|
| 298 |
+
end : 'DD-MM-YYYY'
|
| 299 |
+
symbol : NSE symbol (e.g. ITC)
|
| 300 |
+
series : ALL | EQ | BE | etc
|
| 301 |
+
"""
|
| 302 |
+
|
| 303 |
+
symbol = nsesymbolpurify(symbol.upper())
|
| 304 |
+
|
| 305 |
+
url = (
|
| 306 |
+
"https://www.nseindia.com/api/historicalOR/"
|
| 307 |
+
"generateSecurityWiseHistoricalData"
|
| 308 |
+
f"?from={start}"
|
| 309 |
+
f"&to={end}"
|
| 310 |
+
f"&symbol={symbol}"
|
| 311 |
+
f"&type=priceVolumeDeliverable"
|
| 312 |
+
f"&series={series}"
|
| 313 |
+
)
|
| 314 |
+
|
| 315 |
+
payload = nsefetch(url)
|
| 316 |
+
|
| 317 |
+
if not payload or "data" not in payload:
|
| 318 |
+
return pd.DataFrame()
|
| 319 |
+
|
| 320 |
+
return pd.DataFrame(payload["data"])
|
| 321 |
+
|
| 322 |
|
| 323 |
def nse_index_live(name="NIFTY 50"):
|
| 324 |
p=nsefetch(f"https://www.nseindia.com/api/equity-stockIndices?index={name.replace(' ','%20')}")
|