Musings

A random collection

Archive for August 2011

TECH: Get a real-time quote from Yahoo Finance

require 'open-uri'
require 'nokogiri'

def getQuote(symbol)
  q = ""
  doc = Nokogiri::HTML(open("http://finance.yahoo.com/q?s=#{symbol}&ql=1"))
  doc.xpath('//*[@class="real_time"]').each do |node|
    y = node.xpath("span").first
    node.xpath("span").each { |x| q += x.text }
  end
  return q
end

ARGV.each { |s| print "#{s} = #{getQuote(s)}\n"; }

Another place to get real-time quote: http://batstrading.com/json/bzx/book/WFC

Written by curious

August 31, 2011 at 8:13 am

Posted in quant-finance

INDIA: Agra Trip

leave a comment »

Day 1:

  1. Shatabdi Express from New Delhi Station to Agra Cantt. Good train, takes 2 hours and since starts from New Delhi, higher probability of leaving on time. Reached Agra at around 8:00 AM
  2. Pre-paid Taxi for the day: Rs 950 for 8 hours
  3. Taj Mahal: Taxi driver (Gulab works for one contractor Akbar) tries to coerce into taking a (manual) rickshaw from car parking to Taj gate. Declined. Guides try to coerce you into hiring them. Flatly declined.
  4. Handicraft farce: Taxi driver argues and desperately wants to show you “mini taj” at handicrafts showroom (on Fatehabad Road). The showroom claims to be a government run shop selling handicraft stuff made of marble, bamboo cloth etc. Got tricked into buying a Taj made of marble. Later realized it was all a sham to fleece innocent tourists. If you want to really get a handicraft piece, should go to Gokulpura near Raja ki Mandi. But that place is too dirty for upper class gentry or foreigners.
  5. Idamut-ud Daulah Tomb:
  6. Agra Fort:
  7. Hotel Crystal Inn (Fatehabad Road, Behind TDI Mall 562-4053400): Rs 2100

Day 2

  1. Fatehpur Sikri: awesome place, away from hustle bustle of Agra city. But again got tricked by the Taxi driver in to hiring a guide (Kalimuddin Master), which is like an underground world operating to fool the tourists. The guide skipped portions of the Sikri fort, wouldn’t have known if hadn’t decided to go back on my own after the guide was done. Discovered the guide doesn’t tell you much more than what is already written on the signs in the fort.
  2. Shatabdi Express back from Agra Cantt. to New Delhi. Not a good idea at all. Train was late by over 1 hour. Stuck waiting at the station.

Written by curious

August 24, 2011 at 10:27 am

Posted in india