Update nsepython.py
Browse files- nsepython.py +16 -3
nsepython.py
CHANGED
|
@@ -185,9 +185,22 @@ def nse_bulkdeals(): return pd.read_csv("https://archives.nseindia.com/content/e
|
|
| 185 |
def nse_blockdeals(): return pd.read_csv("https://archives.nseindia.com/content/equities/block.csv")
|
| 186 |
#nse daily report
|
| 187 |
def nse_bhavcopy(d): return pd.read_csv("https://archives.nseindia.com/products/content/sec_bhavdata_full_"+d.replace("-","")+".csv")
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 191 |
return df
|
| 192 |
|
| 193 |
|
|
|
|
| 185 |
def nse_blockdeals(): return pd.read_csv("https://archives.nseindia.com/content/equities/block.csv")
|
| 186 |
#nse daily report
|
| 187 |
def nse_bhavcopy(d): return pd.read_csv("https://archives.nseindia.com/products/content/sec_bhavdata_full_"+d.replace("-","")+".csv")
|
| 188 |
+
|
| 189 |
+
def nse_highlow(d: str) -> pd.DataFrame:
|
| 190 |
+
"""
|
| 191 |
+
NSE 52-week High/Low CSV
|
| 192 |
+
Real header starts from row 3
|
| 193 |
+
"""
|
| 194 |
+
date_str = d.replace("-", "")
|
| 195 |
+
url = f"https://archives.nseindia.com/content/CM_52_wk_High_low_{date_str}.csv"
|
| 196 |
+
|
| 197 |
+
df = pd.read_csv(
|
| 198 |
+
url,
|
| 199 |
+
skiprows=2, # 🔥 key fix
|
| 200 |
+
engine="python"
|
| 201 |
+
)
|
| 202 |
+
|
| 203 |
+
df.columns = df.columns.str.strip()
|
| 204 |
return df
|
| 205 |
|
| 206 |
|