1. FinMind
金融開源 data 智能交易系統
Financial open-source data Intelligent trading system
https://github.com/FinMind/FinMind https://finmindtrade.com/
2. 猜想聽眾 Guessing you are…
1. 資料科學背景 With background in data science
2. 金融背景 With background in finance
3. 對投資有興趣 Interested in investing
4. 相信資料科學、更勝於股市老師
Believe in data science better than investment advisors
3. 為何開發 FinMind? Why develop FinMind?
1. 做研究,資料分析、機器學習,需要 Data
When postgraduates doing researches, data analysis and machine learning. Need data
2. Data Scientist 做分析,需要 Data
When Data Scientists performing analysis. Need data
3. 想做投資,分析股票、做回測,需要 Data
When trying to invest, analyze stocks and backtesting. Need data
4. 為何開發 FinMind? Why develop FinMind?
每個人都從爬蟲開始,每個人都爬一次???
Everybody starts with Python, but does everyone need to run it once???
不,爬一次就好
No, only one time needed.
我幫使用者,解決第一個問題,更容易推廣資料科學
I could help these users to solve their first problem and make it
easier to promote data science.
5. 資料科學很紅,資料卻缺乏
Data science is popular, but data is not enough
Kaggle
政府資料開放平台
Open Government Data Platform
資料不會更新
Never updated
資料更新慢,需要定時下載
Rarely updated. Csv or json.
Need to be downloaded regularly
7. 先自我介紹 About me
1. 數學系背景,研究所做資料分析 ( ML, DL )
Mathematics background. Majored in data analysis in graduate school ML, DL
2. 2017/9 研究所畢業,開始開發 FinMind
Sep. 2017: Completed a postgraduate degree, and started developing FinMind
3. 2019/2 開始上網徵求合作開發者
Feb. 2019: Started looking for developer partners online
8. 資料科學很紅,資料卻缺乏
Data science is popular, but data is not enough
1. FinMind 開發自動化收集金融資料,每日更新
Started developing FinMind, which collects financial data automatically and updat
daily
2. 提供 api,user 更廣泛,user 可自動化每日更新
Provide API, broader user base, user could setup a daily update automatically
3. 相同 data 集中
Put the same kinds of data together
4. 雲端,相對穩定
In the cloud, and relatively stable
9. 金融開源 data
Financial open-source data
1. 提供 API 存取 data
Provides API to access data
a. R
b. Python
c. Java
d. other etc.... 基本上不限語言
Basically no limitations
10. 2. data (技術面) ( technical factors )
a. 台股股價 Taiwan stock market price
b. 還原股價 Adjust stock price
c. 美股股價 U.S. stock market price
d. 計算技術指標、time series, Technical indicators
e.
資料來源 : 證交所、公開資訊觀測站、櫃買中心
Source : TWSE, MOPS and TPEX
金融開源 data, Financial open-source data
11. 2. data (基本面) (fundamental factors)
a. 財報 Financial statements
b. 資產負債表、現金流量表 Balance Sheet and Cash Flow
c. 月營收, 股利配息 Monthly revenue, Dividend Paid
d. 篩選好公司、成長力高的公司,長期投資
Pick good companies with high growth for long-term investment
資料來源 : 證交所、公開資訊觀測站、櫃買中心
Source : TWSE, MOPS and TPEX
金融開源 data, Financial open-source data
12. 2. data ( 籌碼面 ) data ( chip factors )
a. 外資持股 Foreign Investors’ holding
b. 股權分散表 Shareholding distribution
c. 融資融券 Margin trading and short selling
d. 三大法人買賣 Trading activities of institutional investors
e. 跟著外資、大戶買? Follow the steps of foreign investors or major players?
資料來源 : 證交所、公開資訊觀測站、櫃買中心
Source : TWSE, MOPS and TPEX
金融開源 data, Financial open-source data
13. 1. data ( other )
a. G7 匯率、利率。國際原油價格、黃金價格,美債殖利率。
G7 exchange rate, interest rate. International crude oil prices, gold price, and U.S. Treasury
yields.
b. 美債殖利率倒掛 -> 股市大跌 U.S. Treasury yields falls -> Stock market crash
c. 黃金價格提高,避險? Gold price climbs, hedging?
d. 匯率影響外國投資 Exchange rates affect foreign investment
資料來源 : yahoo finance、美國財政部等
Source : yahoo finance and US Department of the Treasury etc.
金融開源 data, Financial open-source data
14. 為什麼要收集這些 data?
Why collecting these data?
我希望從總體經濟層面做分析,不只是看單一數據
I’d like to analyze from the aspects of macroeconomics, instead of
just looking at a single data.
15. 2. 如何收集 data ? How to collect data ?
a. python 爬蟲
b. Rabbitmq & Celery 分散式架構 ( 目前 7 台機器 )
Rabbitmq & Celery distributed architecture ( currently 7 sets )
c. 雲端系統 ( linode 便宜 )
Cloud system ( linode is cheap )
金融開源 data, Financial open-source data
24. API Log
1. 平均每天 4000 request。最多一天 20,000。
4,000 request per day in average. Highest record of 20,000 a day.
2. 9/24 ,有 1.2 萬個 request,來自 140.112 ( 哪間大學? )
Sep. 24: received 12,000 requests from 140.112 ( Which university it is? )
25. 未來預計新增 data
Data to be added in the future
1. 台股期貨、選擇權 data Data of Taiwan futures and option
a. 台指期夜盤,會影響台股大盤指數 Taiwan index futures market
will affect Taiwan stock market index
2. 世界主要市場指數 Global stock market indexes
3. 海外期貨 ( 債券、原物料 ) Oversea futures ( bond and raw materials )
28. 為何開發智能交易系統 ?
Why developed Intelligent trading system ?
1. 看到不少討論回測文章。 Saw a lot of discussion about backtesting
2. 每個人都重頭做一遍 ? Everyone must run it from the beginning ?
3. 我自己也希望線上使用 I’d also like to use it online
4. 公開驗證自己的想法 Publicly validate your own ideas
30. 智能交易系統
Intelligent trading system
○ 提供 data, provide data
○ 回測平台, backtesting platform
○ 自動化交易系統,根據使用者設計的策略,進行交易 ,
automatic trading system to conduct transactions based on user-designed
strategies.
○ 核心策略,讓 user 自行設計 Core strategy: let users design on their own
32. 什麼是回測?
What is backtesting?
1. 為什麼要做回測? Why backtesting?
a. 在實際交易前,驗證自己的想法 Validate your ideas before the
actual transactions
b. 用資料輔助做決策 Use data to assist in making decisions
c. 金融市場,影響的變數太多,人無法處理 Too many variables in
financial market, difficult for human to handle
35. 為何開發智能交易系統 ?
Why developed Intelligent trading system ?
1. 贏錢的策略,自己用就好,為何要公開? Winning strategies should be
kept for yourself. Why make it public?
36. 為何開發智能交易系統 ?
Why developed Intelligent trading system ?
1. FinMind 不做策略,提供 data、自動交易系統,讓 user 設計自
己的策略 FinMind doesn’t provide strategy, instead, it provides data and
automatic trading system, which allows users to develop their own strategies.
Data ——> 策略 ——> 自動交易
Data Strategy Automatic Trading
37. 特色
advantages
1. 可用 Python 設計策略,繼承 Python 資料科學的優勢
Use Python to design strategies, inherit the benefits of Python data science
2. Python 有豐富的套件,包含 ML、DL、time series 等 There
are plenty of Python packages, including ML, DL and time series, etc.
3. Python 學習資源豐富、社群強大,學 Python 可用於更多領域
With rich learning resources and a strong community, Python can be used in more
fields.
39. 如何設計個人策略?
How to develop a personal strategy?
1. 策略,可以自由設計技術指標、進行資料處理 Strategy, design the
technical indicators and process data freely
2. 只需要回傳 Only need to send back
a. 1 : 買 1 張 buy 1 stock
b. 0 : 不買不賣 no buying and no selling
c. -1 : 賣 1 張 sell 1 stock