CITE THIS NOTEBOOK: Equity analytics in the Equities Data Store by Jonathan Kinlay. Wolfram Community 21 2022.
The first release of the equities entity store product will contain around 2,000-2,500 equities, including at least 1,000 active stocks listed on the NYSE and NASDAQ exchanges and a further 1,000-1,500 delisted securities. All of the information described below will be available for each equity and, in addition, the historical data will include quarterly fundamental data.
​
The other major component of the store will be analytics tools, including single-stock analytics functions such as those illustrated here. More important, however, is that the store will contain advanced analytics tools designed to assist the analyst in the construction of optimized equity portfolios and in the development and backtesting of long and long/short equity strategies.

Performance Metrics


Equities Entity Store

Equities Entity Store - A Brief Review

The Equities Entity Store applies the object-oriented concept of Entity Stores in the Wolfram Language to create a collection of equity objects, both stocks and stock indices, containing current and historical fundamental, technical and performance-related data. Also included in the release version of the product will be a collection of utility functions (a.k.a. “Methods”) that will facilitate equity analysis, the formation and evaluation of equity portfolios and the development and back-testing of equities strategies, including cross-sectional strategies.
​
In the pre-release version of the store there are just over 1,000 equities, but this will rise to over 2,000 in the first release as delisted securities are added to the store. This is important in order to eliminate survivor bias from the data set.
In[]:=
EntityList[EntityClass["Equities","Stock Indices"]]​​allStocks=EntityList[EntityClass["Equities","Stocks"]];​​Length@allStocks​​allStocks//Short
Out[]=

SP500

Out[]=
1003
Out[]//Short=

A
,
AA
,
AAL
,
AAP
,
AAPL
,
ABBV
,
ABC
,
ABMD
,
ABNB
,
ABT
,
ACGL
,
ACHC
,
ACI
,
ACM
,
ACN
,
ADBE
,
ADI
,
ADM
,
ADP
,
ADSK
,
ADT
,
AEE
,
AEP
,
AES
,
AFG
,
AFL
,
AFRM
,
AGCO
,
AGL
,
AGNC
,
AGO
,
AGR
,
AIG
,
AIRC
,
AIZ
,
AJG
,
AKAM
,
AL
,
ALB
,
ALGM
,
ALGN
,
ALK
,
ALL
,
ALLE
,
ALLY
,
ALNY
,
ALSN
,
AM
,
AMAT
,
AMBP
,
AMC
,
AMCR
,
AMD
,
AME
,
AMED
,
AMG
,
AMGN
,
AMH
,
AMP
,
AMT
,
AMZN
,
AN
,
ANET
,
ANSS
,
ANTM
,
AON
,
AOS
,
APA
,868,
VNT
,
VOYA
,
VRSK
,
VRSN
,
VRT
,
VRTX
,
VSAT
,
VSCO
,
VST
,
VTR
,
VTRS
,
VVV
,
VZ
,
W
,
WAB
,
WAL
,
WAT
,
WBA
,
WBD
,
WBS
,
WCC
,
WDAY
,
WDC
,
WE
,
WEC
,
WELL
,
WEN
,
WEX
,
WFC
,
WH
,
WHR
,
WIX
,
WLK
,
WM
,
WMB
,
WMS
,
WMT
,
WOLF
,
WOOF
,
WPC
,
WRB
,
WRK
,
WSC
,
WSM
,
WSO
,
WST
,
WTFC
,
WTM
,
WTRG
,
WTW
,
WU
,
WWD
,
WWE
,
WY
,
WYNN
,
X
,
XEL
,
XOM
,
XPO
,
XRAY
,
XYL
,
YETI
,
YUM
,
ZBH
,
ZBRA
,
ZION
,
ZTS


Equity Properties

In[]:=
ABT
EQUITIES
["Properties"]
Out[]=

Company Information
,
Fundamentals
,
Historical Data
,
Index Memberships
,
Performance
,
Price-Volume


Company Information

In[]:=
ABT
EQUITIES
["Company Information"]
Out[]=
SymbolNYSE:ABT,ExchangeNYSE,Start Date
Tue 2 Jan 1990 00:00:00GMT-5
,Company
Abbott Laboratories
,SectorMedicalDevices,SICCode3841

Fundamental Information

The release version of the Equities Store will contain a full set of fundamental data, both current and historical.
ABT
EQUITIES
["Fundamentals"]
Out[]=
MarketCap1.71742×
11
10
,PERatio20.3811,EarningsPerShare4.8118,EBITDA12424000000

Index Memberships

In[]:=
ABT
EQUITIES
["Index Memberships"]
Out[]=
DOW30False,SP500True,Russell 1000True

Price-Volume

In[]:=
ABT
EQUITIES
["Price-Volume"]
Out[]=
Volume4902826,AverageVolume3Month5.33126×
6
10
,AdjustedClose98.07,High52Week142.6,Low52Week93.25,Average200Day111.618,Average50Day101.297,FractionalChange200Day-12.1376,FractionalChange50Day-3.18568,Volatility250Day26.2141,Volatility50Day29.7507,Volatility20Day37.7968

Historical Data

Historical data includes daily and and monthly price and returns series, as well as historical performance information.
In[]:=
ABT
EQUITIES
["Historical Data"]
Out[]=
Daily PricesTimeSeries
Time: 02 Jan 1990 to 31 Oct 2022
Data points: 8273
Data not saved. Save now
,Daily ReturnsTimeSeries
Time: 03 Jan 1990 to 31 Oct 2022
Data points: 8272
,Monthly PricesTimeSeries
Time: 31 Jan 1990 to 31 Oct 2022
Data points: 394
,Monthly ReturnsTimeSeries
Time: 31 Jan 1990 to 31 Oct 2022
Data points: 394
,Monthly PerformanceTimeSeries
Time: 31 Jan 1995 to 31 Oct 2022
Data points: 334
Data not saved. Save now


Performance Data

The Performance property shows current performance information for the stock, over periods ranging from inception to 1 month. Performance metrics include alpha and beta, information ratio, relative price and autocorrelation, amongst others.
In[]:=
ABT
EQUITIES
["Performance"]//Dataset
Out[]=
Date
Period(months)
relPrice
SP500 Correlation
AutoCorrelation
Total Return(%)
CAGR(%)
Volatility(%)
IR
Alpha(%)
Inception
Wed 3 Jan 1990
393.9
9.22
0.52
0.256
9823.1
15.03
25.45
0.59
0.04
60-Months
Wed 1 Nov
2017
60
1.32
0.7
-0.089
98.01
14.65
26.63
0.55
0.03
12-Months
Mon 1 Nov
2021
12
0.93
0.7
-0.01
-21.96
-22.01
26.23
-0.84
-0.04
9-Months
Tue 1 Feb 2022
9
0.92
0.76
0.008
-21.36
-27.57
27.51
-1.0
-0.05
6-Months
Mon 2 May
2022
6
0.94
0.76
0.152
-12.04
-22.68
27.64
-0.82
-0.05
3-Months
Mon 1 Aug 2022
3
0.97
0.72
0.025
-8.68
-30.52
27.63
-1.1
-0.05
1-Month
Mon 3 Oct 2022
1
0.95
0.67
-0.038
2.72
41.92
38.47
1.09
-0.2
columns 1–10 of 14
A monthly series of performance tables is included in the Historical Data property, which can be used for cross - sectional portfolio construction and strategy development . For example, the performance data for ABT for the month of December 1995 was as follows:
In[]:=
ABT
EQUITIES
["Historical Data"]["Monthly Performance"][{1995,12,29}]//Dataset
Out[]=
Date
Period(months)
relPrice
SP500 Correlation
AutoCorrelation
Total Return(%)
CAGR(%)
Volatility(%)
IR
Alpha(%)
Inception
Wed 3 Jan 1990
71.84
1.89
0.5
0.253
223.3
21.65
26.9
0.81
0.05
60-Months
Wed 2 Jan 1991
60.0
1.27
0.46
—
137.21
18.9
27.2
0.7
0.02
12-Months
Tue 3 Jan 1995
12.0
1.0
0.29
-0.017
34.13
34.68
22.94
1.51
0.03
9-Months
Mon 3 Apr 1995
9.0
0.98
0.28
-0.008
20.79
29.18
23.87
1.22
0.02
6-Months
Mon 3 Jul 1995
6.0
0.93
0.12
0.087
5.3
11.14
22.95
0.49
0.02
3-Months
Mon 2 Oct 1995
3.0
0.94
0.16
0.142
-1.18
-4.81
26.15
-0.18
-0.05
1-Month
Fri 1 Dec 1995
1.0
1.01
0.08
-0.05
2.46
37.41
25.29
1.48
0.12
columns 1–10 of 14

Entity Store Methods - Performance Analytics

The PerformanceAnalytics function provides a detailed analysis of a returns time series, including metrics such as the compound annual return, semi-deviation, maximum drawdown, Sharpe and Calmar ratios. The function can be applied to time series of any frequency and provides a summary analysis in addition to a breakdown by year.
In[]:=
tsABT=
ABT
EQUITIES
["Historical Data"]["Daily Returns"]
Out[]=
TimeSeries
Time: 03 Jan 1990 to 31 Oct 2022
Data points: 8272


Summary Analytics

We can obtain summary analytics for the entire time series:
In[]:=
Dataset[First@PerformanceAnalytics[tsABT],DatasetTheme->{"AlternatingRowColumnBackgrounds",LightBlue,LightOrange},MaxItems->{26,1}]
Out[]=
Start Date
Wed 3 Jan 1990
End Date
Mon 31 Oct 2022
Period(Years)
32.82
Periods Per Year
252.01
Total Return(%)
9823.1
CAGR(%)
15.03
Total Gain(%)
5065.04
Total Loss(%)
-4392.23
Profit Factor
1.15
Average Gain(%)
1.23
Average Loss(%)
-1.13
Win-Loss Ratio
1.09
Win Rate(%)
50.18
Average Return(%)
0.0814
Median Return(%)
0.0186
5%-tile Return(%)
-2.37
95%-tile Return(%)
2.59
Skewness
-0.08
Kurtosis
8.9
Annual Volatility(%)
25.45
Downside Volatility(%)
17.39
Maximum Drawdown(%)
-44.85
Max Drawdown Date
Tue 23 Jul 2002
Sharpe Ratio
0.59
Sortino Ratio
0.86
Calmar Ratio
0.34

Analytics by Year

Alternatively, we can obtain a more detailed breakdown of performance by year: