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
?
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}}]
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):
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
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP