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
98
Other Decks in Programming
See All in Programming
20250704_教育事業におけるアジャイルなデータ基盤構築
hanon52_
4
250
「Cursor/Devin全社導入の理想と現実」のその後
saitoryc
0
680
第9回 情シス転職ミートアップ 株式会社IVRy(アイブリー)の紹介
ivry_presentationmaterials
1
260
『自分のデータだけ見せたい!』を叶える──Laravel × Casbin で複雑権限をスッキリ解きほぐす 25 分
akitotsukahara
1
600
Team topologies and the microservice architecture: a synergistic relationship
cer
PRO
0
1.2k
RailsGirls IZUMO スポンサーLT
16bitidol
0
130
イベントストーミング図からコードへの変換手順 / Procedure for Converting Event Storming Diagrams to Code
nrslib
1
570
Cursor AI Agentと伴走する アプリケーションの高速リプレイス
daisuketakeda
1
130
Rubyでやりたい駆動開発 / Ruby driven development
chobishiba
1
530
来たるべき 8.0 に備えて React 19 新機能と React Router 固有機能の取捨選択とすり合わせを考える
oukayuka
2
880
なぜ適用するか、移行して理解するClean Architecture 〜構造を超えて設計を継承する〜 / Why Apply, Migrate and Understand Clean Architecture - Inherit Design Beyond Structure
seike460
PRO
1
720
Flutterで備える!Accessibility Nutrition Labels完全ガイド
yuukiw00w
0
140
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
234
140k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
181
53k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
130
19k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Code Reviewing Like a Champion
maltzj
524
40k
Speed Design
sergeychernyshev
32
1k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
940
How to Ace a Technical Interview
jacobian
277
23k
Music & Morning Musume
bryan
46
6.6k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
A Tale of Four Properties
chriscoyier
160
23k
RailsConf 2023
tenderlove
30
1.1k
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.