1
$\begingroup$

After I get the data for the return, divident, and price of a stock with e.g.

FinancialData["BMY", "Return"] which gave -0.0153019
FinancialData["BMY", "Dividend"] which gave 0.41
FinancialData["BMY", "Close"] which gave 48.16

This stock lost $0.76.

What is the exact formula used by Mathematica that relates this daily return to the closing price, dividend, and loss/gain?

$\endgroup$

1 Answer 1

0
$\begingroup$

The formula Mathematica uses to calculate returns is

$$ Price_{t2}/Price_{t1}-1 $$

I am unable to replicate your return figure of -0.0153019 as of Today in v13.1. Though I note that you ran this calculation on Mar23, 2019 a Saturday. Sometimes data from the previous day can be messy and take time to update

From the documentation of FinancialData:

Note: FinancialData is intended for informational purposes only. Wolfram Research is not responsible for the accuracy or timeliness of any data.


I am not sure if dividends affected your initial calculation but regardless, the formula above still holds

First using Raw Prices For historical data, properties such as "RawHigh", "RawLow", "RawClose" do not include any retroactive adjustments; i.e. they return values as they were reported on the trading day in question

(*set data universe*)
stackExchangePostDate=DateObject["Mar 23, 2019"];
dataEnd=PreviousDate[stackExchangePostDate,"BusinessDay"];
dataStart=PreviousDate[dateEnd,"BusinessDay"];

(*get RAW data*)
{closeTS,returnTS}=FinancialData["BMY",{"RawClose","Return"},{dataStart,dataEnd}];

(*calculate return*)
close=QuantityMagnitude@Normal@Values@closeTS (* {48.91999816894531`,48.15999984741211`} *)
return=returnTS["Values"]//Normal (* {-0.015535534545781049`} *)
returnCalculatedManually=Ratios[close]-1  (* {-0.015535534545781049`} *)

(*check*)
return==returnCalculatedManually (* True *)

And using Adjusted Prices

For historical data, properties such as "AdjustedHigh", "AdjustedLow", "AdjustedClose" are adjusted for stock splits, spin-offs, share repurchases and other corporate actions, as well as ordinary dividends.

(*get ADJUSTED data*)
{closeTS,returnTS}=FinancialData["BMY",{"AdjustedClose","Return"},{dataStart,dataEnd}];

(*calculate return*)
close=QuantityMagnitude@Normal@Values@closeTS (* {44.195477831850305`,43.50887745922629`} *)
return=returnTS["Values"]//Normal (* {-0.015535534545781049`} *)
returnCalculatedManually=Ratios[close]-1  (* {-0.01553553454578116`} *)

(*check*)
return==returnCalculatedManually (* True *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.