Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
如何用 grs 擷取台灣上市股票股價資訊 PyCon APAC 2014
Search
Toomore Chiang
May 18, 2014
Programming
6
600
如何用 grs 擷取台灣上市股票股價資訊 PyCon APAC 2014
如何用 grs 擷取台灣上市股票股價資訊 PyCon APAC 2014
https://pypi.python.org/pypi/grs
Toomore Chiang
May 18, 2014
Tweet
Share
More Decks by Toomore Chiang
See All by Toomore Chiang
如何用 Twilio 發送 COSCUP 活動簡訊
toomore
0
390
創業抬槓 20130831 分享 Pinkoi
toomore
0
240
Toomore 20130627 Taipei.py.pdf
toomore
0
110
MOPCON Lightning Talk 閃電秀 用照片說故事 - 影像紀錄區
toomore
0
310
KSDG Python and MongoDB for web
toomore
0
99
Other Decks in Programming
See All in Programming
Google Agent Development Kit でLINE Botを作ってみた
ymd65536
2
240
XP, Testing and ninja testing
m_seki
3
240
PipeCDのプラグイン化で目指すところ
warashi
1
270
システム成長を止めない!本番無停止テーブル移行の全貌
sakawe_ee
1
160
iOS 26にアップデートすると実機でのHot Reloadができない?
umigishiaoi
0
130
GitHub Copilot and GitHub Codespaces Hands-on
ymd65536
2
150
おやつのお供はお決まりですか?@WWDC25 Recap -Japan-\(region).swift
shingangan
0
120
5つのアンチパターンから学ぶLT設計
narihara
1
160
Hypervel - A Coroutine Framework for Laravel Artisans
albertcht
1
110
LT 2025-06-30: プロダクトエンジニアの役割
yamamotok
0
730
地方に住むエンジニアの残酷な現実とキャリア論
ichimichi
5
1.5k
生成AI時代のコンポーネントライブラリの作り方
touyou
1
170
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
72
4.9k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
950
Making Projects Easy
brettharned
116
6.3k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.7k
Site-Speed That Sticks
csswizardry
10
680
How GitHub (no longer) Works
holman
314
140k
Embracing the Ebb and Flow
colly
86
4.7k
Thoughts on Productivity
jonyablonski
69
4.7k
What's in a price? How to price your products and services
michaelherold
246
12k
Six Lessons from altMBA
skipperchong
28
3.9k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.4k
Transcript
如何用 grs 擷取台灣 上市股票股價資訊 Toomore / PyCon APAC 2014 2014/5/18
1
Toomore Chiang Pinkoi Python Parselmouth COSCUP2012、2013 PyConTW 2013 2
3
在念研究所的時候,研究與 股價相關的議題,教授說要 計算所有股票的股價資訊。 4
所有 ... (all ...) 5
然後那個年代(2010)的 Excel ⽐比較不爭氣,每個 sheet 有 65,536 列限制。 其實也不能怪 Excel,學⽣生窮窮的,只能勉強⽤用 Office
2003 6
所有資料 (⺠民國82年1⽉月4⽇日起開始提供) 65536 / 800 = 81 天 20 年的資料
... 7
那時候在學 Python 所以就使⽤用 Python 來抓取股價 8
後來研究所的事情就先放⼀一 旁,發現擷取⼯工具再加⼀一點 簡單分析,就可以像⺫⽬目前坊間 股票建議網站⼀一樣。 其實應該是:就可以像坊間報名牌的⽼老師⼀一樣 ... XD 9
坊間的股票建議歸為兩⼤大類 •消息類 •技術類 10
消息類 • 新聞或是重⼤大訊息發布,利⽤用⾵風吹草動 來決定決策⽅方向 11
技術類 • 看股票的價和量 ★ 可以是每⽇日收盤的價、量 ★ 或是盤中即時盤的價、量 12
總之 13
grs 是以技術分析類 為主的⼯工具 14
Install 15 • pip install grs • python • >>>
from grs import Stock • >>> Stock(‘2618’).info
grs-doc • http://grs-docs.toomore.net/ • ./latest/index.html • v0.5.4 ./0.5.4/index.html 16
grs 簡單分析⼯工具 17
grs 簡單分析⼯工具 • 移動平均數值(Stock.MA、Stock.MAV) • 計算均價乖離(Stock.MAO) • 判斷乖離轉折點( SimpleAnalytics.CKMAO) •
四⼤大買賣點判斷(BestFourPoint) 18
grs 簡單分析⼯工具 • 移動平均數值(Stock.MA、Stock.MAV) • 5⽇日均價 Stock(‘2618’).MA(5) • 5⽇日均量 Stock(‘2618’).MAV(5)
19 Docs: http://grs-docs.toomore.net/latest/fetch_data.html
grs 簡單分析⼯工具 • 計算均價乖離( Stock.MAO) • 3-6乖離:Stock(‘2618’).MAO(3, 6) • 判斷乖離轉折點(Stock.CKMAO)
20
grs 簡單分析⼯工具 • 判斷乖離轉折點( SimpleAnalytics.CKMAO) • data = Stock('2618').MAO(3, 6)[0]
• SimpleAnalytics.CKMAO(data) 21
grs 簡單分析⼯工具 • 四⼤大買賣點判斷(BestFourPoint) 22 當然也有⼀一勞永逸的作法,四⼤大買賣點分析
grs 簡單分析⼯工具 • 買(賣)點: • 負(正)乖離扣⾄至最⼤大,量⼤大收紅(⿊黑) • 負(正)乖離扣⾄至最⼤大,量縮價不跌(跌) • 負(正)乖離扣⾄至最⼤大,短期⽇日均價由下(上)往上(下)
• 負(正)乖離扣⾄至最⼤大,短期⽇日均價⼤大(⼩小)於中期⽇日均價 23
grs 簡單分析⼯工具 from grs import BestFourPoint from grs import Stock
stock = Stock('2618') result = BestFourPoint(stock) result.best_four_point_to_buy() # 判斷是否為四⼤大買點 result.best_four_point_to_sell() # 判斷是否為四⼤大賣點 result.best_four_point() # 綜合判斷 24
grs 簡單的分析⼯工具 移動平均數值(Stock.MA、Stock.MAV) 計算均價乖離(Stock.MAO) 判斷乖離轉折點( SimpleAnalytics.CKMAO) 四⼤大買賣點判斷(BestFourPoint) 25
其他常⽤用的⼯工具 快速簡介 26
其他常⽤用的⼯工具 27 • 顯⽰示台灣時間:TWTime • 時區切換 • 判斷台灣股市是否開市:TWSEOpen • 跑每⽇日報表(沒開市、補開市)
• 各股即時盤資訊:RealtimeStock • 直接擷取盤中個股資訊
其他常⽤用的⼯工具 • ⼤大盤即時盤資訊:RealtimeWeight • 直接擷取盤中⼤大盤資訊 • 上市、上櫃股票代碼列表: TWSENo、OTCNo • 也包含權證(只要在證交所查得到)
• 單⽇日倒數時間:Countdown • 可以⽤用在盤後 cache 的 TTL 28
grs-doc •Quick Start • http://grs-docs.toomore.net/latest/quick- start.html 29
其他應⽤用 30
其他應⽤用 • GAE XMPP robot. http://grsgae.appspot.com/ • “help” for How
to. • Daily report mail. • Web demo. http://grs.toomore.net/ 31
最後 ... 32
以上投資⼯工具不保證收益 使⽤用前請詳閱 grs ⽂文件 33 使⽤用宣告
34 Thanks.