def stock_summary(request, symbol=None):
    if symbol == None:
        symbol = request.POST['symbol']

    current_stock = Stock()
    stock = Share(symbol)
    current_stock.symbol = symbol.upper()
    current_stock.price = stock.get_price()
    current_stock.change = stock.get_change()
    current_stock.volume = stock.get_volume()
    current_stock.prev_close = stock.get_prev_close()
    current_stock.stock_open = stock.get_open()
    current_stock.avg_daily_volume = stock.get_avg_daily_volume()
    current_stock.stock_exchange = stock.get_stock_exchange()
    current_stock.market_cap = stock.get_market_cap()
    current_stock.book_value = stock.get_book_value()
    current_stock.ebitda = stock.get_ebitda()
    current_stock.dividend_share = stock.get_dividend_share()
    current_stock.dividend_yield = stock.get_dividend_yield()
    current_stock.earnings_share = stock.get_earnings_share()
    current_stock.days_high = stock.get_days_high()
    current_stock.days_low = stock.get_days_low()
    current_stock.year_high = stock.get_year_high()
    current_stock.year_low = stock.get_year_low()
    current_stock.fifty_day_moving_avg = stock.get_50day_moving_avg()
    current_stock.two_hundred_day_moving_avg = stock.get_200day_moving_avg()
    current_stock.price_earnings_ratio = stock.get_price_earnings_ratio()
    current_stock.price_earnings_growth_ratio = stock.get_price_earnings_growth_ratio()
    current_stock.price_sales = stock.get_price_sales()
    current_stock.price_book = stock.get_price_book()
    current_stock.short_ratio = stock.get_short_ratio()

    date_metrics = []
    url = 'http://chartapi.finance.yahoo.com/instrument/1.0/'+symbol+'/chartdata;type=quote;range=1y/csv'
    page = urllib2.urlopen(url).read()
    pagebreaks = page.split('\n')
    for line in pagebreaks:
        items = line.split(',')
        if 'Company-Name:' in line:
            current_stock.company_name = line[13:len(line)]
            current_stock.save()
        if 'values' not in items:
            if len(items)==6:
                hd = HistoricalData(
                    stock_id = Stock.objects.get(id=int(current_stock.id)).id,
                    date = items[0][4:6]+'/'+items[0][6:9]+'/'+items[0][0:4],
                    close = items[1][0:(len(items[1])-2)],
                    high = items[2][0:(len(items[2])-2)],
                    price_open = items[3][0:(len(items[3])-2)],
                    low = items[4][0:(len(items[4])-2)],
                    volume = items[5][0:-6]+","+items[5][-6:-3]+","+items[5][-3:len(items[5])])
                hd.save()
                date_metrics.append(hd)
    del date_metrics[0]
    return render(request, "stock_summary.html", {'current_stock': current_stock, 'date_metrics': date_metrics})
Exemplo n.º 2
0
def getAllStockData(ticker):
    '''Get a few random tickers.'''
    stock = Share(ticker)
    stock.refresh()
    data = {
        'name': stock.get_name(),
        'price': stock.get_price(),
        'change': stock.get_change(),
        'volume': stock.get_volume(),
        'prev_close': stock.get_prev_close(),
        'open': stock.get_open(),
        'avg_daily_volume': stock.get_avg_daily_volume(),
        'stock_exchange': stock.get_stock_exchange,
        'market_cap': stock.get_market_cap(),
        'book_value': stock.get_book_value(),
        'ebitda': stock.get_ebitda(),
        'dividend_share': stock.get_dividend_share(),
        'dividend_yield': stock.get_dividend_yield(),
        'earnings_share': stock.get_earnings_share(),
        'days_high': stock.get_days_high(),
        'days_low': stock.get_days_low(),
        'year_high': stock.get_year_high(),
        'year_low': stock.get_year_low(),
        '50day_moving_avg': stock.get_50day_moving_avg(),
        '200day_moving_avg': stock.get_200day_moving_avg(),
        'price_earnings_ratio': stock.get_price_earnings_ratio(),
        'price_earnings_growth_ratio': stock.get_price_earnings_growth_ratio(),
        'get_price_sales': stock.get_price_sales(),
        'get_price_book': stock.get_price_book(),
        'get_short_ratio': stock.get_short_ratio(),
        'trade_datetime': stock.get_trade_datetime(),
        'percent_change_from_year_high': stock.get_percent_change_from_year_high(),
        'percent_change_from_year_low': stock.get_percent_change_from_year_low(),
        'change_from_year_low': stock.get_change_from_year_low(),
        'change_from_year_high': stock.get_change_from_year_high(),
        'percent_change_from_200_day_moving_average': stock.get_percent_change_from_200_day_moving_average(),
        'change_from_200_day_moving_average': stock.get_change_from_200_day_moving_average(),
        'percent_change_from_50_day_moving_average': stock.get_percent_change_from_50_day_moving_average(),
        'change_from_50_day_moving_average': stock.get_change_from_50_day_moving_average(),
        'EPS_estimate_next_quarter': stock.get_EPS_estimate_next_quarter(),
        'EPS_estimate_next_year': stock.get_EPS_estimate_next_year(),
        'ex_dividend_date': stock.get_ex_dividend_date(),
        'EPS_estimate_current_year': stock.get_EPS_estimate_current_year(),
        'price_EPS_estimate_next_year': stock.get_price_EPS_estimate_next_year(),
        'price_EPS_estimate_current_year': stock.get_price_EPS_estimate_current_year(),
        'one_yr_target_price': stock.get_one_yr_target_price(),
        'change_percent_change': stock.get_change_percent_change(),
        'divended_pay_date': stock.get_dividend_pay_date(),
        'currency': stock.get_currency(),
        'last_trade_with_time': stock.get_last_trade_with_time(),
        'days_range': stock.get_days_range(),
        'years_range': stock.get_year_range()
    }
    return data
Exemplo n.º 3
0
def stocks(dict_response):
    message = ""
    try:
        query_text = dict_response['_text'].lower()
        if query_text.find("stocks ") != -1:
            query_text = query_text[7:]
        y = Share(query_text)
        message += "Trading information for " + y.get_name(
        ) + " (" + query_text + ") :\n"
        message += "Opened: " + y.get_open() + "\n"
        message += "Current: " + y.get_price() + "\n"
        message += "Earnings share: " + y.get_earnings_share() + "\n"
        message += "Short ratio: " + y.get_short_ratio() + "\n"
        message += "Previous close: " + y.get_prev_close() + "\n"
    except:
        message = technical_issues()
    return message
 def get_company_info(ticker):
     try:
         s = Share(ticker)
         data = {
             'Market_cap': s.get_market_cap(),
             'Average_volume': s.get_avg_daily_volume(),
             'EPS': s.get_earnings_share(),
             'Short_ratio': s.get_short_ratio(),
             'PE': s.get_price_earnings_ratio(),
             'PEG': s.get_price_earnings_growth_ratio(),
         }
         return DataFetcher._extract_company_info(data)
     except YQLQueryError:
         logger.error("Company info not found for {}".format(ticker))
     except Exception as e:
         logger.error("Unexpected error occured: {}".format(e))
     return {}
 def get_company_info(ticker):
     try:
         s = Share(ticker)
         data = {
             'Market_cap': s.get_market_cap(),
             'Average_volume': s.get_avg_daily_volume(),
             'EPS': s.get_earnings_share(),
             'Short_ratio': s.get_short_ratio(),
             'PE': s.get_price_earnings_ratio(),
             'PEG': s.get_price_earnings_growth_ratio(),
         }
         return DataFetcher._extract_company_info(data)
     except YQLQueryError:
         logger.error("Company info not found for {}".format(ticker))
     except Exception as e:
         logger.error("Unexpected error occured: {}".format(e))
     return {}
Exemplo n.º 6
0
def get_symbol_yahoo_stats_yql(symbols, exclude_name=False):
    """
    Get the symbols' basic statistics from Yahoo Finance.
    Input:
       symbols - a list of symbol strings, e.g. ['AAPL']
    Output: stats in Pandas DataFrame.
    This function is ported from pandas_datareader/yahoo/components.py
    """
    sym_list = str2list(symbols)
    if sym_list == None:
        return DataFrame()

    # Yahoo Finance tags, refer to http://www.financialwisdomforum.org/gummy-stuff/Yahoo-data.htm
    tags = ['Symbol']
    if not exclude_name:
        tags += ['Name']
    tags += ['Exchange', 'MarketCap', 'Volume', 'AverageDailyVolume', 'BookValue', 'P/E', 'PEG', 'Price/Sales',
            'Price/Book', 'EBITDA', 'EPS', 'EPSEstimateNextQuarter', 'EPSEstimateCurrentYear', 'EPSEstimateNextYear',
            'OneyrTargetPrice', 'PriceEPSEstimateCurrentYear', 'PriceEPSEstimateNextYear', 'ShortRatio',
            'Dividend/Share', 'DividendYield', 'DividendPayDate', 'ExDividendDate']
    lines = []
    for sym in sym_list:
        stock = Share(sym)
        line = [sym]
        if not exclude_name:
            line += [stock.get_name()]
        line += [stock.get_stock_exchange(), str2num(stock.get_market_cap(), m2b=True),
                str2num(stock.get_volume()), str2num(stock.get_avg_daily_volume()), str2num(stock.get_book_value()),
                str2num(stock.get_price_earnings_ratio()), str2num(stock.get_price_earnings_growth_ratio()),
                str2num(stock.get_price_sales()), str2num(stock.get_price_book()), str2num(stock.get_ebitda()),
                str2num(stock.get_earnings_share()), str2num(stock.get_EPS_estimate_next_quarter()),
                str2num(stock.get_EPS_estimate_current_year()), str2num(stock.get_EPS_estimate_next_year()),
                str2num(stock.get_one_yr_target_price()), str2num(stock.get_price_EPS_estimate_current_year()),
                str2num(stock.get_price_EPS_estimate_next_year()), str2num(stock.get_short_ratio()),
                str2num(stock.get_dividend_share()), str2num(stock.get_dividend_yield()), stock.get_dividend_pay_date(),
                stock.get_ex_dividend_date()]
        lines.append(line)

    stats = DataFrame(lines, columns=tags)
    stats = stats.drop_duplicates()
    stats = stats.set_index('Symbol')
    return stats
Exemplo n.º 7
0
def selectStock(stocks):
    '''
    select the stock with today's trading volume at least 6 fold higher than 
    average historical trading volume
    '''
    start_time = time()
    resultStock = {}
    count = 0
    num = 0
    for symb in stocks.keys():
        try:
            stock = Share(symb)
            vol = int(stock.get_volume())
            daily_avg_vol = int(stock.get_avg_daily_volume())
            price = float(stock.get_price())
            prevPrice = float(stock.get_prev_close())
            avg_50day = float(stock.get_50day_moving_avg())
            avg_200day = float(stock.get_200day_moving_avg())
        except (TypeError, AttributeError):
            continue
        num += 1
        volRatio = vol / daily_avg_vol
        print num, stocks[symb][0], volRatio

        if volRatio > 6 and price > prevPrice and price > avg_50day:
            count += 1
            stocks[symb].extend([
                vol, daily_avg_vol, volRatio, price, prevPrice, avg_50day,
                avg_200day,
                stock.get_price_earnings_ratio(),
                stock.get_price_book(),
                stock.get_short_ratio(),
                stock.get_dividend_yield()
            ])

    resultStock = {
        symb: stocks[symb]
        for symb in stocks.keys() if len(stocks[symb]) > 1
    }
    print '{} stock(s) has marvelous volume'.format(count)
    print 'total time of running: {} seconds'.format(time() - start_time)
    return resultStock
Exemplo n.º 8
0
def write_technical_files(stock_code, start_time, end_time):
  # """ Experiment on quandl """
  # print('quandl data')
  # mydata = quandl.get("FRED/GDP")
  # print(mydata)
  # print('hello')

  # data = quandl.get("WIKI/FB.11", start_date="2014-01-01", end_date="2014-12-31", collapse="monthly", transform="diff")
  # print(data)

  stock = Share(stock_code)

  print('stock.get_info()')
  print(stock.get_info())

  print('get_price()')
  print(stock.get_price())

  print('get_change()')
  print(stock.get_change())

  print('get_stock_exchange()')
  print(stock.get_stock_exchange())

  print('get_market_cap()')
  print(stock.get_market_cap())

  print('get_book_value()')
  print(stock.get_book_value())

  print('get_ebitda()')
  print(stock.get_ebitda())

  print('get_dividend_share()')  
  print(stock.get_dividend_share())

  print('get_dividend_yield()')
  print(stock.get_dividend_yield())

  print('get_earnings_share()')
  print(stock.get_earnings_share())

  print('get_50day_moving_avg()')
  print(stock.get_50day_moving_avg())

  print('get_200day_moving_avg()')
  print(stock.get_200day_moving_avg())

  print('get_price_earnings_ratio()')
  print(stock.get_price_earnings_ratio())

  print('get_price_earnings_growth_ratio()')
  print(stock.get_price_earnings_growth_ratio())

  print('get_price_sales()')
  print(stock.get_price_sales())

  print('get_price_book()')
  print(stock.get_price_book())

  print('get_short_ratio()')
  print(stock.get_short_ratio())

  print('historical_data')
  print(stock.get_historical(start_time, end_time))

  historical_data = stock.get_historical(start_time, end_time)

  info_text = "Symbol\t" + "Stock Exchange\t" + "Price\t" + "Market Cap\t" + "Book Value\t" + "EBITDA\t" + "50d Moving Avg\t" + "100d Moving Avg\n"
  info_text += str(stock.get_info()['symbol']) + "\t" + str(stock.get_stock_exchange()) + "\t" + str(stock.get_price()) + "\t" + str(stock.get_market_cap()) + "\t" + str(stock.get_book_value()) + "\t";
  info_text += str(stock.get_ebitda()) + "\t" + str(stock.get_50day_moving_avg()) + "\t" + str(stock.get_200day_moving_avg()) + "\n";

  info_directory = '/data/info.tsv'

  write_to_file(info_directory, info_text)

  high_low_text = "date\t" + "High\t" + "Low\n"
  open_close_text = "date\t" + "Open\t" + "Close\n"
  volume_text = "date\t" + "Volume\n"

  for index, value in enumerate(historical_data):
    date = str(historical_data[len(historical_data) - 1 - index]['Date'])
    date = date.replace('-','')

    stock_high = str(historical_data[len(historical_data) - 1 - index]['High'])
    stock_low = str(historical_data[len(historical_data) - 1 - index]['Low'])

    stock_open = str(historical_data[len(historical_data) - 1 - index]['Open'])
    stock_close = str(historical_data[len(historical_data) - 1 - index]['Close'])

    stock_volume = str(int(historical_data[len(historical_data) - 1 - index]['Volume']) / 1000)

    high_low_text += date + "\t" + stock_high + "\t" + stock_low + "\n"
    open_close_text += date + "\t" + stock_open + "\t" + stock_close + "\n"
    volume_text += date + "\t" + stock_volume + "\n"

  high_low_directory = '/data/highlow.tsv'
  open_close_directory = '/data/openclose.tsv'
  volume_directory = '/data/volume.tsv'

  write_to_file(high_low_directory, high_low_text)
  write_to_file(open_close_directory, open_close_text)
  write_to_file(volume_directory, volume_text)

  ratio_text = "name\t" + "value\n"

  if stock.get_change() != None:
    name = "Change"
    value = str(stock.get_change())
    ratio_text += name + "\t" + value + "\n"

  if stock.get_dividend_share() != None:
    name = "Dividend Share"
    value = str(stock.get_dividend_share())
    ratio_text += name + "\t" + value + "\n"

  if stock.get_dividend_yield() != None:
    name = "Divident Yield"
    value = str(stock.get_dividend_yield())
    ratio_text += name + "\t" + value + "\n"

  if stock.get_earnings_share() != None:
    name = "Earning Share"
    value = str(stock.get_earnings_share())
    ratio_text += name + "\t" + value + "\n"

  if stock.get_price_earnings_ratio() != None:
    name = "Price Earning"
    value = str(stock.get_price_earnings_ratio())
    ratio_text += name + "\t" + value + "\n"

  if stock.get_price_earnings_growth_ratio() != None:
    name = "Price Earning Growth"
    value = str(stock.get_price_earnings_growth_ratio())
    ratio_text += name + "\t" + value + "\n"

  if stock.get_price_sales() != None:
    name = "Price Sales"
    value = str(stock.get_price_sales())
    ratio_text += name + "\t" + value + "\n"

  if stock.get_price_book() != None:
    name = "Price Book"
    value = str(stock.get_price_book())
    ratio_text += name + "\t" + value + "\n"

  if stock.get_short_ratio() != None:
    name = "Short"
    value = str(stock.get_short_ratio())
    ratio_text += name + "\t" + value + "\n"

  ratio_directory = '/data/ratio.tsv'

  write_to_file(ratio_directory, ratio_text)
Exemplo n.º 9
0
		selections.append('Volume: ')
		print output
		

	if myargs.change is True:
		change = stock.get_change()
		output.append(change)
		selections.append('Change: ')
		print change

	if myargs.avgvol is True:
		avgvolume = stock.get_avg_daily_volume()
		print avgvolume

	if myargs.short is True:
		short = stock.get_short_ratio()
		print short

	if myargs.peratio is True:
		pe = stock.get_price_earnings_ratio()
		print pe

	if myargs.exchange is True:
		exchange = stock.get_stock_exchange()

	if myargs.ma50 is True:
		ma50 = stock.get_50day_moving_avg()
		print ma50

	if myargs.ma200 is True:
		ma200 = stock.get_200day_moving_avg()
Exemplo n.º 10
0
		russell3000.set_value(s,'50 days MA',shy.get_50day_moving_avg())
	except:
		pass
	try:
		russell3000.set_value(s,'200 days MA',shy.get_200day_moving_avg())
	except:
		pass
	try:
		russell3000.set_value(s,'Price earnings ratio',shy.get_price_earnings_ratio())
	except:
		pass
	try:
		russell3000.set_value(s,'Price earnings growth ratio',shy.get_price_earnings_growth_ratio())
	except:
		pass
	try:
		russell3000.set_value(s,'Price sales',shy.get_price_sales())
	except:
		pass
	try:
		russell3000.set_value(s,'Price book',shy.get_price_book())
	except:
		pass
	try:
		russell3000.set_value(s,'Short ratio',shy.get_short_ratio())
	except:
		pass
u=datetime.now()
ofn='r3alldata'+str(u)[0:4]+str(u)[5:7]+str(u)[8:10]+'.xls'
russell3000.to_excel(ofn)
def checklist(symbol, ibd50_list, ibd_session):
    """
    Looks up information on a given stock market symbol.
    The returned dictionary contains all information from
    Dr. Wish's Stock Checklist for HONR348M.
    """
    stock = {}
    # Load price data from yahoo.
    share = Share(symbol)
    ks = yahoo_ks(symbol)

    # Basics
    basics = stock["basics"] = {}
    basics["date"] = datetime.now().strftime("%m/%d/%Y %I:%M:%S%z")
    basics["symbol"] = symbol
    basics["equity_name"] = share.get_name()
    basics["price"] = float(share.get_price())
    basics["52w_low"] = float(share.get_year_low())
    basics["52w_high"] = float(share.get_year_high())
    basics["percent_from_52w_low"] = share.get_percent_change_from_year_low()
    basics["percent_from_52w_high"] = share.get_percent_change_from_year_high()

    # IBD (Stocks only)
    ibd = stock["ibd"] = ibd_stock_checkup(symbol, ibd_session)
    # ibd["industry"]
    ibd["industry_rank"] = float(ibd["industry_rank"])
    # ibd["industry_top5"]
    # ibd["3y_eps_growth"]
    # ibd["3y_sales_growth"]
    # ibd["eps_change"]
    ibd["eps_rating"] = float(ibd["eps_rating"])
    ibd["rs_rating"] = float(ibd["rs_rating"])
    # ibd["acc_distr_rating"]
    ibd["ibd_rating"] = float(ibd["ibd_rating"])
    ibd["in_ibd50"] = symbol in ibd50_list
    # ibd["fundamental_greens"]
    # ibd["technical_greens"]
    ibd["next_earning"] = datetime.strptime(ibd["next_earning"], '%m/%d/%Y')

    # Yahoo Finance (Stocks only)
    yahoo = stock["yahoo"] = {}
    yahoo["pe"] = float(share.get_price_earnings_ratio())
    yahoo["peg"] = float(share.get_price_earnings_growth_ratio())
    yahoo["ps"] = float(share.get_price_sales())
    yahoo["market_cap"] = share.get_market_cap()
    yahoo["float"] = ks["Float"]
    yahoo["annual_roe"] = ks["Return on Equity"]
    yahoo["percent_inst"] = ks["% Held by Institutions"]
    yahoo["percent_float_short"] = ks["Short % of Float"]
    yahoo["short_ratio"] = float(share.get_short_ratio())

    # Evidence of an uptrend/downtrend
    uptrend = stock["uptrend"] = {}
    downtrend = stock["downtrend"] = {}

    pdstockdata = data.DataReader(symbol, 'yahoo', '1900-01-01')
    sd = StockDataFrame.retype(pdstockdata)
    sd.BOLL_PERIOD = 15

    close1 = sd['close'][-1]
    close2 = sd['close'][-2]
    low1 = sd['low'][-1]
    low2 = sd['low'][-2]
    high1 = sd['high'][-1]
    high2 = sd['high'][-2]
    avg_30d = sd['close_30_sma'][-1]
    avg_4w = sd['close_20_sma'][-1]
    avg_10w = sd['close_50_sma'][-1]
    avg_30w = sd['close_150_sma'][-1]
    high_52w = sd['high'].tail(250).max()
    lbb1 = sd['boll_lb'][-1]
    lbb2 = sd['boll_lb'][-2]
    ubb1 = sd['boll_ub'][-1]
    ubb2 = sd['boll_ub'][-2]

    # Find all GLTs (ATH not broken for at least another 90 days)
    last_ath = 0.0
    ath = Series()
    for day, day_high in sd['high'].iteritems():
        last_ath = max(last_ath, day_high)
        ath.set_value(day, last_ath)
    ath_days = sd[sd['high'] == ath]['high']
    glt = Series()
    for i, (day, high) in enumerate(ath_days.iteritems()):
        next_day = ath_days.keys()[i +
                                   1] if i < len(ath_days) - 1 else Timestamp(
                                       str(date.today()))
        if next_day - day >= Timedelta('90 days'):
            glt.set_value(day, high)

    uptrend["c>30d_avg"] = close1 > avg_30d
    uptrend["c>10w_avg"] = close1 > avg_10w
    uptrend["c>30w_avg"] = close1 > avg_30w
    uptrend["4w>10w>30w"] = avg_4w > avg_10w > avg_30w
    # uptrend["w_rwb"] =
    uptrend["last_glt_date"] = glt.keys()[-1].to_datetime().date(
    ) if len(glt) > 0 else None
    uptrend["last_glt_high"] = glt[-1] if len(glt) > 0 else None
    uptrend["above_last_glt"] = len(glt) > 0 and close1 > glt[-1]
    uptrend["macd_hist_rising"] = sd['macdh'][-1] > sd['macdh_4_sma'][-1]
    uptrend["stoch_fast>slow"] = sd['rsv_10_4_sma'][-1] > sd[
        'rsv_10_4_sma_4_sma'][-1]
    # uptrend["bb_up_expansion_l2"]
    # uptrend["rs>30d_avg"] = (Need Investors.com data)
    # uptrend["rs_rising"] = (Need Investors.com data)
    uptrend["52w_high_l2"] = high_52w == high1 or high_52w == high2
    uptrend["ath_l2"] = ath[-1] == high1 or ath[-2] == high2
    uptrend["1y_doubled"] = close1 >= 2 * sd['close'][-255:-245].mean()
    # uptrend["bounce_30d_l2"] =
    # uptrend["bounce_10w_l2"] =
    # uptrend["bounce_30w_l2"] =
    uptrend["stoch<50"] = sd['rsv_10_4_sma'][-1] < 50
    uptrend["<bb_lower_l2"] = low1 < lbb1 or low2 < lbb2
    uptrend[
        "above_avg_volume"] = sd['volume'][-1] > 1.5 * sd['volume_50_sma'][-1]

    downtrend["c<30d_avg"] = close1 < avg_30d
    downtrend["c<10w_avg"] = close1 < avg_10w
    downtrend["c<30w_avg"] = close1 < avg_30w
    downtrend["4w<10w<30w"] = avg_4w < avg_10w < avg_30w
    # downtrend["w_bwr"] =
    downtrend["macd_hist_falling"] = sd['macdh'][-1] < sd['macdh_4_sma'][-1]
    downtrend["stoch_fast<slow"] = sd['rsv_10_4_sma'][-1] < sd[
        'rsv_10_4_sma_4_sma'][-1]
    # downtrend["bb_down_expansion_l2"]
    # downtrend["bounce_30d_l2"] =
    # downtrend["bounce_10w_l2"] =
    # downtrend["bounce_30w_l2"] =
    downtrend["stoch>50"] = sd['rsv_10_4_sma'][-1] > 50
    downtrend[">bb_upper_l2"] = high1 > ubb1 or high2 > ubb2

    return stock
Exemplo n.º 12
0
from yahoo_finance import Share, Currency



yahoo = Share('AAPL')

yahoo.refresh()

print yahoo.get_info()
print yahoo.get_avg_daily_volume()
print yahoo.get_stock_exchange()
print yahoo.get_book_value()
print yahoo.get_ebitda()
print yahoo.get_dividend_share()
print yahoo.get_price_earnings_ratio()
print yahoo.get_short_ratio()
print yahoo.get_price_book()

# f = open('nasdaqlisted.txt', 'r')

# print (f.readline())
# print (f.readline())
Exemplo n.º 13
0
print "get_ebitda:", tesla.get_ebitda()
print "get_dividend_share:", tesla.get_dividend_share()
print "get_dividend_yield:", tesla.get_dividend_yield()
print "get_earnings_share:", tesla.get_earnings_share()
print "get_days_high:", tesla.get_days_high()
print "get_days_low:", tesla.get_days_low()
print "get_year_high:", tesla.get_year_high()
print "get_year_low:", tesla.get_year_low()
print "get_50day_moving_avg:", tesla.get_50day_moving_avg()
print "get_200day_moving_avg:", tesla.get_200day_moving_avg()
print "get_price_earnings_ratio:", tesla.get_price_earnings_ratio()
print "get_price_earnings_growth_ratio:", tesla.get_price_earnings_growth_ratio(
)
print "get_price_sales:", tesla.get_price_sales()
print "get_price_book:", tesla.get_price_book()
print "get_short_ratio:", tesla.get_short_ratio()
print "get_trade_datetime:", tesla.get_trade_datetime()
# "a:", print tesla.get_historical(start_date, end_date)
# "a:", print tesla.get_info()
print "get_name:", tesla.get_name()
print "refresh:", tesla.refresh()
print "get_percent_change_from_year_high:", tesla.get_percent_change_from_year_high(
)
print "get_percent_change_from_year_low:", tesla.get_percent_change_from_year_low(
)
print "get_change_from_year_low:", tesla.get_change_from_year_low()
print "get_change_from_year_high:", tesla.get_change_from_year_high()
print "get_percent_change_from_200_day_moving_average:", tesla.get_percent_change_from_200_day_moving_average(
)
print "get_change_from_200_day_moving_average:", tesla.get_change_from_200_day_moving_average(
)
def get_stock_info():
	share = Share('AAPL')
	opening = share.get_open()
	dividend_yeild = share.get_earnings_share()

	print share.get_short_ratio()
Exemplo n.º 15
0
from yahoo_finance import Share, Currency

yahoo = Share('AAPL')

yahoo.refresh()

print yahoo.get_info()
print yahoo.get_avg_daily_volume()
print yahoo.get_stock_exchange()
print yahoo.get_book_value()
print yahoo.get_ebitda()
print yahoo.get_dividend_share()
print yahoo.get_price_earnings_ratio()
print yahoo.get_short_ratio()
print yahoo.get_price_book()

# f = open('nasdaqlisted.txt', 'r')

# print (f.readline())
# print (f.readline())