def eval_stock(ticker): result = "Summary: " score = 0 momentum = False if ystockquote.get_50_sma(ticker) > ystockquote.get_200_sma(ticker): result+="stock has momentum, 50 day moving avg is %s and 200 day is %s" % (ystockquote.get_50_sma(ticker), ystockquote.get_200_sma(ticker)) score+=1 momentum=True else: result+="Stock has no momentum, 50 day moving avg is %s and 200 day is %s" % (ystockquote.get_50_sma(ticker), ystockquote.get_200_sma(ticker)) if float(ystockquote.get_1_year_target(ticker)) > (1.2 * float(ystockquote.get_todays_high(ticker))): result+=" 20% away from price target" score += 1 #Short ratio of 5 or higher with positive momentum means investors may likely buy to cover soon if momentum==True and float(ystockquote.get_short_ratio(ticker)) > 3.0: score+=2 result+= " \n short ratio is " + ystockquote.get_short_ratio(ticker) if float(ystockquote.get_eps(ticker))>.02*float(ystockquote.get_todays_high(ticker)): score+=1.5 result += " \n EPS: " + ystockquote.get_eps(ticker) + " today's high is " + ystockquote.get_todays_high(ticker) result+= " \n , notes (if applicable)" + ystockquote.get_notes(ticker) return result, "Score is " + str(score)
def eps_threshold(symbol): cur_eps = ystockquote.get_eps(symbol) if ('N/A' == cur_eps): return True elif (float(cur_eps) >= eps_limit): return True else: return False
def eps_threshold(symbol): cur_eps = ystockquote.get_eps(symbol) if('N/A' == cur_eps): return True elif(float(cur_eps) >= eps_limit): return True else: return False
return tickers print(store_tickers("tickers.csv")) print (eval_stock('CSG')) print (type(float(ystockquote.get_todays_high('GOOG')))) print(ystockquote.get_short_ratio('LQMT')) print(ystockquote.get_eps_estimate_current_year('GOOG')) #trailing 12 months number print(ystockquote.get_eps('GOOG')) print(ystockquote.get_price_eps_estimate_current_year('GOOG')) ##Some of the methods available name = ystockquote.get_company_name('GOOG') mktcap = ystockquote.get_market_cap('GOOG') print ("Name: %s , Market Cap %s" %(name,mktcap)) ystockquote.get_200_sma() ystockquote.get_50_sma() ystockquote.get_annualized_gain() ystockquote.get_1_year_target()
def get_eps(symbol): cur_eps = ystockquote.get_eps(symbol) if ('N/A' == cur_eps): return 0.0 else: return cur_eps
def get_eps(symbol): cur_eps = ystockquote.get_eps(symbol) if('N/A' == cur_eps): return 0.0 else: return cur_eps