October 22, 2013

How to add stock charts to your website or blog

This is a tutorial on how you can add stock charts to your blog.

Method 1.
Visit Google Finance or Yahoo Finance, navigate to your favorite stock, press the print screen button, paste it in your preferred image editor, edit the image, and upload the image to your website. The main drawback with this method is that if you want an updated chart, you have to make another print screen and redo the entire process.

Method 2.
Embed a chart from Google Finance by using this code snippet:

<img src="https://www.google.com/finance/getchart?q=AMZN&p=20Y&i=86400" />

  • AMZN is the ticker symbol. Amazon in this case
  • 20Y is the time - as in 20 years. If the stock hasn't existed for 20 years, the chart will automatically begin on the first day of trading. You can change this to 20d for 20 days, and 20M for 20 months
  • i is currently unknown and I will update as soon as I find out

This is the result:

Method 3.
Visit wikinvest and use their Embed Stock Chart service. This is the result:

The drawback with this method is that you have to use flash, so the chart will not be shown on your iPad.

Method 4.
Embed a chart from YCharts. This is the result:

AMZN Chart
AMZN data by YCharts

This last method seems to be the best alternative. The chart will be displayed on your iPad and you can modify the chart in multiple ways when you create it.

Method 5.
If you need a chart that display the price of a commodity, such as sugar, you should embed a chart from Index Mundi.

Sugar - Monthly Price - Commodity Prices - Price Charts, Data, and News - IndexMundi
Method 6.
Embed a chart from Quandl, which is a site that have collected data from across the globe.

Graph of ICE Sugar No. 11 Futures, Continuous Contract #1 (SB1) (Front Month)


  1. So you say "i is currently unknown and I will update as soon as I find out" but it has been almost a year, did you find out yet?

    The i is for Interval and is calculated in seconds, for example: i=86400 will chart 1 Day intervals (86400 seconds)