stock.py
retrieve (almost) realtime stock quotes
This is a quick and dirty script that retrieves stock quotes from finance.yahoo.com. The quotes are delayed by about 15 minutes by Yahoo. The script displays the change from the previous close, the previous close, the opening price, the days low and high, the price/earnings ratio, and the days volume. Display is colour-coded: green for gains, red for losses. It also has a 'ticker' ('-t') switch to monitor the price. By default it updates every minute, but you can change this by passing the number of seconds via the '-i' or '--interval' option..
Here is sample usage and output:
[you@yours]$ stock.py -q rhat goog amd novl msft aapl Symbol Last Change % PrevC Open DayLo DayHi P/E Volume Time AAPL 62.72 -0.03 -0.05% 62.75 63.24 62.24 63.61 33.85 29144886 4:00pm AMD 33.16 -0.43 -1.28% 33.59 33.60 32.95 33.95 85.04 13503200 4:01pm GOOG 390.00 +1.56 +0.40% 388.44 388.75 384.03 391.87 77.36 36524584 4:00pm MSFT 27.21 -0.02 -0.07% 27.23 27.34 27.21 27.541 22.50 62367592 4:00pm NOVL 7.68 -0.02 -0.26% 7.70 7.80 7.61 7.81 N/A 9004034 4:00pm RHAT 27.98 +0.22 +0.79% 27.76 27.70 27.55 28.10 83.11 2740207 4:00pm
The script can also do currency conversions, again using info from Yahoo Finance. I am not sure if these currency symbols are international standards or specific to yahoo but you can see them all at the finance.yahoo.com website. Here is an example of usage:
[you@yours]$ stock.py -c 100 CAD USD 100.00 CAD at 0.908600 is 90.86 USD as of 1:19pm 5/10/2006 [you@yours]$ stock.py -c 100 cad eur 100.00 CAD at 0.710200 is 71.02 EUR as of 1:20pm 5/10/2006
View the online stock.py source code.
Download the compressed source.
stats
It is
Sunday May 18, 2008 1:49 am
This page served 1080 times
This page last modified: April 14, 2008 11:28 am
Your IP address is: 38.103.63.17
You are browsing using: CCBot/1.0 (+http://www.commoncrawl.org/bot.html)
You are browsing from: United States.
badcomputer.org's uptime: 01:49:26 up 24 days, 02:31, 0 users, load average: 0.00, 0.00, 0.00
local
home | unix stuff | dir2ogg | sneetchalizer | wmainfo | q&d guide to permissions | q&d guide to tar and gzip | code | MS rant | browser shootout | linux & iAudio X5 | photos | music | programming poetry | sieve of Eratosthenes | plea | rain | suffer | archive | about | recipes | compaqr3000 | sitemap
search
credits
This page, and all pages on this site were created and are maintained by Darren Kirby using valid XHTML 1.0 and CSS, and are ©copyright 2002 - 2008. The Penguin image was created by Tukka, and is used by permission. Inspiration for the look of this site was provided by Eric A. Meyer's CSS gallery. This website runs on Gentoo Linux. It is served by Apache. PHP and MySQL hold together the backend.