Andrew Channels Dexter Pinion

Wherein I write some stuff that you may like to read. Or not, its up to you really.

July 19, 2004

Acquiring Stock Prices and Exchange Rates

Via a convoluted series of links I came across Ruby/Finance, an in progress port of Perl's Finance::Quote module. My immediate reaction was that this is a module which could usefully be ported to Python. I even entertained the thought of doing it myself, it would be an interesting exercise to learn a bit more about Perl and Ruby. But given my (lack of) progress on the other items on my to-do list it would never get done.

It wouldn't scratch my itch in the short term, either, as I already have perfectly serviceable Python functions to do these things for me. Unlike the Perl and Python code they don't go directly to Yahoo! Finance (the currency converter actually parses the HTML - yeuch) but rely on a SOAP service published by the nice people at www.xmethods.net (who do the scraping for us).

To get an exchange rate between currencies give this one a whirl;

def getFXRate(currencyFrom, currencyTo):
    "Get conversion rate between <currencyFrom> and <currencyTo>"
    rate = -1
    try:
        server = SOAP.SOAPProxy('http://services.xmethods.net/soap', \
                         namespace='urn:xmethods-CurrencyExchange')
        rate = server.getRate(currencyFrom, currencyTo)
    except:
        print "Exception getting rate between %s and %s" % ( currencyFrom, currencyTo )
    return rate

To get the latest price of a stock, try this function;

def getQuote(symbol):
    "Get latest price for <symbol>"
    price = -1
    try:
        server = SOAP.SOAPProxy('http://services.xmethods.net/soap', \
                        namespace='urn:xmethods-delayed-quotes')
        price = server.getQuote(symbol)
    except:
        print "Exception getting price for %s" % symbol
    return price

For the functions to work you will need the SOAP.py module from the Python Web Services project.

Posted by Andy Todd at 09:48 PM | Comments (6)

July 07, 2004

The Year of the Bookmark Service

Is this the year of the bookmark service? I'm currently spoilt for choice when I want to record a URL for later use. I've got the bookmarks feature of each of the browsers I use, spread across two machines. Then there are the web services which seems to be the appearing by the month.

I've currently got accounts with del.icio.us, Furl and unalog. They are all similar, but have different spins on the collection of links.

del.icio.us allows you to categorise posts with keywords and see who else has recorded that link. Furl is stronger in the "social software" space, they recommend links based on what you have recorded, and show you people with similar interests. Unalog is like a collective link blog with shared categories. Of course, with my technical biases I should really be concentrating on Unalog, as it's written in Quixote, which has just released version 1.0 by the way. But usage is king, and I seem to have a lot more links in del.icio.us than anywhere else. I also like the RSS support and API, which enable anyone to get to their data using languages like Python and PHP.

In the interests of fairness I should point out that Furl offers RSS feeds as well.

Now, to celebrate their first birthday the nice people at Bloglines have introduced another, similar service. Although they have combined the collection of links with blogging and are calling it the clip blog. Here is mine. Just don't look at it in Safari as the layout is currently broken, probably due to a CSS quirk.

Which is best? I'm undecided, so I'll probably carry on using them all.

Posted by Andy Todd at 11:40 AM | Comments (1)

July 06, 2004

Bad Web Site of the Day

It's been a while since my last mention of this topic but today I would like to name and shame Lowepro UK. They make great camera bags but a lousy web site.

Not least of their crimes is the title on the page (do I need to know or care who "DayMen International Ltd." are?). But I can't go past the hideous javascript menu in the middle of the page. This doesn't work in any of the browsers I use, so I presume it works fine in Internet Explorer. Shame on you Lowepro.

Posted by Andy Todd at 08:52 AM | Comments (0)