初步学习python获取财务报表数据及分析

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sjpljr/article/details/80575924

tushare开源股票交易接口基于python实现技术  http://www.360doc.com/content/17/0512/00/3218170_653138595.shtml

浅谈利用Python分析财报找到值得投资的好公司的想法 - 简书  https://www.jianshu.com/p/66d5e0d51b8e

python分析财务报表 - CSDN博客  https://blog.csdn.net/qq_34739497/article/details/79688755

python图像处理:pytesseract和PIL - 小二放牛 - 博客园  http://www.cnblogs.com/yinzx/p/4741986.html

python - ImportError: No module named pytesseract - Stack Overflow  https://stackoverflow.com/questions/33401767/importerror-no-module-named-pytesseract

pytesseract · PyPI  https://pypi.org/project/pytesseract/

pytesseract——验证码的识别——PIL库的介绍 - 雨婷墨染 - 博客园  https://www.cnblogs.com/yutingmoran/p/5984213.html

利用jTessBoxEditor工具进行Tesseract3.02.02样本训练,提高验证码识别率 - 黯然销魂掌2015 - 博客园  https://www.cnblogs.com/zhongtang/p/5555950.html

JTessBoxEditor可用下载:http://www.softpedia.com/get/Multimedia/Graphic/Graphic-Others/jTessBoxEditor.shtml

jTessBoxEditor - Tesseract box editor & trainer 官网 http://vietocr.sourceforge.net/training.html

关于python中使用tushare中实现交易登录:

操作原理:

在python的第三方tushare库中,有trader、util、stock等子库文件,用于实现金融数据及相关操作。

应该是tushare应用python操作,实现网页登录经纪商的网站交易界面。交易界面有验证码的,需要应用pytesseract库、tesseract-ocr程序,实现图片化的验证码数据字符串提取,从而实现登录后,获取交易帐户信息。

tesseract-ocr 实现图片识别功能 - 项目源码科帮网-Java论坛、Java社区、JavaWeb毕业设计  http://www.52itstyle.com/thread-4803-1-1.html

环境安装:

0、aconda安装

1、pip install tushare

2、pip install pytesseract

3、tesseract-ocr安装

在windows 系统下,需要到下述网站下载.exe安装文件,安装。

Home · UB-Mannheim/tesseract Wiki · GitHub  https://github.com/UB-Mannheim/tesseract/wiki 

Home · tesseract-ocr/tesseract Wiki · GitHub  https://github.com/tesseract-ocr/tesseract/wiki

Tesseract is an open source text recognizer (OCR) Engine, available under the Apache 2.0 license. It can be used directly, or (for programmers) using an API to extract printed text from images. It supports a wide variety of languages.
Tesseract doesn't have a built-in GUI, but there are several available from the 3rdParty page.

我的想法:

应用eric6用于GUI界面实现,通过python脚本实现股票的价格提醒、指标的提醒(邮件?),或者自动止损、止盈操作,手动登录交易。

实现登录:

 Exception "unhandled pytesseract.pytesseract.TesseractNotFoundError"

tesseract is not installed or it's not in your path

解决办法:
方法一:打开文件 pytesseract.py,找到如下代码,将tesseract_cmd的值修改为全路径,在此使用就不会报错了。
# CHANGE THIS IF TESSERACT IS NOT IN YOUR PATH, OR IS NAMED DIFFERENTLY
#tesseract_cmd = 'tesseract'   #原语句
tesseract_cmd = 'D:/Program Files (x86)/Tesseract-OCR/tesseract.exe'  #修改后语句,具体tesseract-ocr安装目录。

方法二:或者,将tesseract的目录加入到电脑的系统环境变量paht中。

理论上应该可以了,但是,还是提示:tesseract is not installed or it's not in your path.

可能,有时需要最后一步:重启计算机,再次运行,居然故障消除。(必须要注意!!!!!)

Python3.6使用tesseract-ocr的正确姿势 - CSDN博客  https://blog.csdn.net/qq_14998713/article/details/78824859

[python]python验证码识别 | 独自等待-信息安全博客  https://www.waitalone.cn/python-php-ocr.html


重要:tesseract makebox生成空box文件的解决

1、有时执行tesseract langyp.fontyp.exp0.tif langyp.fontyp.exp0 -l eng -psm 7 batch.nochop makebox命令后,由于tesseract并不能识别图片,只是生成了一个空的box文件(可用notepad打开编辑,但扩展名为空,不要保存为txt格式,否则jTessBoxEditor不识别)。这时,在jTessBoxEditor软件——BoxEditor——Open中打开对应的已经merge多页的tif文件。由于对应的box文件没有内容,Box Cooridates区域是不可编辑的。如果点击‘insert’按钮,则会提示:please select the box to insert after.但是由于box是空的,根本无法选择。


2、这时可以直接编辑box文件:

如:用notepad打开langyp.fontyp.exp0.box(不是同名的.tif文件)这个文件,写入下图内容。其中每行首列为图片识别的第一个字符,第二列开始这坐标信息,依次为x,y,width,height,最后一列为第几个图片,序号从0依次排序,第n个为n-1。

如果图片较多,可以用notepad、excel结合编辑。


3、再次打开langyp.fontyp.exp0.tif这个多页的tif文件。







猜你喜欢

转载自blog.csdn.net/sjpljr/article/details/80575924