python: tushare尝试

知道tushare很长时间,但一直没有尝试。因为一直不想玩python,突然想试试看tushare是否如传说中好用。入坑吧。

一、装python

去官网:

https://www.python.org/

下载,我装的是3.64版。

(1) 安装时,一定要注意,强烈建议,选择个性化安装。带上pip,环境变量之类。

(2) 注意库管理工具pip已经内置了。不用另外去下载了,很方便。

二、装tushare

https://github.com/waditu/tushare

《python: tushare尝试》

tushare有很多依赖库,没关系,缺一个装一个。具体如下图:

《python: tushare尝试》

大约有lxml,pandas,bs4,requests,等包可能需要装。

《python: tushare尝试》

看到上面,就表示,tushare库安装成功了。

三、在atom中使用

真的很简单!良心之作。强烈推荐!

比如,查询股指期货日度和1分钟数据:

import tushare as ts
cons = ts.get_apis()
df_day =ts.bar("IF1801",conn=cons,asset='X',freq='D')
df_1min =ts.bar("IF1801",conn=cons,asset='X',freq='1min')
print(df2)

《python: tushare尝试》

四、关于tushare
建议详细的文档,请看官网:

http://tushare.org/

《python: tushare尝试》

    原文作者:songroom
    原文地址: https://blog.csdn.net/wowotuo/article/details/78857770
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞