0

Yahoo Finanance API using Python

Hi all,

Had any body tried Yahoo Finanace API using Python or Pylons...!?
I tried using Java and C#.NET, but i dont know how to get it.

Will any body tell me the procedure....!tongue.gifsmile.giftongue.gifsmile.giftongue.gifsmile.gif

by
3 Replies
  • QUOTE (mopuru @ Mar 25 2010, 03:58 AM) <{POST_SNAPBACK}>
    Hi all,

    Had any body tried Yahoo Finanace API using Python or Pylons...!?
    I tried using Java and C#.NET, but i dont know how to get it.


    Hi mopuru,

    You could use the Yahoo! Finance YQL tables! For instance, you could query the Quotes YQL table using Python-YQL, that is a Python API to query YQL tables.

    Cheers,
    gc
    0
  • QUOTE (Guilherme Chapiewski @ Apr 19 2010, 01:01 PM) <{POST_SNAPBACK}>
    Hi mopuru,

    You could use the Yahoo! Finance YQL tables! For instance, you could query the Quotes YQL table using Python-YQL, that is a Python API to query YQL tables.

    Cheers,
    gc


    I have been playing around with Python-YQL, and found something odd; I am trying to query the financial data tables using the following command:

    CODE
    select * from yahoo.finance.options where symbol in ("F")


    I have entered this into the YQL console, and it works great. However, when I run the following code:

    CODE
    >>> import yql
    >>> y = yql.Public()
    >>> result = y.execute( 'select * from yahoo.finance.options where symbol in ("F")')


    I get the error:

    yql.YQLError: ({'status': '400', 'transfer-encoding': 'chunked', 'age': '0', 'vary': 'Accept-Encoding', 'server': 'YTS/1.17.21', 'connection': 'keep-alive', 'cache-control': 'private', 'date': 'Sun, 04 Jul 2010 20:46:17 GMT', 'p3p': 'policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV"', 'content-type': 'application/json;charset=utf-8', 'access-control-allow-origin': '*'}, '{"error":{"lang":"en-US","description":"No definition found for Table yahoo.finance.options"}}')


    Anyone know what would cause this?
    0
  • QUOTE (adam35413 @ Jul 4 2010, 12:51 PM) <{POST_SNAPBACK}>
    Anyone know what would cause this?


    It seems to me, that the yahoo.finance tables are not part of the current python-yql implementation. I had the same error with the following example:

    CODE
    >>> import yql
    >>> y = yql.Public()
    >>> result = y.execute("select * from yahoo.finance.quotes where symbol in ('YHOO','AAPL','GOOG','MSFT')")


    But you can refer to a YQL table description within yql. The following example worked for me:

    CODE
    >>> import yql
    >>> y = yql.Public()
    >>> result = y.execute('use "http://www.datatables.org/yahoo/finance/yahoo.finance.quotes.xml" as yahoo.finance.quotes; select * from yahoo.finance.quotes where symbol in ("YHOO")')


    You might want tot refer to http://www.datatables.org/yahoo/finance/ya...nce.options.xml in your example.
    0

Recent Posts

in Python