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
250
Toomore 20130627 Taipei.py.pdf
toomore
0
110
MOPCON Lightning Talk 閃電秀 用照片說故事 - 影像紀錄區
toomore
0
320
KSDG Python and MongoDB for web
toomore
0
110
Other Decks in Programming
See All in Programming
Amazon RDS 向けに提供されている MCP Server と仕組みを調べてみた/jawsug-okayama-2025-aurora-mcp
takahashiikki
1
120
Deep Dive into Kotlin Flow
jmatsu
1
370
時間軸から考えるTerraformを使う理由と留意点
fufuhu
16
4.8k
HTMLの品質ってなんだっけ? “HTMLクライテリア”の設計と実践
unachang113
4
2.9k
基礎から学ぶ大画面対応(Learning Large-Screen Support from the Ground Up)
tomoya0x00
0
4.3k
プロパティベーステストによるUIテスト: LLMによるプロパティ定義生成でエッジケースを捉える
tetta_pdnt
0
4.3k
🔨 小さなビルドシステムを作る
momeemt
4
690
AIでLINEスタンプを作ってみた
eycjur
1
230
Reading Rails 1.0 Source Code
okuramasafumi
0
250
AI時代のUIはどこへ行く?
yusukebe
18
9.1k
RDoc meets YARD
okuramasafumi
4
170
Tool Catalog Agent for Bedrock AgentCore Gateway
licux
7
2.5k
Featured
See All Featured
Large-scale JavaScript Application Architecture
addyosmani
513
110k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.6k
KATA
mclloyd
32
14k
Designing for Performance
lara
610
69k
Done Done
chrislema
185
16k
The Power of CSS Pseudo Elements
geoffreycrofte
77
6k
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.6k
Typedesign – Prime Four
hannesfritz
42
2.8k
Balancing Empowerment & Direction
lara
3
630
Practical Orchestrator
shlominoach
190
11k
Building Adaptive Systems
keathley
43
2.7k
Why Our Code Smells
bkeepers
PRO
339
57k
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.