0
$\begingroup$

Using Mathematica 11 on Windows 10 Pro.

When using the FinancialData function and acquiring data by the "week" the price data is correct for each entire week; however, the volume only shows the volume for the first day of the week and should show the cumulative volume for the week. Am I doing something wrong?

The function:

FinancialData["AMZN", "OHLCV",
   {DatePlus[Quantity[-3, "Weeks"]], DatePlus[0], "Week"}]

Returns:

{{{2016, 8, 17}, {764.41, 765.22, 756.89, 757.31, 1891100}}, {{2016, 8, 22}, {757.5, 770., 752.1, 769., 1861500}}, {{2016, 8, 29}, {768.72, 776., 764., 772.44, 1887400}}, {{2016, 9, 6}, {774.04, 789.48, 770.22, 788.87, 3711700}}}

$\endgroup$
1
$\begingroup$

You are not acquiring the data for a week, but instead for a day in weekly time steps.

"OHLCV" - list of open, high, low, close, and volume for the day

You could, for instance, get daily data and sum it up or average it as you need it.

FinancialData["AMZN", "OHLCV", {DatePlus[Quantity[-3, "Weeks"]], DatePlus[0], "Day"}]

If you'd replace "week" with "day", however, since you're going back for exactly three weeks, you'd not necessarily end up on a Monday, therefore making things a bit more complicated.

One could use "DayName" to check for Mondays, yet there's still the issue of occasional holidays.

I'm sure there are more convenient ways, but should your problem only consist of those three weeks, i recommend you simply sum up the daily volumes.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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