gnewsense-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gNewSense-users] Gold Price Tracker?


From: Matthew Flaschen
Subject: Re: [gNewSense-users] Gold Price Tracker?
Date: Mon, 20 Oct 2008 05:35:38 -0400
User-agent: Thunderbird 2.0.0.17 (X11/20080925)

Koh Choon Lin wrote:
>>> Do you know of any 'free as in speech' widget or application to track
>>> the price of gold/ounce real time in gNS? It can be GUI or CLI.
>> Getting a real-time data feed is the hard part.  The software should be
>> fairly trivial.
> 
> Well, I found one live feed at:
> 
> https://online.kitco.com/scripts/cgi-bin/texten.pl
> 
> Anyone idea on a script to pull data off this site?

Sure.  A basic script is below.  It gives the NY spot prices from
that page.

There are various ways it could be tweaked depending what you're looking
for.

Matt Flaschen


----------------------------------------------------------------------------------
#!/bin/sh

get_prices()
{
    rm ~/.gold/cur_prices.html
    wget --quiet https://online.kitco.com/scripts/cgi-bin/texten.pl -O
~/.gold/cur_prices.html
}
get_bid()
{
    grep "   Gold" ~/.gold/cur_prices.html | head -c 22 | tail -c 7 |
sed "s/^ *//"
}
get_ask()
{
    grep "   Gold" ~/.gold/cur_prices.html | head -c 33 | tail -c 7 |
sed "s/^ *//"
}

clear
mkdir -p ~/.gold

while true
do
    get_prices
    bid=$(get_bid)
    ask=$(get_ask)
    clear
    echo "Bid: $bid; Ask: $ask";
    sleep 60
done





reply via email to

[Prev in Thread] Current Thread [Next in Thread]