Example #1
0
import fund_stockquote
import sys

ticker = sys.argv[1]
# test get_volume and get_average_volume

print "get_price = ", fund_stockquote.get_price(ticker)

print "get_volume = ", fund_stockquote.get_volume(ticker)

print "get_ebitda = ", fund_stockquote.get_ebitd(ticker)

print "get_average_volume = ", fund_stockquote.get_average_volume(ticker)

print "get_todays_high = ",  fund_stockquote.get_todays_high(ticker)

print "get_todays_low = ", fund_stockquote.get_todays_low(ticker)
Example #2
0
                        
                        ts = datetime.date.today()
			history_choice = 'trading_%s'%(ts)
                        os.system('cp %s history/%s'%(email_file, history_choice))
			
                        f1 = open('trading_result.txt', 'w+')
                        for entry in sorted_buying_value:
				if(fund_stockquote.eps_threshold(entry[0]) > 0 and (g_changing_range < (float(fund_stockquote.get_todays_high(entry[0])) - float(fund_stockquote.get_todays_low(entry[0])))/float(fund_stockquote.get_price(entry[0]))) and (float(fund_stockquote.get_volume(entry[0])) > 1.5*float(fund_stockquote.get_average_volume(entry[0]))) and (fund_stockquote.get_volume(entry[0]) > 1000000)):
					print entry[0]
                                #	f1.write('%s %s %s'%(str(entry[0]), fund_stockquote.get_price(entry[0]), str(entry[-1])))
                                #	f1.write('\n')
			f1.write("# Above average curve and results | only work on bull market\n")
			#f1.write('\n')
                        # condition: (0.03 >= (float(fund_stockquote.get_todays_high(entry[0])) - float(fund_stockquote.get_todays_low(entry[0])))/float(fund_stockquote.get_price(entry[0]))) and float(fund_stockquote.get_ebitd(entry[0])) > 0.12)
			for entry in sorted_trading_value:
				 if(fund_stockquote.eps_threshold(entry[0]) > 0 and (((float(fund_stockquote.get_volume(entry[0])) > 1.5*float(fund_stockquote.get_average_volume(entry[0]))) and (g_changing_range < (float(fund_stockquote.get_todays_high(entry[0])) - float(fund_stockquote.get_price(entry[0])))/float(fund_stockquote.get_price(entry[0]))))) and (fund_stockquote.get_average_volume(entry[0]) > 1000000) and (float(fund_stockquote.get_ebitd(entry[0])) > 0.12)):
                                        print entry[0]
                                        f1.write('%s %s %s'%(str(entry[0]), fund_stockquote.get_price(entry[0]),str(entry[-1])))
                                        f1.write('\n')
                       # f1.write("# Above average curve and slowly getting up | only work on bull market\n")
			for entry in sorted_trading_value:
				 if(fund_stockquote.eps_threshold(entry[0]) > 0 and ((float(fund_stockquote.get_volume(entry[0])) > float(fund_stockquote.get_average_volume(entry[0]))) and (0.05 > (float(fund_stockquote.get_todays_high(entry[0])) - float(fund_stockquote.get_todays_low(entry[0])))/float(fund_stockquote.get_price(entry[0]))) and float(fund_stockquote.get_ebitd(entry[0])) > 0.17) and (fund_stockquote.get_volume(entry[0]) > 500000) and (float(fund_stockquote.get_ebitd(entry[0])) > 0.12)):
					print entry[0]
			#		f1.write('%s %s %s'%(str(entry[0]), fund_stockquote.get_price(entry[0]),str(entry[-1])))
			#		f1.write('\n')

                        f1.close()
                #print  earning_stock
                	initial_flag = True
			if(datetime.datetime.today().weekday() != 6):
				sendMail.sendToGmail(email_file)