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
590
如何用 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
370
創業抬槓 20130831 分享 Pinkoi
toomore
0
230
Toomore 20130627 Taipei.py.pdf
toomore
0
99
MOPCON Lightning Talk 閃電秀 用照片說故事 - 影像紀錄區
toomore
0
300
KSDG Python and MongoDB for web
toomore
0
84
Other Decks in Programming
See All in Programming
苦しいTiDBへの移行を乗り越えて快適な運用を目指す
leveragestech
0
1.2k
仕様変更に耐えるための"今の"DRY原則を考える
mkmk884
9
3.3k
AIレビュー導入によるCIツールとの共存と最適化
kamo26sima
1
660
メンテが命: PHPフレームワークのコンテナ化とアップグレード戦略
shunta27
0
320
変化の激しい時代における、こだわりのないエンジニアの強さ
satoshi256kbyte
0
110
Boos Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
630
読まないコードリーディング術
hisaju
0
120
Better Code Design in PHP
afilina
0
180
iOSでQRコード生成奮闘記
ktcryomm
2
130
PHPカンファレンス名古屋2025 タスク分解の試行錯誤〜レビュー負荷を下げるために〜
soichi
1
750
dbt Pythonモデルで実現するSnowflake活用術
trsnium
0
270
PRレビューのお供にDanger
stoticdev
1
240
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
298
20k
RailsConf 2023
tenderlove
29
1k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
1.1k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.3k
KATA
mclloyd
29
14k
Speed Design
sergeychernyshev
28
820
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
4
440
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Music & Morning Musume
bryan
46
6.4k
Gamification - CAS2011
davidbonilla
80
5.2k
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.