Beispiel #1
0
def getAllInfo(ticker,new):
	title,body=getContent(new)
	#print("["count,"/",count_t,"]","-"*50, ticker)
	volume=get_ticker_info.get_info(ticker=ticker,info="Volume",display=False)
	#print(volume)
	if str(volume).find(",")>=0:
		volume=volume.replace(",","")
	#print(volume)
	#k=input("-------------")
	opening=get_ticker_info.get_info(ticker=ticker,info="OPEN-value",display=False)
	beta=get_ticker_info.get_info(ticker=ticker,info="Beta",display=False)
	P_E=get_ticker_info.get_info(ticker=ticker,info="PE Ratio",display=False)
	avg_volume=get_ticker_info.get_info(ticker=ticker,info="Avg. Volume",display=False)
	previous_close=get_ticker_info.price_yahoo_parsing(ticker=ticker)
	dividents=get_ticker_info.get_info(ticker=ticker,info="Forward Dividend",display=False)
	if str(dividents).find("%")>=0:
			dividents=dividents.replace("%","")
	market_cap=get_ticker_info.get_info(ticker=ticker,info="Market Cap",display=False)
	if str(market_cap).lower().find("m")>=0:
		market_cap=market_cap.lower().split("m")[0]
		market_cap=float(market_cap)*1000000
	if str(market_cap).lower().find("b")>=0:
		market_cap=market_cap.lower().split("b")[0]
		market_cap=float(market_cap)*1000000000
	if str(market_cap).lower().find("k")>=0:
		market_cap=market_cap.lower().split("k")[0]
		market_cap=float(market_cap)*1000
	return [str(ticker), str(volume), str(beta), str(opening), str(previous_close[0])+"-"+str(previous_close[1]), title.replace('\n',' ').replace('\r',' ')]
def getAllInfo(ticker, url, old_price=1000):

    title, body = getContent(url)
    #print("["count,"/",count_t,"]","-"*50, ticker)
    volume = get_ticker_info.get_info(ticker=ticker,
                                      info="Volume",
                                      display=False)
    #print(volume)
    if str(volume).find(",") >= 0:
        volume = volume.replace(",", "")
    #print(volume)
    #k=input("-------------")
    opening = get_ticker_info.get_info(ticker=ticker,
                                       info="OPEN-value",
                                       display=False)
    beta = get_ticker_info.get_info(ticker=ticker, info="Beta", display=False)
    P_E = get_ticker_info.get_info(ticker=ticker,
                                   info="PE Ratio",
                                   display=False)
    avg_volume = get_ticker_info.get_info(ticker=ticker,
                                          info="Avg. Volume",
                                          display=False)
    previous_close = get_ticker_info.price_yahoo_parsing(ticker=ticker)
    dividents = get_ticker_info.get_info(ticker=ticker,
                                         info="Forward Dividend",
                                         display=False)
    if str(dividents).find("%") >= 0:
        dividents = dividents.replace("%", "")
    market_cap = get_ticker_info.get_info(ticker=ticker,
                                          info="Market Cap",
                                          display=False)
    if str(market_cap).lower().find("m") >= 0:
        market_cap = market_cap.lower().split("m")[0]
        market_cap = float(market_cap) * 1000000
    if str(market_cap).lower().find("b") >= 0:
        market_cap = market_cap.lower().split("b")[0]
        market_cap = float(market_cap) * 1000000000
    if str(market_cap).lower().find("k") >= 0:
        market_cap = market_cap.lower().split("k")[0]
        market_cap = float(market_cap) * 1000
    lowest_price = old_price
    print(ticker, " |Old-> ", old_price, " New-> ", previous_close[0])
    #if (previous_close[0]) <(lowest_price): k=input()
    #if old_price!=1000:input()
    b_lowest_price = lowest_price
    if previous_close[0] == 'None': lowest_price = old_price
    else:
        lowest_price = previous_close[0] if (previous_close[0]) < (
            lowest_price) else (lowest_price)
    #ff=open("lower_price.txt","a")
    #ff.write(ticker+"-Price: "+str(previous_close[0])+" Lower P: "+str(lowest_price)+" Before change: "+str(b_lowest_price)+"\n")
    #ff.close()
    title = title.replace('\n', ' ').replace('\r', ' ')
    TICKER_instance = TICKER.TICKER(ticker)
    TICKER_instance.setVolume(volume)
    TICKER_instance.setBeta(beta)
    TICKER_instance.setOpening(opening)
    TICKER_instance.setPrevious_close_price(previous_close[0])
    TICKER_instance.setPrevious_close_time(previous_close[1])
    TICKER_instance.setLowest_price(lowest_price)
    #TICKER_instance.setUrl()

    TICKER_instance.setTitle(title)
    #return [str(ticker), str(volume), str(beta), str(opening), str(previous_close[0])/
    #+"-"+str(previous_close[1]),str(lowest_price), title.replace('\n',' ').replace('\r',' ')]
    #print(title)
    #print(TICKER_instance)
    #k=input()
    return TICKER_instance
Beispiel #3
0
import get_ticker_info

get_ticker_info.get_info(ticker="DKS",info="Volume",display=True)
print("="*50)
get_ticker_info.get_info(ticker="DKS",info="Avg. Volume",display=True)
print("="*50)
get_ticker_info.get_info(ticker="DKS",info="Previous Close",display=True)
print("="*50)
get_ticker_info.get_info(ticker="DKS",info="OPEN-value",display=True)
print("="*50)
get_ticker_info.get_info(ticker="DKS",info="PE Ratio",display=True)
print("="*50)
get_ticker_info.get_info(ticker="DKS",info="Beta",display=True)
print("="*50)
get_ticker_info.get_info(ticker="DKS",info="Forward Dividend",display=True)
print("="*50)
get_ticker_info.get_info(ticker="DKS",info="Market Cap",display=True)
print("="*50)
get_ticker_info.price_yahoo_parsing(ticker="DKS",display=True)