![]() The main reason is the reduced demand for these services, due to the restrictions in place and the fear of COVID-19 spread. The industrial sector has experienced significant losses as well, especially in the “aerospace and defence” and “airlines” sub-sectors. ![]() In fact, due to a large portion of the world population being in lockdown, the demand for oil and gas has significantly dropped. It can be seen from Figure 1 that all sectors, as an average, have been negatively impacted by the pandemic, with the highest losses in the energy sector. The financial shock caused by the pandemic has not been uniform, and the various business sectors have responded differently to the crisis. In this section, the outputs of the code presented above are summarised in Figures 1, 2 and 3.ĬOVID-19 has had an unprecedented impact on our lives, our habits, on the real economy and on the financial markets. The impact of COVID-19 on financial markets You can find further comments to the code and additional details in the notebook on the GitHub page. df_all = pd.DataFrame() color_df = pd.DataFrame(, legend='sector', line_width=0) p.xaxis.major_label_orientation = math.pi/3 p.yaxis.axis_label = 'Year to date average performance (%)' p.title.text_font_size = '12pt' p.yaxis.axis_label_text_font_size = '12pt' show(p) As anticipated, the yfinance API is used to gather the financial data. index_name = 'SP_500' companies = pd.read_html('', flavor='bs4')Īt this point, the data are downloaded and all the calculations are performed. # Example of input definition depth = ' sub_sector' filter = ' Information Technology'Īll the other inputs such as the list of S&P 500 stocks, and the date to compare current market performance against (beginning of 2020) are automatically set. The available values of filter are: Communication Services, Consumer Discretionary, Consumer Staples, Energy, Financials, Health Care, Industrials, Information Technology, Materials, Real Estate and Utilities. In this last case, the user has to also specify the “filter”, that is the sector of interest. Choosing “ sector” will produce a plot such as the one in Figure 1, whereas “ sub_sector” will produce a plots similar to the ones in Figure 2 and Figure 3. ![]() This can either be set to “ sector” or “ sub_sector”. In the first section of the script, the user needs to define the variable called “depth” to defines the level of detail of the analysis. # Import libraries import yfinance as yf import pandas as pd from otting import figure import bokeh.models as bmo from bokeh.palettes import Paired11 from bokeh.io import show from bokeh.models import ColumnDataSource, HoverTool import math The API is free to use and it is public, meaning that the user does not need an individual API key. pandas, bokeh, math) as well as the yfinance API (Application Programming Interface), that is used to download the S&P 500 stock prices. GlobalSign will issue you an mTLS Certificate based on the public key you supplied above. The script makes use of standard Python packages (i.e. key: keyvalue secret: secretvalue The API key also forms part of the encrypted file name after the word ‘cred-‘.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |