eshan6704 commited on
Commit
8e9338e
·
verified ·
1 Parent(s): 8fd4df0

Update nsepython.py

Browse files
Files changed (1) hide show
  1. nsepython.py +4 -30
nsepython.py CHANGED
@@ -237,40 +237,14 @@ def nse_csv_fetch(url):
237
  return ""
238
 
239
  # ------------------------- INDEX HIGH-LOW CSV -------------------------
240
- def nse_highlow(date_str=None):
241
- """
242
- NSE HIGH-LOW (INDEX style CSV)
243
- Returns RAW CSV text
244
- """
245
- if not date_str:
246
- date_str = datetime.datetime.now().strftime("%d%m%Y")
247
- else:
248
- date_str = date_str.replace("-", "")
249
-
250
- url = (
251
- "https://archives.nseindia.com/content/indices/"
252
- f"ind_close_all_{date_str}.csv"
253
- )
254
 
255
- return nse_csv_fetch(url)
256
 
257
  # ------------------------- STOCK 52-WEEK HIGH-LOW CSV -------------------------
258
- def stock_highlow(date_str=None):
259
- """
260
- NSE STOCK 52-week High-Low CSV
261
- Returns RAW CSV text
262
- """
263
- if not date_str:
264
- date_str = datetime.datetime.now().strftime("%d%m%Y")
265
- else:
266
- date_str = date_str.replace("-", "")
267
-
268
- url = (
269
- "https://nsearchives.nseindia.com/content/"
270
- f"CM_52_wk_High_low_{date_str}.csv"
271
- )
272
 
273
- return nse_csv_fetch(url)
274
 
275
  # ------------------------- ZIP CSV FETCH -------------------------
276
  def nse_zip_csv_fetch(url):
 
237
  return ""
238
 
239
  # ------------------------- INDEX HIGH-LOW CSV -------------------------
240
+ def nse_highlow(date_str):
 
 
 
 
 
 
 
 
 
 
 
 
 
241
 
242
+ return nse_csv_fetch("https://archives.nseindia.com/content/indices/" f"ind_close_all_{date_str}.csv")
243
 
244
  # ------------------------- STOCK 52-WEEK HIGH-LOW CSV -------------------------
245
+ def stock_highlow(date_str):
 
 
 
 
 
 
 
 
 
 
 
 
 
246
 
247
+ return nse_csv_fetch( "https://nsearchives.nseindia.com/content/"f"CM_52_wk_High_low_{date_str}.csv")
248
 
249
  # ------------------------- ZIP CSV FETCH -------------------------
250
  def nse_zip_csv_fetch(url):