How to Load Historical Stock Prices from MSN Money to CSV
Updated: August 28, 2019
Contents
- Historical Prices at MSN Money
- Undocumented URLs to Download Historical Prices from MSN Money
- Loading Historical Prices from MSN Money with Batch Files
- Downloading Historical Prices from MSN Money using MARKET.CSV
Historical Prices at MSN Money
MSN Money provides data from a lot of exchanges.
You can open https://www.msn.com/en-us/money, search a ticker like MSFT, and click the 'History' tab.
You can use URLs like https://www.msn.com/en-us/money/stockdetails/history/fi-126.1.MSFT.NAS
or https://www.msn.com/en-us/money/stockdetails/history/fi-MSFT (for US tickers)
to open pages with historical prices directly.
MSN Money has no public links to download historical prices to CSV.
Undocumented URLs to Download Historical Prices from MSN Money
MSN Money uses an internal web service to load historical stock and currency prices in the JSON format into its web pages.
You can use any tool like CURL to download data.
Also, you can use a specialized tool, gsqlcmd, to download and convert JSON data to CSV.
For example, to get daily historical prices, use the command:
gsqlcmd convert ^ "http://finance-services.msn.com/Market.svc/ChartAndQuotes?symbols=MSFT&chartType=1y&isEOD=True&isCS=true&isVol=true" msft.csv ^ /rootPath=Chart.Series /skippedNodes=IsStitched ^ /referer=https://www.msn.com/en-us/money/
To get weekly historical prices:
gsqlcmd convert ^ "http://finance-services.msn.com/Market.svc/ChartAndQuotes?symbols=MSFT&chartType=5y&isEOD=False&isCS=true&isVol=true" msft-weekly.csv ^ /rootPath=Chart.Series /skippedNodes=IsStitched ^ /referer=https://www.msn.com/en-us/money/
To get monthly historical prices:
gsqlcmd convert ^ "http://finance-services.msn.com/Market.svc/ChartAndQuotes?symbols=MSFT&chartType=max&isEOD=False&isCS=true&isVol=true" msft-monthly.csv ^ /rootPath=Chart.Series /skippedNodes=IsStitched ^ /referer=https://www.msn.com/en-us/money/
To get 15-minute historical prices:
gsqlcmd convert ^ "http://finance-services.msn.com/Market.svc/ChartAndQuotes?symbols=MSFT&chartType=5d&isEOD=False&isCS=true&isVol=true" msft-15.csv ^ /rootPath=Chart.Series /skippedNodes=IsStitched ^ /referer=https://www.msn.com/en-us/money/
To get 5-minute historical prices:
gsqlcmd convert ^ "http://finance-services.msn.com/Market.svc/ChartAndQuotes?symbols=MSFT&chartType=1D_5M&isEOD=False&isCS=true&isVol=true" msft-5.csv ^ /rootPath=Chart.Series /skippedNodes=IsStitched ^ /referer=https://www.msn.com/en-us/money/
Use the convert mode to download and convert JSON to CSV.
Use the /rootPath=Chart.Series option to point to the JSON root of historical prices.
Use the /referer option to specify the referrer required for MSN web services.
You can download historical prices for currencies also. Just use tickers like 245.20.GBPUSDLITE.
Loading Historical Prices from MSN Money with Batch Files
gsqlcmd allows automating downloads using batch files.
Create a text file like 'task.txt' and place tickers one by line like:
TICKERS.TXT
AAPL FB GOOGL
Create a batch file like 'load.cmd' with the following commands:
LOAD.CMD
@echo off @for /F %%i in (tickers.txt) do ( gsqlcmd convert ^ "http://finance-services.msn.com/Market.svc/ChartAndQuotes?symbols=%%i&chartType=1y&isEOD=True&isCS=true&isVol=true" %%i.CSV ^ /rootPath=Chart.Series /skippedNodes=IsStitched ^ /referer=https://www.msn.com/en-us/money/ ^ /delay=200 /echoOutputFileName )
Run it. You will see the result:
C:>load.cmd
AAPL.CSV - 253 rows FB.CSV - 253 rows GOOGL.CSV - 253 rows
Pay attention to the /delay parameter. Use the delay to avoid banning your IP due to frequent multiple automatic requests.
Downloading Historical Prices from MSN Money using MARKET.CSV
MARKET.CSV is a specialized tool for loading data from Yahoo Finance and MSN Money.
For example, you can place the required tickers to a file like tickers.txt.
TICKERS.TXT
^VIX SPY 126.1.AAPL.NAS NYSE:BRK.B RIO.L GBPUSD
Then, you can execute the following commands to download data using the required data providers:
C:\MarketData
market.csv.exe download MsnMoneyHistoricalPricesDaily market.csv.exe download MsnMoneyHistoricalPricesWeekly market.csv.exe download MsnMoneyHistoricalPricesMonthly market.csv.exe download MsnMoneyIntradayPrices1m market.csv.exe download MsnMoneyIntradayPrices5m market.csv.exe download MsnMoneyIntradayPrices15m
The tool downloads data, archives the data to zip files, and converts the data to CSV.
You can get results in the output files like MsnMoneyHistoricalPricesDaily.csv, MsnMoneyHistoricalPricesWeekly.csv, etc.
Moreover, MARKET.CSV includes ready-to-use SQL codes and format files to import CSV data into a Microsoft SQL Server database.
Downloads
Products for Traders and Investors | |
---|---|
MARKET.CSV
The app loads data from Yahoo Finance and MSN Money to CSV and SQL Server Version: 2.25 | 04/29/2024 | 1.5MB | Getting Started | What's New | Edition Comparison |
Download |
gsqlcmd
This tool downloads, converts, and imports data from Yahoo Finance and MSN Money Version: 6.12 | 04/30/2024 | 14.6MB | www.savetodb.com |
Download |
Disclaimer
MSN is a logo and registered trademark of Microsoft Corporation.