TransWikia.com

FinancialData property value at a given date

Mathematica Asked on April 26, 2021

I was trying to get the volatility value of a specific equity on a given day.

Based on the Mathematica Help, the syntax is

FinancialData["name","prop",{start,end,...}] gives a list of dates and values of a property for a sequence of dates or periods.

So I tried this with the specific request.

FinancialData["SPY", "Volatility20Day", {{2012, 10, 11}, {2012, 10, 11}}]

which generates a long error message that starts with DatePlus::date: Argument {{2012,10,11},{2012,10,11}} cannot be interpreted as a date. >>

By the way, the syntax does work with other properties such as close, open, return, etc.

Is there any specific syntax that is different for Volatility20Day?

One Answer

Ran into this 2012 question and thought it deserves some closure. The issue is resolved at least in the current

In[]:= $Version
Out[]= 12.1.1 for Mac OS X x86 (64-bit) (June 9, 2020)

This code will return a single element TimeSeries:

data=FinancialData["SPY","Volatility20Day",{{2012,10,11},{2012,10,11}}]

enter image description here

with value

In[]:= Values[data]
Out[]= {8.29364%}

Note, now you can also go another way around it:

In[]:= SemanticInterpretation["SPY Volatility 20 Day on OCT 11 2012"]
Out[]= 8.29364%

This uses Wolfram|Alpha Entity framework. You can get code it used via free-from input interface (press = at the beginning of the cell or CTRL+= anywhere in-code):

enter image description here

with InputForm (CMD+Shift+I) code of that yellow boxes being

In[]:= Entity["Financial", "NYSE:SPY"][EntityProperty["Financial",
 "Volatility20Day", {"Date" -> DateObject[{2012, 10, 11}]}]]
Out[]= 8.29364%

Answered by Vitaliy Kaurov on April 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP