Get the "Applied Data Science Edge"!

The ViralML School

Fundamental Market Analysis with Python - Find Your Own Answers On What Is Going on in the Financial Markets

Web Work

Python Web Work - Prototyping Guide for Maker

Use HTML5 Templates, Serve Dynamic Content, Build Machine Learning Web Apps, Grow Audiences & Conquer the World!

Hot off the Press!

The Little Book of Fundamental Market Indicators

My New Book: "The Little Book of Fundamental Analysis: Hands-On Market Analysis with Python" is Out!

Let's Explore the Business Confidence Index (BCI) Together - Work-Progress with Python

Introduction

Lets Explore the Business Confidence Index Together (BCI). This is a powerful leading indicator. Im starting from scratch so you can follow along. MORE: Blog or code: http://www.viralml.com/video-content.html?fm=yt&v=tyhHK8qXtRk Signup for my newsletter and more: http://www.viralml.com Connect on Twitter: https://twitter.com/amunategui My books on Amazon: The Little Book of Fundamental Indicators: Hands-On Market Analysis with Python: Find Your Market Bearings with Python, Jupyter Notebooks, and Freely Available Data: https://amzn.to/2DERG3d Monetizing Machine Learning: Quickly Turn Python ML Ideas into Web Applications on the Serverless Cloud: https://amzn.to/2PV3GCV Grow Your Web Brand, Visibility & Traffic Organically: 5 Years of amunategui.github.Io and the Lessons I Learned from Growing My Online Community from the Ground Up: https://amzn.to/2JDEU91 Fringe Tactics - Finding Motivation in Unusual Places: Alternative Ways of Coaxing Motivation Using Raw Inspiration, Fear, and In-Your-Face Logic https://amzn.to/2DYWQas Create Income Streams with Online Classes: Design Classes That Generate Long-Term Revenue: https://amzn.to/2VToEHK Defense Against The Dark Digital Attacks: How to Protect Your Identity and Workflow in 2019: https://amzn.to/2Jw1AYS Transcript Business Confidence Index (BCI) https://data.oecd.org/leadind/business-confidence-index-bci.htm This business confidence indicator provides information on future developments, based upon opinion surveys on developments in production, orders, and stocks of finished goods in the industry sector. It can be used to monitor output growth and to anticipate turning points in economic activity. Numbers above 100 suggest increased confidence in near future business performance, and numbers below 100 indicate pessimism towards future performance. CATEGORY:Finance HASCODE:ViralML-Hands-On-Business-Confidence-Index-BCI.html



If you liked it, please share it:

Code

ViralML-Hands-On-Business-Confidence-Index-BCI.html
In [22]:
from IPython.display import Image
Image(filename='viralml-book.png')
Out[22]:

Fundamental and Technical Indicators - Hands-On Market Analysis

Get the book: https://amzn.to/2DERG3d

More on: https://www.viralml.com/

Business Confidence Index (BCI)

https://data.oecd.org/leadind/business-confidence-index-bci.htm

This business confidence indicator provides information on future developments, based upon opinion surveys on developments in production, orders and stocks of finished goods in the industry sector. It can be used to monitor output growth and to anticipate turning points in economic activity. Numbers above 100 suggest an increased confidence in near future business performance, and numbers below 100 indicate pessimism towards future performance.

In [23]:
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
import io, base64, os, json, re 
import pandas as pd
import numpy as np
import datetime
import warnings
warnings.filterwarnings('ignore')
In [24]:
path_to_market_data = '/Users/manuel/Documents/financial-research/market-report/2019-07-02/'

Load Historical Data

In [25]:
bci_df = pd.read_csv(path_to_market_data + 'DP_LIVE_02072019085313431.csv')
bci_df = bci_df[bci_df['LOCATION'] == 'USA']
bci_df['Date'] = bci_df['TIME'] + '-01'
bci_df['Date'] = pd.to_datetime(bci_df['Date'])
bci_df = bci_df.sort_values('Date', ascending=True) # sort in ascending date order
bci_df = bci_df[['Date','Value']]
bci_df.columns = ['Date', 'BCI']
print(np.min(bci_df['Date'] ),np.max(bci_df['Date'] ))
bci_df.head()
1950-01-01 00:00:00 2019-05-01 00:00:00
Out[25]:
Date BCI
7673 1950-01-01 101.0515
7674 1950-02-01 101.5680
7675 1950-03-01 102.2565
7676 1950-04-01 103.2375
7677 1950-05-01 104.2263
In [14]:
sp500_df = pd.read_csv(path_to_market_data + '^GSPC.csv')
sp500_df['Date'] = pd.to_datetime(sp500_df['Date'])
sp500_df = sp500_df[['Date','Adj Close']]
sp500_df.columns = ['Date', 'SP500_Close']
print(np.min(sp500_df['Date'] ),np.max(sp500_df['Date'] ))
sp500_df = sp500_df.sort_values('Date', ascending=True) # sort in ascending date order
sp500_df.head()
1950-01-03 00:00:00 2019-07-01 00:00:00
Out[14]:
Date SP500_Close
0 1950-01-03 16.66
1 1950-01-04 16.85
2 1950-01-05 16.93
3 1950-01-06 16.98
4 1950-01-09 17.08

Plot

In [18]:
fig, ax = plt.subplots(figsize=(16, 8))
 
plt.plot(bci_df['Date'], bci_df['BCI'], label='BCI', color='blue')
plt.legend(loc='upper right')
plt.grid()
 

# Get second axis
ax2 = ax.twinx()
 
plt.plot(sp500_df['Date'],  sp500_df['SP500_Close'], label='SP500_Close',color='black')
plt.legend(loc='upper left')
plt.show()

Let's zoom in

In [26]:
bci_df_tmp = bci_df.copy()
sp500_df_tmp = sp500_df.copy()

cut_off_date = '2007-01-01'
bci_df_tmp = bci_df_tmp[bci_df_tmp['Date'] >= cut_off_date]
sp500_df_tmp = sp500_df_tmp[sp500_df_tmp['Date'] >= cut_off_date]


fig, ax = plt.subplots(figsize=(16, 8))
plt.plot(bci_df_tmp['Date'], bci_df_tmp['BCI'], label='BCI', color='blue')
plt.legend(loc='upper right')
plt.grid()
 

# Get second axis
ax2 = ax.twinx()
 
plt.plot(sp500_df_tmp['Date'],  sp500_df_tmp['SP500_Close'], label='SP500_Close',color='black')
plt.legend(loc='upper left')
plt.show()

Let's Compare Different Countries

In [27]:
bci_df = pd.read_csv(path_to_market_data + 'DP_LIVE_02072019085313431.csv')
set(bci_df['LOCATION'])
Out[27]:
{'AUS',
 'AUT',
 'BEL',
 'BRA',
 'CAN',
 'CHE',
 'CHL',
 'CHN',
 'CZE',
 'DEU',
 'DNK',
 'EA19',
 'ESP',
 'EST',
 'FIN',
 'FRA',
 'G-7',
 'GBR',
 'GRC',
 'HUN',
 'IDN',
 'IND',
 'IRL',
 'ISR',
 'ITA',
 'JPN',
 'KOR',
 'LTU',
 'LUX',
 'LVA',
 'MEX',
 'NLD',
 'NOR',
 'NZL',
 'OECD',
 'OECDE',
 'POL',
 'PRT',
 'RUS',
 'SVK',
 'SVN',
 'SWE',
 'TUR',
 'USA',
 'ZAF'}
In [28]:
bci_df = bci_df[bci_df['LOCATION'].isin(['USA','DEU'])]
bci_df['Date'] = bci_df['TIME'] + '-01'
bci_df['Date'] = pd.to_datetime(bci_df['Date'])
bci_df = bci_df.sort_values('Date', ascending=True)
bci_df = bci_df[['Date', 'Value','LOCATION']]
In [29]:
fig, ax = plt.subplots(figsize=(16, 8))

bci_df[bci_df['LOCATION']=='USA']['Date']


plt.plot(bci_df[bci_df['LOCATION']=='USA']['Date'], 
         bci_df[bci_df['LOCATION']=='USA']['Value'], label='USA', color='blue')
plt.plot(bci_df[bci_df['LOCATION']=='DEU']['Date'], 
         bci_df[bci_df['LOCATION']=='DEU']['Value'], label='DEU', color='green')
plt.grid()
plt.legend(loc='upper right')
Out[29]:
<matplotlib.legend.Legend at 0x11dc69ef0>

Show Notes

(pardon typos and formatting -
these are the notes I use to make the videos)

Lets Explore the Business Confidence Index Together (BCI). This is a powerful leading indicator. Im starting from scratch so you can follow along. MORE: Blog or code: http://www.viralml.com/video-content.html?fm=yt&v=tyhHK8qXtRk Signup for my newsletter and more: http://www.viralml.com Connect on Twitter: https://twitter.com/amunategui My books on Amazon: The Little Book of Fundamental Indicators: Hands-On Market Analysis with Python: Find Your Market Bearings with Python, Jupyter Notebooks, and Freely Available Data: https://amzn.to/2DERG3d Monetizing Machine Learning: Quickly Turn Python ML Ideas into Web Applications on the Serverless Cloud: https://amzn.to/2PV3GCV Grow Your Web Brand, Visibility & Traffic Organically: 5 Years of amunategui.github.Io and the Lessons I Learned from Growing My Online Community from the Ground Up: https://amzn.to/2JDEU91 Fringe Tactics - Finding Motivation in Unusual Places: Alternative Ways of Coaxing Motivation Using Raw Inspiration, Fear, and In-Your-Face Logic https://amzn.to/2DYWQas Create Income Streams with Online Classes: Design Classes That Generate Long-Term Revenue: https://amzn.to/2VToEHK Defense Against The Dark Digital Attacks: How to Protect Your Identity and Workflow in 2019: https://amzn.to/2Jw1AYS Transcript Business Confidence Index (BCI) https://data.oecd.org/leadind/business-confidence-index-bci.htm This business confidence indicator provides information on future developments, based upon opinion surveys on developments in production, orders, and stocks of finished goods in the industry sector. It can be used to monitor output growth and to anticipate turning points in economic activity. Numbers above 100 suggest increased confidence in near future business performance, and numbers below 100 indicate pessimism towards future performance. CATEGORY:Finance HASCODE:ViralML-Hands-On-Business-Confidence-Index-BCI.html