Obviously this is a rookie question, I'm simply looking to plot the S&P PE ratio moving averages over different periods of time and plot them vs the DOW. Ideally I would love like something that is fed by data and automatically updated, and can be done online rather than a proprietary piece of software. can anyone recommend a tool for helping me do this? I've already made a spread sheet based on historical s&p data, but again I would like to automate this somehow.
1 Answer
I have automated downloading of various price data with simple C# console applications that I write with Visual Studio Express (which is free). You are looking for a very specialized task, so I don't think you can get away from programming. I recommend Microsoft .Net for programming. Just create a new console application and use .Net's WebRequest and WebResponse classes to read data from other websites with very few lines of code. Then you can do string manipulations and create price text files (with the System.IO class) that you can use with any charting program (I recommend Ninjatrader, which is free). If you don't have a charting program, just create csv price files and charts in Excel. Furthermore, just add the console applications to windows tasks so you can have them run automatically at a specific time every day.
I get Historical PE ratio data from http://www.multpl.com/table and I get historical Dow Prices from Stooq: http://stooq.com/q/d/l/?s=^dji&i=d
Here is a piece of code to download data from a website:
using System;
using System.IO;
using System.Net;
using System.Text;
namespace Examples.System.Net
{
public class WebRequestGetExample
{
public static void Main ()
{
// Create a request for the URL.
WebRequest request = WebRequest.Create (
"http://WEBSITEHERE/PAGEWITHPRICEDATAHERE");
// Get the response.
WebResponse response = request.GetResponse ();
// Display the status.
Console.WriteLine (((HttpWebResponse)response).StatusDescription);
// Get the stream containing content returned by the server.
Stream dataStream = response.GetResponseStream ();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader (dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd ();
// Display the content.
Console.WriteLine (responseFromServer);
// Clean up the streams and the response.
reader.Close ();
response.Close ();
}
}
}
-
$\begingroup$ Thanks for the code! I am certainly not opposed to custom coding something as I am a programmer my self, although .net is not really my forte, perhaps I will try to whip something up using node .... I'm just a little surprised given all the cloud platforms / data sources / mashups out there, that there is no web framework to do this .... seems like there is one for every other dat mashup ... $\endgroup$ Commented Mar 8, 2016 at 15:01
-
$\begingroup$ You are welcome. The code is just a basic example to read data from any website. Each website will require different data formatting, especially for the date fields, which most charting programs like as yyyymmdd. Most price data from websites will come as mm/dd/yyyy or yyyy-mm-dd. Also, you will need to do some regular expression and string manipulation work to isolate data from content from sites like the one that has the PE Ratios. I program in many languages, but I think you can accomplish the most with the least amount of code with .Net. $\endgroup$– ValtinhoCommented Mar 8, 2016 at 15:15