Python + 股票: 个股资讯表 - Jacky Liu's Blog

Python + 股票: 个股资讯表

Jacky Liu posted @ 2011年10月03日 03:36 in Python with tags mysql python 股票 个股资讯 , 5520 阅读

 

---- 以上是 Vim 在全屏模式下的截图。全屏模式下 Vim 没有了程序标签栏,并且覆盖了 OS 的系统任务栏。用来切换全屏模式的按键定义:

    nnoremap <S-F10> :silent !wmctrl -r :ACTIVE: -b toggle,fullscreen<CR>

需要外部命令 wmctrl 可用。感谢 闲耘,是从他的 vimrc 里抄来的。

 

---- 基本搞定了个股资讯表。内容包括新闻动态、重大事项、公司公告。

 

---- 表的结构:<代码> <日期> <时间> <类型> <来源> <序号> <内容> <属性>。下面一条查询语句:

SELECT t1.代码, t1.日期, t1.时间, t1.类型, t1.来源, t1.序号, t1.内容, t1.属性 FROM 个股资讯 AS t1
JOIN (
	SELECT 代码, 类型, MAX(日期) AS 最大日期 FROM 个股资讯 GROUP BY 类型, 代码
) AS t2
ON t1.代码=t2.代码 AND t1.类型=t2.类型 AND t1.日期=t2.最大日期;

耗时 20 多秒,读出 12000 多条记录。不知道是否设计有问题,怎么会这么慢。眼下没时间深究,先这样吧。

 

---- Plotting 模块改用多进程也基本搞定,结果比预想的还要好。我的电脑是双核的,所以在主进程之外又建立两个工作进程来执行绘图任务。粗略统计,与单进程相比的速度提升在 120% ~ 130% 之间,现在绘制一幅图形大概只需要 3 到 4 秒。

 

---- 但是遇到一个神秘 bug,好久才搞定。好像必须给进程对象的建立留有足够的时间,否则进程跑起来会出问题。目前在程序里加了一个延时语句 sleep(0.3),看上去是好了。因为程序结构比较复杂,没心思去重现它了,能用就行,也先这样吧。

 

---- 接下来要把图形再优化一下,新的内容加进去。差不多了以后开始建日线统计表。

 

Avatar_small
ywchen2000 说:
2011年11月07日 13:55

这个好东西能分享么??

Avatar_small
Jacky Liu 说:
2011年12月10日 00:41

@ywchen2000: 这个跟绘图脚本不一样,绘图脚本本来就是独立的,而这个是整个系统的一部分,单拿出来没法用。

Avatar_small
Emma 说:
2023年1月25日 19:26

This Python + Stocks Individual Stock Information Sheet is a great tool for those looking to better understand the stock market. With comprehensive information texas real estate Georgetown on individual stocks and their performance, investors can make informed decisions and track the progress of their investments. The data provided includes financials, performance metrics and historical charts. This resource makes it easy to stay up to date on the latest market trends and make informed decisions.

Avatar_small
tgpost.in 说:
2023年5月18日 11:59

Tgpost is an initiative of professional writers who have joined forces to provide specialised news coverage of recent happenings in India. Our team consists of professional writers and citizen journalists from tgpost.in who have diverse journalism interests and are dedicated to providing education tgpost.in updates in the public interest while remaining transparent. Our reporting team intends to provide the Education & Recruitment Update for all age groups and provide inside coverage to present a complete picture of current events. Our mission is to address the requirements of people of all ages by providing news separated into General, Political, Crime, Sports, Entertainment, Education, and World News.

Avatar_small
anonymous 说:
2023年8月06日 15:05

The best article I came across a number of years, write something about it on this page.  Kissimmee Termite Treatment

Avatar_small
anonymous 说:
2023年8月12日 15:08

Acknowledges for paper such a beneficial composition, I stumbled beside your blog besides decipher a limited announce. I want your technique of inscription... Bed Bug Treatment Orlando

Avatar_small
anonymous 说:
2023年8月12日 15:10

For this web site, you will see our account, remember to go through this info. Bed Bug Treatment Oviedo

Avatar_small
boardmodelpaper.com 说:
2024年1月20日 14:59

The Board model paper" typically refers to a sample or model question paper that is designed by educational boards or institutions for various exams. These papers serve as practice material for students preparing for exams, providing them with an idea of the question format, difficulty level, and the type of content that may be covered in the actual examination. boardmodelpaper.com Model papers are usually created for specific subjects or courses. They cover a range of topics and chapters that students are expected to have studied during the academic term. Students often use these educational board model papers as an integral part of their exam preparation strategy, helping them familiarize themselves with the exam pattern and refine their understanding of the subject matter.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter
Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee