Configuring the Python environment to use tushare stock data

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.