It is difficult to upload the NR7 stocks everyday. So, I am sharing the python script here.
import re
import urllib2
import json
import matplotlib.pyplot as plt
import time
print("NR7 Stocks")
def check(stockname):
proxy_support = urllib2.ProxyHandler({"http":"http://61.233.25.166:80"})
opener = urllib2.build_opener(proxy_support)
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
urllib2.install_opener(opener)
url="https://www.google.com/finance/getprices?q="+stockname+"&x=NSE&i=86400&p=7d&f=d,c,h,l,o,v"
html = urllib2.urlopen(url).read()
min_diff=1000000
for line in html.split()[7:]:
diff=float(line.split(',')[2])-float(line.split(',')[3])
if(min_diff>diff):
min_diff=diff
#print(stockname,diff,min_diff,float(line.split(',')[2]),float(line.split(',')[3]))
if(abs(diff-min_diff)<0.01):
print(stockname)
return;
symbolslist=["ABIRLANUVO", "ACC", "ADANIENT", "ADANIPORTS", "ADANIPOWER", "AJANTPHARM", "ALBK", "AMARAJABAT", "AMBUJACEM", "ANDHRABANK", "APOLLOHOSP", "APOLLOTYRE", "ARVIND", "ASHOKLEY", "ASIANPAINT", "AUROPHARMA", "AXISBANK", "BAJAJ-AUTO", "BAJFINANCE", "BANKBARODA", "BANKINDIA", "BATAINDIA", "BEL", "BEML", "BHARATFIN", "BHARATFORG", "BHARTIARTL", "BHEL", "BIOCON", "BOSCHLTD", "BPCL", "BRITANNIA", "CADILAHC", "CAIRN", "CANBK", "CASTROLIND", "CEATLTD", "CENTURYTEX", "CESC", "CIPLA", "COALINDIA", "COLPAL", "CONCOR", "CROMPGREAV", "CUMMINSIND", "DABUR", "DCBBANK", "DHFL", "DISHTV", "DIVISLAB", "DLF", "DRREDDY", "EICHERMOT", "ENGINERSIN", "EXIDEIND", "FEDERALBNK", "GAIL", "GLENMARK", "GMRINFRA", "GODREJCP", "GODREJIND", "GRANULES", "GRASIM", "HAVELLS", "HCLTECH", "HDFC", "HDFCBANK", "HDIL", "HEROMOTOCO", "HEXAWARE", "HINDALCO", "HINDPETRO", "HINDUNILVR", "HINDZINC", "IBREALEST", "IBULHSGFIN", "ICICIBANK", "ICIL", "IDBI", "IDEA", "IDFC", "IDFCBANK", "IFCI", "IGL", "INDIACEM", "INDUSINDBK", "INFRATEL", "INFY", "IOC", "IRB", "ITC", "JETAIRWAYS", "JINDALSTEL", "JISLJALEQS", "JPASSOCIAT", "JSWENERGY", "JSWSTEEL", "JUBLFOOD", "JUSTDIAL", "KOTAKBANK", "KPIT", "KSCL", "KTKBANK", "LICHSGFIN", "LT", "LUPIN", "MARICO", "MARUTI", "MCDOWELL-N", "MCLEODRUSS", "MINDTREE", "MOTHERSUMI", "MRF", "NCC", "NHPC", "NIITTECH", "NMDC", "NTPC", "OFSS", "OIL", "ONGC", "ORIENTBANK", "PAGEIND", "PCJEWELLER", "PETRONET", "PFC", "PIDILITIND", "PNB", "POWERGRID", "PTC", "RCOM", "RECLTD", "RELCAPITAL", "RELIANCE", "RELINFRA", "RPOWER", "SAIL", "SBIN", "SIEMENS", "SINTEX", "SOUTHBANK", "SRF", "SRTRANSFIN", "STAR", "SUNPHARMA", "SUNTV", "SYNDIBANK", "TATACHEM", "TATACOMM", "TATAELXSI", "TATAGLOBAL", "TATAMOTORS", "TATAMTRDVR", "TATAPOWER", "TATASTEEL", "TCS", "TECHM", "TITAN", "TORNTPHARM", "TORNTPOWER", "TV18BRDCST", "TVSMOTOR", "UBL", "ULTRACEMCO", "UNIONBANK", "UPL", "VEDL", "VOLTAS", "WIPRO", "WOCKPHARMA", "YESBANK", "ZEEL"]
index=0
while(index<len(symbolslist)):
check(symbolslist[index])
index=index+1
#time.sleep(1)
Script Link
http://pastebin.com/KQH5PYcn
0 comments:
Post a Comment