stock = finvizfinance('apd')
stock.ticker_description()
'Air Products and Chemicals, Inc. provides atmospheric gases, process and specialty gases, equipment, and related services in the Americas, Asia, Europe, the Middle East, India, and internationally. The company produces atmospheric gases, including oxygen, nitrogen, and argon; process gases, such as hydrogen, helium, carbon dioxide, carbon monoxide, and syngas; specialty gases; and equipment for the production or processing of gases comprising air separation units and non-cryogenic generators for customers in various industries, including refining, chemical, manufacturing, electronics, magnetic resonance imaging, energy production, medical, food, and metals. It also designs and manufactures equipment for air separation, hydrocarbon recovery and purification, natural gas liquefaction, and liquid helium and liquid hydrogen transport and storage. The company was founded in 1940 and is headquartered in Allentown, Pennsylvania.'
import openai
import pandas as pd
stns = stock.ticker_news()
nshead = stns.head(5)
onlink = nshead[['Link']]
# API key
openai.api_key = ""
def summarize(text):
# model engine
model_engine = "text-davinci-003"
# max token
max_tokens = 1000
# prompt
prompt = f''' Summarize the below link and what is the result of that, analyze the article with
{text}
'''
# summary request
completion = openai.Completion.create(
engine=model_engine,
prompt=prompt,
max_tokens=max_tokens,
temperature=0.3, # creativity
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
return completion.choices[0].text
def anaylsis(text):
# model engine
model_engine = "text-davinci-003"
# max token
max_tokens = 3000
# prompt
prompt = f''' Summarize and merge the below articles and analyze them whether they are positive signs or not.
{text}
'''
# summary request
completion = openai.Completion.create(
engine=model_engine,
prompt=prompt,
max_tokens=max_tokens,
temperature=0.3, # creativity
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
return completion.choices[0].text
def summarize_news(url):
return summarize(url)
Link
0 https://finance.yahoo.com/news/air-products-de...
1 https://finance.yahoo.com/news/air-products-bo...
2 https://finance.yahoo.com/m/61b65e76-a653-3816...
3 https://finance.yahoo.com/m/0593dc4a-aa31-3fda...
4 https://finance.yahoo.com/news/aers-energy-bel...
5 https://finance.yahoo.com/news/air-products-ch...
6 https://finance.yahoo.com/m/0be327dc-0de6-38c8...
7 https://finance.yahoo.com/news/air-products-ch...
8 https://finance.yahoo.com/news/air-products-me...
9 https://finance.yahoo.com/m/08c2b99a-90ea-31ab...
output_df =[]
for i in onlink.values:
output = summarize_news(i)
output_df.append(output)
output_df
["\nThis article from Yahoo Finance discusses Air Products' decision to declare a quarterly dividend of $1.10 per share. This dividend will be payable on August 28, 2020 to shareholders of record at the close of business on August 7, 2020. Air Products is a leading global supplier of industrial gases and related equipment. The company has been paying dividends since 1961 and has increased its dividend for 46 consecutive years. This dividend increase is a sign of confidence in the company's financial strength and prospects for the future. The dividend will provide shareholders with a steady income stream and is a sign of the company's commitment to rewarding its shareholders.",
"\nThis article discusses the decision of the board of directors of Air Products to extend the employment contract of its CEO, Seifi Ghasemi. The board unanimously voted to extend Ghasemi's contract for an additional three years, citing his successful leadership of the company and his commitment to the company's long-term success. Ghasemi has been CEO of Air Products since 2014 and has overseen a period of strong financial performance and strategic growth for the company. The extension of his contract is seen as a sign of the board's confidence in his ability to continue to lead the company to success.",
'\nThis article is about an analyst report on Air Products, a global industrial gas company. The report was conducted by analysts at Credit Suisse and was released on August 6th, 2020. The report states that Air Products is well-positioned to benefit from the global economic recovery, as well as from the long-term growth of the industrial gas market. The analysts also noted that Air Products has a strong balance sheet and a strong dividend yield. They also highlighted the company\'s focus on cost-cutting and efficiency measures, which should help to improve profitability. In conclusion, the analysts at Credit Suisse believe that Air Products is a good investment opportunity and have given the company an "Outperform" rating.',
"\nThis article discusses the performance of three stocks: Air Products and Chemicals (APD), Intercontinental Exchange (ICE), and BCE Inc. (BCE). APD is up 3.4%, ICE is up 1.3%, and BCE is up 0.9%. The article attributes the gains to a strong performance in the broader market, with the S&P 500 and Nasdaq Composite both up 0.7%. The article also notes that investors are optimistic about the economic recovery, and that the Federal Reserve's commitment to low interest rates is helping to support the market. Overall, the article suggests that the three stocks are performing well due to a strong market and investor optimism.",
"\nThis article discusses Aers Energy's decision to select Air Products to supply its new hydrogen production facility in Belgium. Air Products will provide hydrogen production technology and engineering services for the facility, which will produce up to 50 tons of hydrogen per day. The facility will use natural gas to produce hydrogen, which will be used in the production of renewable fuels and chemicals. The project is expected to be completed in 2021.\n\nThe result of this decision is that Air Products will be able to provide hydrogen production technology and engineering services for Aers Energy's new hydrogen production facility. This will enable Aers Energy to produce up to 50 tons of hydrogen per day, which can be used in the production of renewable fuels and chemicals. The project is expected to be completed in 2021."]
analyze_news = anaylsis(output_df)
analyze_news
'\nThe articles discuss several positive signs for Air Products, a leading global supplier of industrial gases and related equipment. The company has declared a quarterly dividend of $1.10 per share, extended the employment contract of its CEO, and been given an "Outperform" rating by analysts at Credit Suisse. Additionally, Air Products\' stock is up 3.4%, and the company has been selected to supply a new hydrogen production facility in Belgium. These are all positive signs for Air Products, indicating confidence in the company\'s financial strength and prospects for the future, as well as its ability to provide hydrogen production technology and engineering services.'
Date Title \
0 2023-05-18 10:45:00 Air Products Declares Quarterly Dividend
1 2023-05-18 06:00:00 Air Products' Board of Directors Again Extends...
2 2023-05-16 13:25:00 Analyst Report: Air Products & Chemicals Inc.
3 2023-05-16 13:10:00 Market Update: APD, ICE, BCE
4 2023-05-15 10:15:00 Aers Energy België Selects Air Products to Bui...
Link
0 https://finance.yahoo.com/news/air-products-de...
1 https://finance.yahoo.com/news/air-products-bo...
2 https://finance.yahoo.com/m/61b65e76-a653-3816...
3 https://finance.yahoo.com/m/0593dc4a-aa31-3fda...
4 https://finance.yahoo.com/news/aers-energy-bel...
symbol = 'APD'
tickeryahoo = yf.Ticker(symbol)
{'address1': '1940 Air Products Boulevard',
'city': 'Allentown',
'state': 'PA',
'zip': '18106-5500',
'country': 'United States',
'phone': '610 481 4911',
'website': 'https://www.airproducts.com',
'industry': 'Specialty Chemicals',
'industryDisp': 'Specialty Chemicals',
'sector': 'Basic Materials',
'longBusinessSummary': 'Air Products and Chemicals, Inc. provides atmospheric gases, process and specialty gases, equipment, and related services in the Americas, Asia, Europe, the Middle East, India, and internationally. The company produces atmospheric gases, including oxygen, nitrogen, and argon; process gases, such as hydrogen, helium, carbon dioxide, carbon monoxide, and syngas; specialty gases; and equipment for the production or processing of gases comprising air separation units and non-cryogenic generators for customers in various industries, including refining, chemical, manufacturing, electronics, magnetic resonance imaging, energy production, medical, food, and metals. It also designs and manufactures equipment for air separation, hydrocarbon recovery and purification, natural gas liquefaction, and liquid helium and liquid hydrogen transport and storage. The company was founded in 1940 and is headquartered in Allentown, Pennsylvania.',
'fullTimeEmployees': 19710,
'companyOfficers': [{'maxAge': 1,
'name': 'Mr. Seifollah Ghasemi',
'age': 78,
'title': 'Chairman, Pres & CEO',
'yearBorn': 1944,
'fiscalYear': 2022,
'totalPay': 4715308,
'exercisedValue': 0,
'unexercisedValue': 22770252},
{'maxAge': 1,
'name': 'Ms. Melissa N. Schaeffer',
'age': 41,
'title': 'Sr. VP & CFO',
'yearBorn': 1981,
'fiscalYear': 2022,
'totalPay': 1277143,
'exercisedValue': 0,
'unexercisedValue': 0},
{'maxAge': 1,
'name': 'Dr. Samir Jawdat Serhan',
'age': 61,
'title': 'Chief Operating Officer',
'yearBorn': 1961,
'fiscalYear': 2022,
'totalPay': 4261362,
'exercisedValue': 0,
'unexercisedValue': 0},
{'maxAge': 1,
'name': 'Mr. Sean D. Major',
'age': 58,
'title': 'Exec. VP, Gen. Counsel & Sec.',
'yearBorn': 1964,
'fiscalYear': 2022,
'totalPay': 1853735,
'exercisedValue': 0,
'unexercisedValue': 0},
{'maxAge': 1,
'name': 'Mr. Jeffrey Kutz',
'age': 62,
'title': 'VP, Corp. Controller & Principal Accounting Officer',
'yearBorn': 1960,
'exercisedValue': 0,
'unexercisedValue': 0},
{'maxAge': 1,
'name': 'Mr. William Karlson',
'title': 'Exec. Director of Technology',
'exercisedValue': 0,
'unexercisedValue': 0},
{'maxAge': 1,
'name': 'Mr. Brian Galovich',
'title': 'Sr. VP & Chief Information Officer',
'exercisedValue': 0,
'unexercisedValue': 0},
{'maxAge': 1,
'name': 'Mr. Simon R. Moore',
'title': 'VP of Investor Relations, Corp. Relations & Sustainability',
'exercisedValue': 0,
'unexercisedValue': 0},
{'maxAge': 1,
'name': 'Ms. Katie McDonald',
'title': 'VP of Corp. Communications',
'exercisedValue': 0,
'unexercisedValue': 0},
{'maxAge': 1,
'name': 'Ms. Victoria Brifo',
'age': 53,
'title': 'Sr. VP & Chief HR Officer',
'yearBorn': 1969,
'exercisedValue': 0,
'unexercisedValue': 0}],
'auditRisk': 7,
'boardRisk': 4,
'compensationRisk': 2,
'shareHolderRightsRisk': 7,
'overallRisk': 5,
'governanceEpochDate': 1682899200,
'compensationAsOfEpochDate': 1672444800,
'maxAge': 86400,
'priceHint': 2,
'previousClose': 275.45,
'open': 276.74,
'dayLow': 276.185,
'dayHigh': 280.28,
'regularMarketPreviousClose': 275.45,
'regularMarketOpen': 276.74,
'regularMarketDayLow': 276.185,
'regularMarketDayHigh': 280.28,
'dividendRate': 7.0,
'dividendYield': 0.0251,
'exDividendDate': 1688083200,
'payoutRatio': 0.68,
'fiveYearAvgDividendYield': 2.21,
'beta': 0.854679,
'trailingPE': 28.723995,
'forwardPE': 22.153296,
'volume': 1072011,
'regularMarketVolume': 1072011,
'averageVolume': 938253,
'averageVolume10days': 999200,
'averageDailyVolume10Day': 999200,
'bid': 272.39,
'ask': 285.27,
'bidSize': 1000,
'askSize': 800,
'marketCap': 61952327680,
'fiftyTwoWeekLow': 218.88,
'fiftyTwoWeekHigh': 328.56,
'priceToSalesTrailing12Months': 4.7169065,
'fiftyDayAverage': 283.4824,
'twoHundredDayAverage': 280.04996,
'trailingAnnualDividendRate': 6.61,
'trailingAnnualDividendYield': 0.023997094,
'currency': 'USD',
'enterpriseValue': 69919948800,
'profitMargins': 0.16577,
'floatShares': 221285316,
'sharesOutstanding': 222123008,
'sharesShort': 1721789,
'sharesShortPriorMonth': 1919967,
'sharesShortPreviousMonthDate': 1680220800,
'dateShortInterest': 1682640000,
'sharesPercentSharesOut': 0.0078,
'heldPercentInsiders': 0.00378,
'heldPercentInstitutions': 0.86310995,
'shortRatio': 2.18,
'shortPercentOfFloat': 0.0078,
'impliedSharesOutstanding': 0,
'bookValue': 63.291,
'priceToBook': 4.406788,
'lastFiscalYearEnd': 1664496000,
'nextFiscalYearEnd': 1696032000,
'mostRecentQuarter': 1680220800,
'earningsQuarterlyGrowth': -0.171,
'netIncomeToCommon': 2164600064,
'trailingEps': 9.71,
'forwardEps': 12.59,
'pegRatio': 2.57,
'lastSplitFactor': '1081:1000',
'lastSplitDate': 1475452800,
'enterpriseToRevenue': 5.324,
'enterpriseToEbitda': 17.764,
'52WeekChange': 0.17213702,
'SandP52WeekChange': 0.05491793,
'lastDividendValue': 1.75,
'lastDividendDate': 1680220800,
'exchange': 'NYQ',
'quoteType': 'EQUITY',
'symbol': 'APD',
'underlyingSymbol': 'APD',
'shortName': 'Air Products and Chemicals, Inc',
'longName': 'Air Products and Chemicals, Inc.',
'firstTradeDateEpochUtc': 322151400,
'timeZoneFullName': 'America/New_York',
'timeZoneShortName': 'EDT',
'uuid': '7dc5e22e-aca5-37c1-965b-43839084afc6',
'messageBoardId': 'finmb_248356',
'gmtOffSetMilliseconds': -14400000,
'currentPrice': 278.91,
'targetHighPrice': 375.0,
'targetLowPrice': 300.0,
'targetMeanPrice': 329.86,
'targetMedianPrice': 325.0,
'recommendationMean': 2.3,
'recommendationKey': 'buy',
'numberOfAnalystOpinions': 21,
'totalCash': 2522400000,
'totalCashPerShare': 11.356,
'ebitda': 3936100096,
'totalDebt': 9858199552,
'quickRatio': 1.665,
'currentRatio': 2.045,
'totalRevenue': 13134100480,
'debtToEquity': 67.107,
'revenuePerShare': 59.123,
'returnOnAssets': 0.057239998,
'returnOnEquity': 0.15076,
'grossProfits': 3360100000,
'freeCashflow': -444737504,
'operatingCashflow': 3283200000,
'earningsGrowth': -0.172,
'revenueGrowth': 0.087,
'grossMargins': 0.27528998,
'ebitdaMargins': 0.29968,
'operatingMargins': 0.19834,
'financialCurrency': 'USD',
'trailingPegRatio': 1.7767}