diff --git a/docs/tutor/TaiwanMarket/DataList.md b/docs/tutor/TaiwanMarket/DataList.md index b0bf933..e294ea8 100644 --- a/docs/tutor/TaiwanMarket/DataList.md +++ b/docs/tutor/TaiwanMarket/DataList.md @@ -1,4 +1,4 @@ -在台灣金融市場,我們擁有 45 種資料集,如下: +在台灣金融市場,我們擁有 46 種資料集,如下: #### 技術面 Technical @@ -14,6 +14,7 @@ - [當日沖銷交易標的及成交量值 TaiwanStockDayTrading](https://finmind.github.io/tutor/TaiwanMarket/Technical/#taiwanstockdaytrading) - [加權、櫃買報酬指數 TaiwanStockTotalReturnIndex](https://finmind.github.io/tutor/TaiwanMarket/Technical/#taiwanstocktotalreturnindex) - [台灣各股十年線資料表 TaiwanStock10Year](https://finmind.github.io/tutor/TaiwanMarket/Technical/#taiwanstock10year) +- [台灣分 K 資料表 TaiwanStockKBar](https://finmind.github.io/tutor/TaiwanMarket/Technical/#k-taiwanstockkbar-sponsor) #### 籌碼面 Chip diff --git a/docs/tutor/TaiwanMarket/Technical.md b/docs/tutor/TaiwanMarket/Technical.md index 2ac994d..057576e 100644 --- a/docs/tutor/TaiwanMarket/Technical.md +++ b/docs/tutor/TaiwanMarket/Technical.md @@ -1,4 +1,4 @@ -在台股技術面,我們擁有 11 種資料集,如下: +在台股技術面,我們擁有 12 種資料集,如下: - [台股總覽 TaiwanStockInfo](https://finmind.github.io/tutor/TaiwanMarket/Technical/#taiwanstockinfo) - [台股總覽(含權證) TaiwanStockInfoWithWarrant](https://finmind.github.io/tutor/TaiwanMarket/Technical/#taiwanstockinfowithwarrant) @@ -11,6 +11,7 @@ - [當日沖銷交易標的及成交量值 TaiwanStockDayTrading](https://finmind.github.io/tutor/TaiwanMarket/Technical/#taiwanstockdaytrading) - [加權、櫃買報酬指數 TaiwanStockTotalReturnIndex](https://finmind.github.io/tutor/TaiwanMarket/Technical/#taiwanstocktotalreturnindex) - [台灣各股十年線資料表 TaiwanStock10Year](https://finmind.github.io/tutor/TaiwanMarket/Technical/#taiwanstock10year) +- [台灣分 K 資料表 TaiwanStockKBar](https://finmind.github.io/tutor/TaiwanMarket/Technical/#k-taiwanstockkbar-sponsor) 根據上述資料表逐一說明怎麼使用,另外具體資料表 schemas 請參考 [finmindapi](http://api.finmindtrade.com/docs#/default/method_api_v4_data_get) @@ -960,4 +961,58 @@ | 1 | 2020-04-06 | 0053 | 28.68 | | 2 | 2020-04-06 | 0055 | 14.31 | | 3 | 2020-04-06 | 0056 | 24.59 | - | 4 | 2020-04-06 | 0061 | 16.28 | \ No newline at end of file + | 4 | 2020-04-06 | 0061 | 16.28 | + + +#### 台灣分 K 資料表 TaiwanStockKBar (只限 [sponsor](https://finmindtrade.com/analysis/#/Sponsor/sponsor) 會員使用) + +- 資料更新時間 **星期一至五 15:50**,實際更新時間以 API 資料為主 + +!!! example + === "Python-request" + ```python + import requests + import pandas as pd + url = "https://api.finmindtrade.com/api/v4/data" + parameter = { + "dataset": "TaiwanStockKBar", + "data_id": "2330", + "start_date": "2023-09-22", + "token": "", # 參考登入,獲取金鑰 + } + resp = requests.get(url, params=parameter) + data = resp.json() + data = pd.DataFrame(data["data"]) + print(data.head()) + ``` + === "R" + ```R + library(httr) + library(data.table) + library(dplyr) + url = 'https://api.finmindtrade.com/api/v4/data' + response = httr::GET( + url = url, + query = list( + dataset="TaiwanStockKBar", + data_id= "2330", + start_date= "2023-09-22", + token = "" # 參考登入,獲取金鑰 + ) + ) + data = content(response) + df = data$data %>% + do.call('rbind',.) %>% + data.table + head(df) + + ``` + +!!! output + | | date | minute | stock_id | open | high | low | close | volume | + |---:|:-----------|:---------|-----------:|-------:|-------:|------:|--------:|---------:| + | 0 | 2023-09-22 | 09:00:00 | 2330 | 523 | 524 | 522 | 524 | 3893 | + | 1 | 2023-09-22 | 09:01:00 | 2330 | 524 | 524 | 523 | 524 | 159 | + | 2 | 2023-09-22 | 09:02:00 | 2330 | 523 | 524 | 522 | 523 | 548 | + | 3 | 2023-09-22 | 09:03:00 | 2330 | 522 | 523 | 522 | 522 | 208 | + | 4 | 2023-09-22 | 09:04:00 | 2330 | 522 | 523 | 522 | 522 | 179 |