Skip to content

Instantly share code, notes, and snippets.

@sguzman
Created April 25, 2020 19:35
Show Gist options
  • Save sguzman/8b9e38dab96b6bac2bfb5a3c1e663574 to your computer and use it in GitHub Desktop.
Save sguzman/8b9e38dab96b6bac2bfb5a3c1e663574 to your computer and use it in GitHub Desktop.
Mathematica expression that converts nominal pricing for some time series (I use stock price) to today's dollars
With[{data = Out[9]},
Map[
With[{modate = DateValue[First@#, {"Year", "Month", "Day"}]},
{First@#,
Quantity[
QuantityMagnitude@
InflationAdjust[
Quantity[QuantityMagnitude@Last@#,
DatedUnit["USDollars", modate]]
, Today], "USDollars"]
}] &, data]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment