Пример #1
0
def stock_detail(stock_name):
    stock_dict = {}

    yahoo_financial = YahooFinancials(stock_name)
    current_price = yahoo_financial.get_current_price()
    fifty_two_week_high_value = yahoo_financial.get_yearly_high()
    fifty_two_week_low_value = yahoo_financial.get_yearly_low()

    stock_dict['stock_name'] = stock_name
    stock_dict['high_value'] = fifty_two_week_high_value
    stock_dict['low_value'] = fifty_two_week_low_value
    stock_dict['current_price'] = current_price
    return stock_dict
Пример #2
0
def getMarketData():
    tickers = 'AAPL'
    financials = YahooFinancials(tickers)

    #	company_stock_price = financials.get_stock_price_data() #gets stock price information

    historical_stock_prices_data = financials.get_historical_price_data(
        '2015-11-21', '2020-11-21',
        'daily')  #gets historical daily stock price of company
    #	get_Div_data(historical_stock_prices_data[tickers])
    get_stock_price_data(historical_stock_prices_data[tickers])

    #	company_balance_sheet_data_qt = financials.get_financial_stmts('quarterly', 'balance') #get balance sheet
    #	company_income_statement_data_qt = financials.get_financial_stmts('quarterly', 'income') #get income statement

    company_key_statistics_data = financials.get_key_statistics_data(
    )  #includes profit margins, forward eps, yearly change etc.
    #	get_forward_pe(company_key_statistics_data[tickers])
    #	get_trailing_eps(company_key_statistics_data[tickers])
    #	get_foward_eps(company_key_statistics_data[tickers])
    #	get_ytdReturn(company_key_statistics_data[tickers])

    company_earnings_data = financials.get_stock_earnings_data(
    )  #historical eps only for 1 year span
    #	get_earnings_data(company_earnings_data[tickers])

    company_dividend_yield = financials.get_dividend_yield(
    )  #current dividends yield
    company_dividend = financials.get_dividend_rate()  #current dividends rate
    company_avg_div_yield_1year = financials.get_annual_avg_div_yield(
    )  #average 1 year div yield
    company_avg_div_yield_5year = financials.get_five_yr_avg_div_yield(
    )  #average 5 year div yield
    company_eps = financials.get_earnings_per_share()  #current eps
    company_pe = financials.get_pe_ratio()  #current pe ratio
    company_beta = financials.get_beta()  #current beta
    company_current_stock_price = financials.get_current_price(
    )  #current stock price

    company_revenue = financials.get_total_revenue()  #current company revenue
    company_operating_income = financials.get_operating_income(
    )  #current company operating income
    company_net_income = financials.get_net_income()  #current net income

    company_yearly_high = financials.get_yearly_high()  #get yearly high
    company_yearly_low = financials.get_yearly_low()  #get yearly low
    company_moving_50 = financials.get_50day_moving_avg(
    )  #50 day moving average of stock
    company_moving_200 = financials.get_200day_moving_avg(
    )  #200 day moving average of stock
Пример #3
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())))