文章会有【原创】或者【转载】标示,部分来自Google Baidu的学习结果 {Java/PHP/Python/Ruby/Go}

Python 获取股票数据  



到网站
http://www.goldb.org/ystockquote.html
拷贝代码


#!/usr/bin/env python
#
#  Copyright (c) 2007-2008, Corey Goldberg (corey@goldb.org)
#
#  license: GNU LGPL
#
#  This library is free software; you can redistribute it and/or
#  modify it under the terms of the GNU Lesser General Public
#  License as published by the Free Software Foundation; either
#  version 2.1 of the License, or (at your option) any later version.


import urllib


"""
This is the "ystockquote" module.
def get_stock_exchange(symbol):
    return __request(symbol, 'x')
   
   
def get_market_cap(symbol):
    return __request(symbol, 'j1')
   
   
def get_book_value(symbol):
    return __request(symbol, 'b4')

省略
新建获取的python代码
import ystockquote  
 
#print ystockquote.get_price('002250.sz')  
#print ystockquote.get_all('002250.sz')  
 
print ystockquote.get_historical_prices('002500.sz', "20110919","20110923")