Ejemplo n.º 1
0
    def calculate_ps_metrics(stock):
        yahoo_stock = YahooFinancials(stock.symbol)
        market_cup = yahoo_stock.get_market_cap()
        if stock.target_avg_sales:
            multiplier = FilteredStocks.get_multiplier(
                stock.target_avg_sales[-1])
            target_avg_sales = float(stock.target_avg_sales[:-1]) * multiplier
            try:
                stock.price_to_sell_ratio = round(
                    market_cup / target_avg_sales, 2)
                stock.ps_to_growth_ratio = round(
                    stock.price_to_sell_ratio /
                    float(stock.target_sales_growth[:-1]), 2)
                ev = (yahoo_stock.get_key_statistics_data()[stock.symbol]
                      ["enterpriseValue"])
                profit_margins = (yahoo_stock.get_key_statistics_data()[
                    stock.symbol]["profitMargins"])
                stock.ev_to_sell_ratio = round(ev / target_avg_sales, 2)
                stock.gross_margins = round(
                    yahoo_stock.get_gross_profit() /
                    yahoo_stock.get_total_revenue() * 100, 2)
                ev_to_profit_ratio = round(
                    stock.ev_to_sell_ratio / profit_margins, 2)
                print("gross_margins : " + str(stock.gross_margins))
                print("ev sells : " + str(stock.ev_to_sell_ratio))
                print("ev / earnings : " + str(ev_to_profit_ratio))
                print("ps_to_growth : " + str(stock.ps_to_growth_ratio))
                print("sales targets:" + str(stock.target_sales_growth[:-1]))
                print("growth adujsted ev / sells: " + str(
                    round(
                        stock.ev_to_sell_ratio /
                        float(stock.target_sales_growth[:-1]), 2)))

            except Exception as e:
                print(str(e))
Ejemplo n.º 2
0
async def stock(ctx, ticker, info):
    yahoo_financials = YahooFinancials(ticker)
    if (info == "current"):
        await ctx.send(ticker.upper() + " current share price: $" +
                       str(yahoo_financials.get_current_price()))
    if (info == "open"):
        await ctx.send(ticker.upper() + " share price at opening: $" +
                       str(yahoo_financials.get_open_price()))
    if (info == "prevclose"):
        await ctx.send(ticker.upper() + " share priced at previous close: $" +
                       str(yahoo_financials.get_prev_close_price()))
    if (info == "cap"):
        await ctx.send(ticker.upper() + " market cap: $" +
                       str("{:,}".format(yahoo_financials.get_market_cap())))
    if (info == "dailylow"):
        await ctx.send(ticker.upper() + " daily low: $" +
                       str(yahoo_financials.get_daily_low()))
    if (info == "dailyhigh"):
        await ctx.send(ticker.upper() + " daily high: $" +
                       str(yahoo_financials.get_daily_high()))
    if (info == "yearlow"):
        await ctx.send(ticker.upper() + " yearly low: $" +
                       str(yahoo_financials.get_yearly_low()))
    if (info == "yearhigh"):
        await ctx.send(ticker.upper() + " yearly high: $" +
                       str(yahoo_financials.get_yearly_high()))
    if (info == "rev"):
        await ctx.send(ticker.upper() + " total revenue: $" +
                       str("{:,}".format(yahoo_financials.get_total_revenue()))
                       )
    if (info == "net"):
        await ctx.send(ticker.upper() + " net income: $" +
                       str("{:,}".format(yahoo_financials.get_net_income())))
    if (info == "op"):
        await ctx.send(
            ticker.upper() + " operating income: $" +
            str("{:,}".format(yahoo_financials.get_operating_income())))
    if (info == "profit"):
        await ctx.send(ticker.upper() + " gross profit: $" +
                       str("{:,}".format(yahoo_financials.get_gross_profit())))