13/01-2005: Yahoo stock to RSS converter
Inspired by Xanadb' RSS Stock Ticker (which in turn was inspired by the now defunct Yahoo Finance RSS), I decided to try to make my own. I wanted to add a few things, mainly the ability to calculate loss/win for each stock and a total loss/win for all stocks.
The data for the feed is gotten from finance.yahoo.com
and you need the stock symbols that they use to build up a URL string that you can feed to your RSS program. But here's an example:
http://tc.dk/stock.php?symbols=msft:100:20+csco:200:20.9
This will give you two rss items with the current stock price of Microsoft (msft) and Cisco (csco). The total value of a 100 Microsoft stocks is calculated and the win/loss if you paid 20us$ for them is calculated. The same is done for 200 Cisco stocks brought at 20.90us$.
Here's an example of how Thunderbird will show the data:

The parameters:
An example of usage:
http://tc.dk/stock.php?symbols=msft:100:20&
title=My%20Stocks&totalonly=yes
(should be on one line, with no spaces)
Will display only a total item, with Microsoft information. The title of the RSS feed will be "My Stock".
Another example showing a current day grap and a 3 month graph for Cisco and Microsoft:
http://tc.dk/stock.php?symbols=msft+csco&total=yes&
title=My%20Stock&graph=1ds,3m
(should be on one line, with no spaces)
For more information, take a look at the comment in the source code zip (which is released under a Creative Commons License).
But really you don't have to...
Feel free to run the code from your own server - in fact, please do so, instead of using my server. Please add a comment and link to your server. If you make any changes to the code, please let me know and I'll add the changes to the script here. Look in the code for known problems and a to-do list.
There's a lot of different RSS readers out there...
People hosting this script:
People who've helped to make it better:
The data for the feed is gotten from finance.yahoo.com
and you need the stock symbols that they use to build up a URL string that you can feed to your RSS program. But here's an example:
http://tc.dk/stock.php?symbols=msft:100:20+csco:200:20.9
This will give you two rss items with the current stock price of Microsoft (msft) and Cisco (csco). The total value of a 100 Microsoft stocks is calculated and the win/loss if you paid 20us$ for them is calculated. The same is done for 200 Cisco stocks brought at 20.90us$.
Here's an example of how Thunderbird will show the data:

The parameters:
- The symbols parameter is for listing.. stock symbols, separated by + signs. The stock count and acquisition price is optional (but you can't add the acquisition price with out the count, as it's the order that decided what's what). Tips: If your stock isn't on an american stock excange, post fix it with the city of the exhange you want to use. Copenhagen is co. So, my Danske Bank stocks are danske.co. Search on Yahoo to find the correct ending.
- The total=[yes|no] parameter means that a total item will be added, showing total loss/win for all the stocks. Default is no.
- The title=[text] parameter will be added to the rss feed title. Use this for portfolio names. Change spaces to %20.
- The timedif=[integer number] is used to correct the trading time (6 is Central European Time). Default is 0 (zero), and the base whatever yahoo decided (I think it's US eastern time).
- The link=[yes|no]
can be used to remove the link from each item. Mostly used to work
around an error, where the rss reader ignores GUID data, when there's a
link (thunderbird 1.0 does this). Default is yes - The randomlink=[yes|no]
is used to add a randompart to the link in each item, thrus fooling rss
readers to think it's a new story each time. Default is no. (added in 0.0.3) - The totalonly=[yes|no] parameter is used if you only want one item returned with all the totals. Default is no. (added in 0.0.3)
- The graph=[yes,1ds,1d,5d,3m,6m,1y,2y,5y,my|no] adds one or more image links to graphs displaying [1 day small, 1 day, 5 days, 3 months, 6 months, 1 year, 2 years, 5 years or max years]. It's possible to specify more that one graph by seperating them with comma or +: graph=1d+1y for the 1 day and 1 year graphs. The old option "yes" will display the 1ds (1 Day Small) graph. Please note that your RSS viewer need to be online to see these image (added in 0.0.4, big/multi-graph added in 0.0.8)
- The fulltitle=[yes|no]
parameter is used if you want the full title of the symbol displayed in the title of each item (e.i. "Microsoft" for msft). (added in 0.0.4)
- The titlenoshort=[yes|no]
forces fulltitle=yes and only uses the fulltitle on the headlines (makes them a bit shorter) (added in 0.0.7)
- The titlenochange=[yes|no]
removed the day change value from the title (makes them a bit shorter) (added in 0.0.7)
An example of usage:
http://tc.dk/stock.php?symbols=msft:100:20&
title=My%20Stocks&totalonly=yes
(should be on one line, with no spaces)
Will display only a total item, with Microsoft information. The title of the RSS feed will be "My Stock".
Another example showing a current day grap and a 3 month graph for Cisco and Microsoft:
http://tc.dk/stock.php?symbols=msft+csco&total=yes&
title=My%20Stock&graph=1ds,3m
(should be on one line, with no spaces)
For more information, take a look at the comment in the source code zip (which is released under a Creative Commons License).
But really you don't have to...
Feel free to run the code from your own server - in fact, please do so, instead of using my server. Please add a comment and link to your server. If you make any changes to the code, please let me know and I'll add the changes to the script here. Look in the code for known problems and a to-do list.
There's a lot of different RSS readers out there...
People hosting this script:
People who've helped to make it better:
- ttys0: Suggested the multi/big graph functionality and supplied the needed urls.
KP wrote: