January 4, 2020

384 words 2 mins read

FinMind/FinMind

FinMind/FinMind

Open Data, more than 50 financial data. 50

repo name FinMind/FinMind
repo link https://github.com/FinMind/FinMind
homepage http://finmindtrade.com/
language Python
size (curr.) 1035 kB
stars (curr.) 804
created 2018-12-16
license Apache License 2.0

Build Status license PyPI version Documentation Status

這是什麼?

FinMind 是超過 50 種金融開源數據 50 datasets。 包含

台股股價 daily、台股5秒交易資料 ( 2019-05-29 ~ now, 共超過 3 千萬筆 )、財報、資產負債表、股利配息、現金流量表、月營收、外資持股、股權分散表、融資融券、三大法人買賣,台股期貨、選擇權交易明細、還原股價。

美股股價 daily、minute ( 2019-06-01 ~ now, 共超過 8 千萬筆 ),G7 匯率、利率。 國際原油價格、黃金價格,美債殖利率。

資料每天更新。你不需收集資料,就可進行分析。

What is it?

FinMind is open source of more than 50 datasets , contain

Taiwan stock trade data daily, Taiwan stock trade data (5 seconds) ( 2019-05-29 ~ now, total more than 30 million data ), Financial Statements, Balance Sheet, Cash Flows Statement, Month Revenue, Holding Shares Per, Institutional Investors Buy Sell. Taiwan Futures Trade Detail, Taiwan Option Trade Detail.

US stock price daily, minute ( 2019-06-01 ~ now, total more than 80 million data ), oil price, gold price, G7 exchange rate, interest rate. US Government Bonds Yield.

The datasets are automatically updated daily. You can analyze financial data without having to collect the data by yourself.

 pip3 install FinMind

Solicit partners who are interested in joint development. 徵求有興趣共同開發的夥伴。 email : FinMind.TW@gmail.com


License

Project of Contents


Backtesting 回測

Dataset Api

import requests
import pandas as pd
url = 'http://finmindapi.servebeer.com/api/data'
form_data = {'dataset':'TaiwanStockInfo'}
res = requests.post(url,verify = True,data = form_data)

url = 'http://finmindapi.servebeer.com/api/data'
form_data = {'dataset':'TaiwanStockPrice','stock_id':'2317','date':'2019-06-01'}
res = requests.post(url,verify = True,data = form_data)

temp = res.json()
data = pd.DataFrame(temp['data'])
data.head()
library(httr)
library(jsonlite)
library('data.table')
library(dplyr)

url = 'http://finmindapi.servebeer.com/api/data'

# TaiwanStockInfo
payload<-list( 'dataset' = 'TaiwanStockInfo')

response = POST(url,body = payload,encode="form")
data = response %>% content
data = do.call('cbind',data$data) %>%data.table
head(data)

note : 限制 request 上限 : 600 / hour。Limit amount of request, 600 / hour.FinMind官網註冊後,request api 帶 user_id, password 參數,使用上限可提高到 1500/hr。 user_id, password 參數使用方法,可參考線上 api

translation 中英對照

import requests
url = 'http://finmindapi.servebeer.com/api/translation'
dataset = 'RawMaterialFuturesPrices'
# or
# dataset = 'FinancialStatements'
# dataset = 'BalanceSheet'
# dataset = 'StockDividend'
# dataset = 'TaiwanStockMarginPurchaseShortSale'
# dataset = 'InstitutionalInvestorsBuySell'
parameter = {'dataset':dataset}

res = requests.post(url,verify = True,data = parameter)
#res.text
data = res.json()
data = pd.DataFrame( data['data'] )

Crawler 爬蟲

  • 由於原物料、債券期貨資料,有法規問題,禁止散布,因此我公開爬蟲 code,各位自行爬蟲,就不是從我這獲得資料,不會有散布問題
  • demo code
comments powered by Disqus