STOCK ANALYSIS in Real-time

Honeywell Stock Market Price Comparison

In [3]:
from pandas_datareader import data, wb
import pandas as pd
import numpy as np
import datetime
%matplotlib inline
start = datetime.datetime(2000, 1, 1)
end = datetime.datetime(2020, 12, 31)
In [4]:
# Honeywell
HON = data.DataReader("HON", 'yahoo', start, end)
# Cisco
CSCO = data.DataReader("CSCO", 'yahoo', start, end)
# Thermo Fisher
TMO = data.DataReader("TMO", 'yahoo', start, end)
# Oracle
ORCL = data.DataReader("ORCL", 'yahoo', start, end)
# Netflix
NFLX = data.DataReader("NFLX", 'yahoo', start, end)
# Pfizer
PFE = data.DataReader("PFE", 'yahoo', start, end)
# Disney
DIS = data.DataReader("DIS", 'yahoo', start, end)
# Visa
V = data.DataReader("V", 'yahoo', start, end)
# Facebook
FB = data.DataReader("FB", 'yahoo', start, end)
# Adobe
ADBE = data.DataReader("ADBE", 'yahoo', start, end)
# Accenture
ACN = data.DataReader("ACN", 'yahoo', start, end)
# McDonald's
MCD = data.DataReader("MCD", 'yahoo', start, end)
# Intel
INTC = data.DataReader("INTC", 'yahoo', start, end)
In [5]:
df = data.DataReader(['HON', 'CSCO', 'TMO', 'ORCL', 'NFLX', 'PFE', 'DIS', 'V', 'FB', 'ADBE', 'ACN', 'MCD', 'INTC'],'yahoo', start, end)
tickers = ['HON', 'CSCO', 'TMO', 'ORCL', 'NFLX', 'PFE', 'DIS', 'V', 'FB', 'ADBE', 'ACN', 'MCD', 'INTC']
company_stocks = pd.concat([HON, CSCO, TMO, ORCL, NFLX, PFE, DIS, V, FB, ADBE, ACN, MCD, INTC],axis=1,keys=tickers)
company_stocks.columns.names = ['Company Name','Stock Info']
In [6]:
returns = pd.DataFrame()
for tick in tickers:
    returns[tick+' Return'] = company_stocks[tick]['Close'].pct_change()
In [7]:
logar = pd.DataFrame()
for tick in tickers:
    logar = np.log(1+company_stocks.pct_change())

Min. Price

In [8]:
company_stocks.xs(key='Close',axis=1,level='Stock Info').min()
Out[8]:
Company Name
HON     18.304695
CSCO     8.600000
TMO     14.250000
ORCL     7.320000
NFLX     0.372857
PFE     11.062618
DIS     13.584105
V       10.605000
FB      17.730000
ADBE     8.350000
ACN     11.850000
MCD     12.380000
INTC    12.080000
dtype: float64

Max. Price

In [9]:
company_stocks.xs(key='Close',axis=1,level='Stock Info').max()
Out[9]:
Company Name
HON     214.630005
CSCO     80.062500
TMO     527.659973
ORCL     65.300003
NFLX    556.549988
PFE      46.489563
DIS     181.179993
V       218.729996
FB      303.910004
ADBE    533.799988
ACN     266.250000
MCD     229.639999
INTC     74.875000
dtype: float64

Over 20 years (2000-2020)

In [10]:
returns.std()
Out[10]:
HON Return     0.019806
CSCO Return    0.024343
TMO Return     0.018370
ORCL Return    0.024440
NFLX Return    0.036153
PFE Return     0.015940
DIS Return     0.019445
V Return       0.019210
FB Return      0.023577
ADBE Return    0.027427
ACN Return     0.019195
MCD Return     0.015038
INTC Return    0.023766
dtype: float64

2019

In [11]:
returns['2019-01-01':'2019-12-31'].std()
Out[11]:
HON Return     0.010976
CSCO Return    0.015421
TMO Return     0.014219
ORCL Return    0.012479
NFLX Return    0.021809
PFE Return     0.011980
DIS Return     0.014229
V Return       0.011338
FB Return      0.017561
ADBE Return    0.015007
ACN Return     0.010629
MCD Return     0.009482
INTC Return    0.017041
dtype: float64

2020

In [12]:
returns['2020-01-01':'2020-12-31'].std()
Out[12]:
HON Return     0.028524
CSCO Return    0.026328
TMO Return     0.023408
ORCL Return    0.025542
NFLX Return    0.029107
PFE Return     0.022630
DIS Return     0.030875
V Return       0.026900
FB Return      0.028913
ADBE Return    0.030182
ACN Return     0.026297
MCD Return     0.025286
INTC Return    0.033617
dtype: float64

Stock Prices 2000-2020 (Compare data on hover)

In [21]:
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('whitegrid')
%matplotlib inline

import plotly
import cufflinks as cf
cf.go_offline()
In [14]:
company_stocks.xs(key='Close',axis=1,level='Stock Info').iplot()

Percentage Change in Stock Prices (Compare data on hover)

In [15]:
logar = pd.DataFrame()
for tick in tickers:
    logar = np.log(1+company_stocks.pct_change())
In [16]:
logar.xs(key='Close',axis=1,level='Stock Info').iplot()

Correlation

In [17]:
heatmap = company_stocks.xs(key='Close', axis=1, level='Stock Info').corr()
heatmap
Out[17]:
Company Name HON CSCO TMO ORCL NFLX PFE DIS V FB ADBE ACN MCD INTC
Company Name
HON 1.000000 0.613818 0.949037 0.914462 0.908928 0.462892 0.968793 0.960702 0.945681 0.895688 0.980570 0.959415 0.696405
CSCO 0.613818 1.000000 0.564531 0.693326 0.880571 0.577058 0.576447 0.921746 0.846763 0.603384 0.882213 0.534707 0.891881
TMO 0.949037 0.564531 1.000000 0.854996 0.964850 0.402906 0.903990 0.978279 0.934505 0.976336 0.978222 0.936418 0.668104
ORCL 0.914462 0.693326 0.854996 1.000000 0.827128 0.397785 0.922033 0.918202 0.920263 0.783954 0.941344 0.913454 0.734577
NFLX 0.908928 0.880571 0.964850 0.827128 1.000000 0.669194 0.835851 0.964412 0.930477 0.981985 0.947788 0.896491 0.909832
PFE 0.462892 0.577058 0.402906 0.397785 0.669194 1.000000 0.456256 0.852271 0.761552 0.430728 0.558558 0.285150 0.699424
DIS 0.968793 0.576447 0.903990 0.922033 0.835851 0.456256 1.000000 0.896585 0.855773 0.822558 0.946487 0.924066 0.663141
V 0.960702 0.921746 0.978279 0.918202 0.964412 0.852271 0.896585 1.000000 0.941927 0.967029 0.989119 0.970133 0.948595
FB 0.945681 0.846763 0.934505 0.920263 0.930477 0.761552 0.855773 0.941927 1.000000 0.927719 0.962745 0.921008 0.883426
ADBE 0.895688 0.603384 0.976336 0.783954 0.981985 0.430728 0.822558 0.967029 0.927719 1.000000 0.940441 0.881121 0.706554
ACN 0.980570 0.882213 0.978222 0.941344 0.947788 0.558558 0.946487 0.989119 0.962745 0.940441 1.000000 0.973759 0.887761
MCD 0.959415 0.534707 0.936418 0.913454 0.896491 0.285150 0.924066 0.970133 0.921008 0.881121 0.973759 1.000000 0.612517
INTC 0.696405 0.891881 0.668104 0.734577 0.909832 0.699424 0.663141 0.948595 0.883426 0.706554 0.887761 0.612517 1.000000

Since I started at HONEYWELL

In [18]:
HON['Close']['2020-06-01':'2020-12-31'].ta_plot(study='sma',periods=[14],title='Simple Moving Averages',color='red')
In [19]:
HON['Close']['2020-06-01':'2020-12-31'].ta_plot(study='boll',color='red')

After promotion to IT Specialist at HONEYWELL

In [20]:
HON[['Open', 'High', 'Low', 'Close']]['2020-09-01':'2020-12-31'].iplot(kind='candle')