Financial time series data

Virgil Stokes vs at it.uu.se
Thu Sep 2 19:56:47 EDT 2010


On 09/02/2010 08:15 PM, Hidura wrote:
> But what kind of data you want to download?, because the financial
> time it's basicly html code and you can work very well with a parser
>
> 2010/9/2, Virgil Stokes<vs at it.uu.se>:
>    
>>    Has anyone written code or worked with Python software for downloading
>> financial time series data (e.g. from Yahoo financial)? If yes,  would you
>> please contact me.
>>
>> --Thanks,
>> V. Stokes
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
>>      
>    
Here is a snippet of python code that I am trying to use for downloading 
financial data; but, I do not understand why it returns information from 
the second HTML page.

   import urllib2
   '''
    I am trying to read each row of the table at:
     http://finance.yahoo.com/q/cp?s=^GSPC
   '''
   ticker = []
   url = 
urllib2.urlopen("http://download.finance.yahoo.com/d/quotes.csv?s=@%5EGSPC&f=sl1d1t1c1ohgv&e=.csv&h=PAGE".replace('PAGE', 
str(0)))
   data = url.read()

Note, it does get all 50 rows of the first page; but, why does it also 
get the first row of the "next" HTML page?

--V






More information about the Python-list mailing list