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
400
創業抬槓 20130831 分享 Pinkoi
toomore
0
260
Toomore 20130627 Taipei.py.pdf
toomore
0
110
MOPCON Lightning Talk 閃電秀 用照片說故事 - 影像紀錄區
toomore
0
330
KSDG Python and MongoDB for web
toomore
0
110
Other Decks in Programming
See All in Programming
EMこそClaude Codeでコード調査しよう
shibayu36
0
550
NIKKEI Tech Talk#38
cipepser
0
350
Software Architecture
hschwentner
6
2.4k
pnpm に provenance のダウングレード を検出する PR を出してみた
ryo_manba
1
170
CSC305 Lecture 12
javiergs
PRO
0
250
Towards Transactional Buffering of CDC Events @ Flink Forward 2025 Barcelona Spain
hpgrahsl
0
120
KoogではじめるAIエージェント開発
hiroaki404
1
260
SidekiqでAIに商品説明を生成させてみた
akinko_0915
0
110
CSC305 Lecture 11
javiergs
PRO
0
320
GC25 Recap: The Code You Reviewed is Not the Code You Built / #newt_gophercon_tour
mazrean
0
140
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
150
釣り地図SNSにおける有料機能の実装
nokonoko1203
0
200
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
46
7.7k
Music & Morning Musume
bryan
46
6.9k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Faster Mobile Websites
deanohume
310
31k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.5k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
Being A Developer After 40
akosma
91
590k
Side Projects
sachag
455
43k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
140
34k
Rails Girls Zürich Keynote
gr2m
95
14k
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.7k
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.