Forum

1 year finance.yaho...
 
Notifications
Clear all

1 year finance.yahoo.com stock history

4 Posts
3 Users
0 Reactions
126 Views
(@tedfcga-com)
Posts: 2
New Member
Topic starter
 

The following source query returns the last 100 days.  How can it be modified to return the last year?

= Web.Page(Web.Contents("https://finance.yahoo.com/quote/BMO.TO/history"))

 
Posted : 28/07/2021 11:14 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi Ted,

Use this URL

https://finance.yahoo.com/quote/BMO.TO/history? period1=1595894400&period2=1627430400&interval=1d&filter=history&frequency=1d&includeAdjustedClose=true

The periods are specified by Unix Timestamps.  1595894400 equates to 28 Jul 2020.  You'll need to work out the timestamps to use based on the dates you want to retrieve Unix Timestamp - Epoch Converter - TimeStamp Converter

Regards

Phil

 
Posted : 28/07/2021 7:11 pm
(@tedfcga-com)
Posts: 2
New Member
Topic starter
 

Thanks for the reply Phil ,

Being very new to Power Query, I'll have to play with this a bit.

Is this "?period1=1595894400&period2=1627430400&interval=1d&filter=history&frequency=1d&includeAdjustedClose=true" just a part of the query line? 

And, is it possible to frame a query that will always give me the last year without having to modify the query each time to specify the period start and end?  This is part of an Excel workbook that I refresh frequently and with the number of stocks I want to track it would be cumbersome to have to modify the query each time.

Thanks again for taking the time to reply.

Ted

 
Posted : 30/07/2021 12:57 pm
Alan Sidman
(@alansidman)
Posts: 221
Member Moderator
 

You could build a parameter query where you input the Date (Using the Unix Date/Time value) each time you wish to run the report in PQ.  Here is a link on how to build a parameter query.

https://www.youtube.com/watch?v=gK2yBpiITvI

 
Posted : 30/07/2021 6:31 pm
Share: