一個直接從台灣期交所與證交所官方網站抓取市場籌碼資料的 Python 套件,免註冊、免 token,回傳 pandas DataFrame。

Stars

28

7 天增长

暂无数据

Fork 数

1

开放 Issue

0

开源协议

MIT

最近更新

2026-08-01

AI 仓库情报摘要
FR-AI / ANALYSIS

为什么值得关注

不需任何認證即可取得交易所原始資料,並以 pandas 整合期貨、選擇權、個股與融資融券等多種籌碼數據,大幅降低台灣市場資料的取得門檻。

适合谁使用

  • 專注台灣市場的量化分析師與研究員
  • 需要整合籌碼資料的 Python 開發者
  • 想追蹤法人與融資融券數據的個人投資人
  • 金融數據相關的教學或內容創作者

典型使用场景

  • 追蹤三大法人在期交所期貨與選擇權的每日籌碼數據
  • 分析證交所個股(如 2330)的三大法人買賣超
  • 取得全市場或個股融資融券統計
  • 搭配 sleep 迴圈抓取歷史單日資料以建立研究數據集

项目优势

  • 免註冊、免 API token,直接抓取交易所網站
  • 回傳 pandas DataFrame,並已清理千分位、'-'、'%' 等數字格式
  • 同時涵蓋 TAIFEX 與 TWSE,包括期貨、選擇權、股票與融資融券
  • README 提供簡潔範例,模組與函式命名直觀

使用前须知

  • 尚未上 PyPI,需用 git 安裝
  • 僅支援單日查詢,無法一次抓取日期區間
  • 交易所改版可能造成程式失效;證交所會封鎖高頻請求

README 快速开始

twchips

台灣市場籌碼資料的 Python 套件。不用註冊、不用 token,直接跟交易所官網要資料,回來是 pandas DataFrame。

期交所在 twchips.taifex,證交所在 twchips.twse

安裝

還沒上 PyPI:

pip install git+https://github.com/catcat222222/twchips

用法

from twchips import taifex

# 三大法人總表(期貨+選擇權合計)
tot = taifex.institutional("2026-07-31")

# 只要某個身份別:.foreign/.trust/.dealer
foreign = taifex.institutional.foreign("2026-07-31")

# 期貨依商品分、選擇權 CALL/PUT 分計
txf = taifex.institutional_futures.foreign("2026-07-31", product="臺股期貨")
puts = taifex.institutional_options("2026-07-31", side="PUT")

# 日行情
fut = taifex.futures_daily("2026-07-31", session="regular")
opt = taifex.options_daily("2026-07-31", session="regular")
from twchips import twse

tot = twse.institutional("2026-07-31")                     # 三大法人買賣金額
tsmc = twse.institutional_stocks("2026-07-31", stock="2330")  # 個股三大法人買賣超
m = twse.margin("2026-07-31")                              # 融資融券統計
ms = twse.margin_stocks("2026-07-31", stock="2330")        # 個股融資融券

商品代號照期交所(TXMTXTXO⋯)。三大法人的 product= 吃中文商品名稱,有哪些看 ["商品名稱"].unique()session"regular""after_hours",不給就是全部。

欄位名稱保留交易所原文。數字欄已轉數字(千分位、-% 都清掉),代號欄保持文字。非交易日回空的 DataFrame。

注意

  • 期交所三大法人的金額單位:總表是百萬元,依商品分和選擇權分計是千元。
  • 「合計」列期交所 CSV 沒有,證交所 JSON 有。
  • 證交所個股融資融券的同名欄位已加前綴(融資買進融券買進)。
  • 證交所的身份別較細(自營商×2、外資×2),foreign 會回兩列,不幫你加總。
  • 抓歷史請迴圈加 sleep,證交所會封鎖狂打的 IP。

還沒做

  • 日期區間(一次只能抓一天)
  • 櫃買中心
  • tick、最後結算價

交易所改版面就會壞,壞了開 issue。

關於 AI

程式碼是我跟 Claude Code 一起寫的。

免責

資料屬於 TAIFEX 與 TWSE。非投資建議。

项目描述

台灣市場籌碼資料的 Python 小工具:期交所日行情與三大法人、證交所三大法人與融資融券

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

lopopolo
精选
lopopolo GitHub avatar

harness-engineering

Harness Engineering is a methodology for improving coding agent outputs by carefully crafting the environment around them—providing curated context, tools, and executable constraints that encode an organization’s nonfunctional requirements and cumulative lessons.

AI 与机器学习AI 智能体
2,390
slvDev
精选
slvDev GitHub avatar

esp32-ai

A 28.9 million parameter language model runs on an $8 ESP32-S3 microcontroller entirely on-device, generating simple stories at about 9.5 tokens per second.

AI 与机器学习大语言模型
1,960
littledivy
精选
littledivy GitHub avatar

mimic

mimic captures traffic from any iOS or web app and automatically generates a Python client library that lets you call the app's API like a regular library.

AI 与机器学习
1,482