Forum

Macro to import his...
 
Notifications
Clear all

Macro to import historical data using web query

2 Posts
2 Users
0 Reactions
106 Views
(@dome92)
Posts: 1
New Member
Topic starter
 

Hi all, I'm trying to create a macro that imports historical data from Yahoo finance automating the use of the web query.

My inputs are 1) the ticker, 2) start date, 3) end date, 4) data frequency (daily, weekly, monthly).

I'm now stuck with this error: "Unable to fetch data from yahoo finance", but I'm not sure what I'm doing wrong now.

 
Posted : 27/07/2023 5:31 am
Alan Sidman
(@alansidman)
Posts: 223
Member Moderator
 

I used Power Query to get the data for Altria from Yahoo Finance.  Here is the Mcode for that import.

Loaded one year's daily values very quickly.  

let
Source = Web.Page(Web.Contents("https://finance.yahoo.com/quote/MO/history?p=MO")),
Data0 = Source{0}[Data]
in
Data0

 

 
Posted : 27/07/2023 4:53 pm
Share: