Are Accounts Receivables Correlated With Revenue?

Import the Calcbench Client

In [2]:
import calcbench as cb #https://github.com/calcbench/python_api_client
%pylab inline
Populating the interactive namespace from numpy and matplotlib

Get tickers in the S&P 500

In [3]:
tickers = cb.tickers(index="SP500")

Get quarterly data from Calcbench and compute the correlation between accounts receivable and revenue.

In [1]:
standardized_metrics = ['revenue', 'accountsreceivable'] # Full list of metrics @ https://www.calcbench.com/home/standardizedmetrics
quarterly_data = cb.standardized_data(tickers, standardized_metrics, 2008, 1, 2014, 3)
quarter_corr = quarterly_data['accountsreceivable'].corrwith(quarterly_data['revenue'])
quarter_corr.hist(bins=50, figsize=(15, 10))
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-1-d07c21178491> in <module>
      1 standardized_metrics = ['revenue', 'accountsreceivable'] # Full list of metrics @ https://www.calcbench.com/home/standardizedmetrics
----> 2 quarterly_data = cb.standardized_data(tickers, standardized_metrics, 2008, 1, 2014, 3)
      3 quarter_corr = quarterly_data['accountsreceivable'].corrwith(quarterly_data['revenue'])
      4 quarter_corr.hist(bins=50, figsize=(15, 10))

NameError: name 'cb' is not defined

Do the same for annual data.

In [24]:
annual_data = cb.normalized_data(tickers, ['revenue', 'accountsreceivable'], 2008, 0, 2014, 0)
annual_corr = annual_data['accountsreceivable'].corrwith(annual_data['revenue'])
annual_corr.hist(bins=50, figsize=(15, 10))
Out[24]:
<matplotlib.axes.AxesSubplot at 0x90a0170>

YUM is an example of a company with negative quarterly correlation.

In [28]:
quarterly_data['revenue']['YUM'].plot(figsize=(10, 6))
quarterly_data['accountsreceivable']['YUM'].plot(secondary_y=True)
Out[28]:
<matplotlib.axes.AxesSubplot at 0x8dd27d0>

But YUM's correlation is positive on an annual basis.

In [19]:
annual_data['revenue']['YUM'].plot(figsize=(10, 6))
annual_data['accountsreceivable']['YUM'].plot(secondary_y=True)
Out[19]:
<matplotlib.axes.AxesSubplot at 0x90a61f0>