forked from chinmayHundekari/optionMath
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetNifty.py
26 lines (23 loc) · 785 Bytes
/
getNifty.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## Download daily intra day charts from yahoo finance
## symbolList.txt:(<Yahoo symbol>,<image_finename>)
## ^NSEI,NSEI
## ACC.NS,ACC
## AMBUJACEM-EQ.NS,AMBUJACEM-EQ
## AXISBANK.NS,AXISBANK
import urllib
import csv
import os
from datetime import date
fi = open("symbolList.csv", "rb")
symList = csv.reader(fi)
dt = date.today()
if not os.path.exists("./Intraday_YAHOO"):
os.makedirs("./Intraday_YAHOO")
direc = "./Intraday_YAHOO/"+str(dt.year)+str(dt.month).zfill(2)+str(dt.day).zfill(2)
if not os.path.exists(direc):
os.makedirs(direc)
for row in symList:
print row[0],row[1]
url_chart = "http://chart.finance.yahoo.com/z?s=" + row[0] + "&t=1d&q=&l=off&z=m&a=v&p=s&lang=en-US®ion=US"
file_chart = direc+"/"+row[1]+".jpg"
urllib.urlretrieve(url_chart, file_chart)