Recently doing a project, mainly based on the stock market to verify some model, see if you can do quantitative trading. So how do we get the data? Because customers do not want to spend money to buy data, can only find their own way, from Sina and Yahoo financial channel climbed to some data, but some data is difficult to find, see the above a post, so try.
- Tushare's introduction.
- Install anaconda using the prerequisites.
- How do you develop it after you've done it? What kind of IDE do you choose? How to build an IDE environment based on Anaconda.
- Under Install Tushare:windows open Cmd.exe,os x under Terminal,pip install Tushare.
- There was a problem using the MySQL driver:importerror:no module named ' MySQLdb '
- Find out all the drivers for MySQL: http://docs.sqlalchemy.org/en/latest/dialects/mysql.html#module-sqlalchemy.dialects.mysql.pymysql
- Find the right one for use, Pymysql:pip install Pymysql
ImportTushare as TS#import pandas as PD#import NumPy as NP#import Matplotlib.pyplot as Plt fromSQLAlchemyImportCreate_engineengine= Create_engine ('Mysql+pymysql://loginuser:[email Protected]/nevmiss?charset=utf8') DF=ts.get_area_classified () df.to_sql ('area_data_py', engine,if_exists='Append') DF=ts.get_industry_classified () df.to_sql ('industry_data_py', engine,if_exists='Append')
Well, it's easy to use the Tushare data source.
Configuring the Python environment to use tushare stock data