Edgar can be used to analyse the financials of a single company over time.
However, we try to get an overall picture of the profits over all companies.
For this we use the Python Data Analysis Library Pandas and my simple Edgar REST API.
import pandas
import matplotlib.pyplot as plt
Profits by Country¶
We can get a quick overview with the help of the follwing REST get request. We ask for countries by year and we limit the data to the first top 14 (+ 1 for all others) most important entries:
url = 'https://pschatzmann.ch/edgar/values?format=csv&col=country&row=year¶meter=NetIncomeLoss&n=15'
df = pandas.read_csv(url, sep=";", index_col=0)
df
df.plot.line(figsize=(20, 8))
The US is – as expected – by far the biggest country. However it is interesting to see that the total profits of all Irish companies are bigger then then ones from Great Britain!
The second thing to note is that companies from small countries seem to roll in bigger profits then the ones from other bigger countries: So you should have a look at companies from Bermuda, Luxemburg, Singapore, the Netherlands, Switzerland and the Cayman Islands. So this list does not match with the top 15 economies in size.
Overview by Industry¶
With the same approach we can also get an overview of the profits by industry sector. Here are the top 5 secotors:
url = 'https://pschatzmann.ch/edgar/values?format=csv&col=sicDescription&row=year¶meter=NetIncomeLoss&n=6'
sectors = pandas.read_csv(url,sep=";",index_col=0)
sectors.plot.bar( )
sectors.iloc[-2].plot.pie(figsize=(5, 5))
Over the last couple of years the Software industry was most profitable wheres the profits of the Oil industry were shrinking over time.
By States¶
Now we have a quick look at the most profitable states
url = 'https://pschatzmann.ch/edgar/values?format=csv&col=state&row=year¶meter=NetIncomeLoss&n=11'
states = pandas.read_csv(url, sep=";", index_col=0)
states.plot.line(figsize=(20, 8))
states.iloc[-2].plot.bar(figsize=(5, 5))
California is winning by far and Texas is the big looser. I first guess might be that Texas was not diversified enough to offset the shrinking returns in the oil industry.
Totals¶
And finally we look at the totals by year:
url = 'https://pschatzmann.ch/edgar/values?format=csv&col=&row=year¶meter=NetIncomeLoss&n=10'
total = pandas.read_csv(url,sep=";",index_col=0)
total.plot.bar(legend=False)
It looks strange that the current year is so small. So we look at the profits by month. Most filings are in December, so this is OK.
url = 'https://pschatzmann.ch/edgar/values?format=csv&col=&row=month¶meter=NetIncomeLoss&n=24'
total = pandas.read_csv(url,sep=";",index_col=0)
total.plot.bar(legend=False)
Problems¶
url = 'https://pschatzmann.ch/edgar/values?format=csv&col=&row=unitRef¶meter=NetIncomeLoss'
units = pandas.read_csv(url,sep=";",index_col=0)
units
As we can see, we were summarizing different units of mesures.
In my next blog we show how to correct this.
0 Comments