A website that shows the daily NAV of every Thai mutual fund, refreshed automatically twice a day, around 10:17 and 20:17 (Bangkok time) from the SEC Open Data API.
Cost: ฿0. Everything runs on GitHub's free tier:
| Job | Free service used |
|---|---|
| Run the update every morning | GitHub Actions (scheduled workflow) |
| Store the data ("database") | JSON files inside this GitHub repository (data/) |
| Host the website | GitHub Pages |
| Keep the API key secret | GitHub Secrets |
You do not need to rent a server or a database.
ใช้บัญชี GitHub ที่มีอยู่แล้ว เข้าที่ https://github.com
- กดปุ่ม + มุมขวาบน → New repository
- Repository name:
thai-fund-nav - เลือก Public (GitHub Pages ฟรีต้องเป็น Public — ข้อมูล NAV เป็นข้อมูลสาธารณะอยู่แล้ว ส่วน API key จะเก็บแยกเป็นความลับ ไม่มีใครเห็น)
- กด Create repository
- แตกไฟล์ zip ที่ได้รับไว้ในเครื่อง
- ในหน้า repository กดลิงก์ uploading an existing file
- ลาก ทุกอย่างที่อยู่ข้างในโฟลเดอร์
thai-fund-nav(โฟลเดอร์.github, ไฟล์update.py,index.html,README.md) ไปวางในหน้าเว็บ- บน Mac โฟลเดอร์
.githubถูกซ่อน กดCmd + Shift + .ใน Finder เพื่อให้มองเห็น
- บน Mac โฟลเดอร์
- กด Commit changes
- ตรวจว่ามีไฟล์
.github/workflows/daily-update.ymlอยู่ใน repo (ถ้าไม่มี ให้กด Add file → Create new file พิมพ์ชื่อ.github/workflows/daily-update.ymlแล้ว copy เนื้อหาจากไฟล์ในเครื่องมาวาง)
- ใน repo ไปที่ Settings → Secrets and variables → Actions
- กด New repository secret
- Name:
SEC_API_KEY - Secret: ใส่ API key ของคุณ
- กด Add secret
- Settings → Pages
- ตรง Source เลือก GitHub Actions
- ไปแท็บ Actions (ถ้ามีปุ่มเขียว "I understand my workflows, go ahead and enable them" ให้กด)
- เลือก Daily NAV update ทางซ้าย → Run workflow → กด Run workflow
- ครั้งแรกระบบจะดึงประวัติย้อนหลัง 13 เดือนให้อัตโนมัติ รอประมาณ 30–40 นาที จนขึ้นเครื่องหมายถูกสีเขียว
- ถ้าต้องการประวัติ 10 ปี (แนะนำ): ตอนกด Run workflow ให้ใส่ช่อง From date =
2016-01-01(ใช้เวลาประมาณ 2–3 ชั่วโมง ทำครั้งเดียว)
- ถ้าต้องการประวัติ 10 ปี (แนะนำ): ตอนกด Run workflow ให้ใส่ช่อง From date =
- เว็บของคุณจะอยู่ที่
https://<ชื่อผู้ใช้ GitHub>.github.io/thai-fund-nav/
หลังจากนี้ระบบจะอัปเดตเองวันละ 2 ครั้ง ประมาณ 10:17 และ 20:17 น. ไม่ต้องทำอะไรอีก
-
ภาษา: หน้าหลัก (
/) เป็นภาษาไทย หน้าen.htmlเป็นภาษาอังกฤษ (ระบบสร้างให้เองตอน build) · ปุ่ม TH / EN อยู่ทุกหน้า กดแล้วย้ายไปหน้าภาษานั้นและจำไว้ · ลิงก์ที่แชร์ตอนใช้ภาษาอังกฤษจะเป็นen.html?...ซึ่งแสดงรูปและหัวข้อภาษาอังกฤษใน Facebook/LINE (og-en.png) · ไฟล์ CSV ใช้หัวคอลัมน์ตามภาษาที่เลือก -
ลดหย่อนภาษี (แท็บสีเขียว + แบนเนอร์ใต้ช่องค้นหา พร้อมนับถอยหลังถึงวันปิดรับ): สรุปเงื่อนไข RMF / ThaiESG-ThaiESGX / SSF ปีภาษีปัจจุบัน, เครื่องคำนวณภาษีเต็มรูปแบบ (กรอกค่าลดหย่อนทีละรายการ แสดงภาษีแต่ละขั้น ก่อน/หลังซื้อกองทุน ภาษีที่ประหยัดได้เป็นบาทและ % และยอดคืน/จ่ายเพิ่ม) — เกณฑ์ปีภาษี 2569 อยู่ใน
TAXFและtaxRunของ index.html, ตารางเทียบค่ากลางผลตอบแทนและ TER แต่ละประเภท, กราฟผลตอบแทนเทียบค่าธรรมเนียม, รายชื่อกองทุกกองแยกตามประเภทและสินทรัพย์ · ทุกต้นปีให้ตรวจเงื่อนไขภาษีที่เปลี่ยน (แก้ในส่วนTax-saving fundsของ index.html) -
ค้นหาด่วน: ช่องค้นหาใหญ่ใต้ชื่อเว็บ พิมพ์รหัส ชื่อไทย หรือคำทั่วไป เช่น ทองคำ หุ้นเทค ญี่ปุ่น แล้วแตะกองทุนเพื่อเปิดหน้ากองทุนทันที
-
รายการเริ่มต้น: เรียงตามกองที่ขึ้นมากที่สุดวันล่าสุด (กองที่ราคาเก่ากว่า 3 วัน เช่น กองไพรเวทที่ประเมินราคาเป็นครั้งคราว และกองเล็กกว่า 50 ล้านบาท จะอยู่ท้ายรายการ)
-
ตั้งแต่เข้ามาครั้งก่อน: การ์ดใต้ช่องค้นหา แสดงว่ากองที่ติดตามและพอร์ตขึ้นลงเท่าไรตั้งแต่วันที่เข้าเว็บครั้งก่อน (บวกปันผลที่จ่ายระหว่างนั้นกลับ) · กด × เพื่อซ่อนจนถึงวันถัดไป
-
แอปบนหน้าจอโฮม: ไฟล์ไอคอน
icon-192.png,icon-512.png,icon-maskable-512.png,apple-touch-icon.png· ระบบสร้างmanifest.webmanifestและsw.jsให้เองตอน build · หลังผู้ใช้กด ★ หรือบันทึกการซื้อครั้งแรก จะมีหน้าต่างแนะนำวิธีเพิ่มไปหน้าจอโฮม (Android / iPhone / แอป Facebook-LINE ให้เปิดใน Chrome/Safari ก่อน) แสดงไม่เกิน 2 ครั้ง ห่างกัน 2 สัปดาห์ -
แชร์และส่งออก: ปุ่ม ↗ แชร์ ในหน้ากองทุน หน้าเปรียบเทียบ หน้ากองที่ติดตาม และหน้าพอร์ต (พอร์ตแชร์เฉพาะสัดส่วน % ไม่มีจำนวนเงิน) · ลิงก์อ่านง่าย เช่น
?fund=KFGTECH-A,?compare=KFSMART-A,SCBSET50,?watch=...,?port=SCBGOLD:50,KFGTECH-A:33,...· คนที่เปิดลิงก์กดเพิ่มกองทั้งหมดเข้ากองที่ติดตามได้ในแตะเดียว · ส่งออก CSV (เปิดใน Excel ภาษาไทยได้) และไฟล์สำรอง JSON -
แบนเนอร์ในแอป Facebook / LINE / Instagram: แนะนำให้เปิดในเบราว์เซอร์ เพราะเบราว์เซอร์ในแอปมักไม่เก็บข้อมูล · LINE และ Android มีปุ่มเปิดในเบราว์เซอร์ให้กดได้เลย
-
ภาพตอนแชร์ลิงก์: ไฟล์
og.png(1200×630) แสดงเป็นรูปเมื่อแชร์ลิงก์เว็บใน Facebook / LINE -
ค้นหา: พิมพ์รหัสกองทุน ชื่อไทย/อังกฤษ หรือชื่อ บลจ.
-
กรอง: บลจ., ประเภทกองทุน, SSF / RMF / ThaiESG
-
เรียงลำดับ: กดหัวคอลัมน์
-
กรองตามธีม: กดการ์ดใน Themes at a glance (กดซ้ำเพื่อยกเลิก)
-
★ Watchlist (แท็บ): กดดาวหน้ากองทุน แล้วเปิดแท็บ ★ Watchlist ดูผลตอบแทนทุกช่วง กราฟเงิน ฿10,000 เติบโตเท่าไร และปุ่ม Compare (จำไว้ในเบราว์เซอร์นั้น)
-
กราฟ: กดที่แถวเพื่อดู NAV ย้อนหลัง 1M / 3M / 6M / 1Y
-
Fees & ranking: สลับไปแท็บนี้เพื่อดูค่าธรรมเนียม (TER, management fee, front/back-end), ผลตอบแทน 3 ปี เทียบค่าเฉลี่ยกลุ่ม, ความผันผวน, ระดับความเสี่ยง 1–8 และคะแนน 0–100 ปรับน้ำหนักได้ด้วยแถบเลื่อน (ข้อมูลจาก fund factsheet รายเดือน อัปเดตทุกสัปดาห์)
-
Dividends (แท็บ): กองทุนที่จะปิดสมุดทะเบียน/จ่ายปันผลเร็ว ๆ นี้ (นับวันถอยหลัง), ที่จ่ายไปใน 45 วัน, และ yield 12 เดือนสูงสุด — กรองเฉพาะ Watchlist หรือพอร์ตของเราได้; คอลัมน์ Yield 12 เดือน, ตัวกรอง "Pays dividends", และสวิตช์ "Returns include dividends" (บวกเงินปันผลกลับเข้าไปในผลตอบแทน — เปิดไว้เป็นค่าเริ่มต้น) หน้ากองทุนแสดงประวัติการจ่ายปันผลรายปีและรายครั้ง
-
Factsheet: หน้ากองทุนมีปุ่ม Factsheet PDF ↗ เปิดหนังสือชี้ชวนส่วนสรุปข้อมูลสำคัญ (fund fact sheet) ล่าสุดของ class นั้นจากเว็บ บลจ. และลิงก์ "SEC copy" สำรองจาก ก.ล.ต. (อัปเดตทุกวัน)
-
My portfolio (ปุ่มขวาสุดของแท็บ หรือปุ่ม "+ My portfolio" ในหน้ากองทุน): บันทึกการซื้อ/ขาย ดูมูลค่า กำไร/ขาดทุน (ต้นทุนเฉลี่ย) เงินปันผลที่ได้รับ (ประมาณจากข้อมูล ก.ล.ต.) สัดส่วนการลงทุน ค่าธรรมเนียมรวมต่อปี และกราฟมูลค่าย้อนหลัง
- ไม่ต้องสมัครสมาชิก ข้อมูลเก็บในเบราว์เซอร์ของผู้ใช้เท่านั้น (ไม่ถูกส่งมาที่เรา) มีปุ่ม Backup/Restore เป็นไฟล์หรือรหัสสำหรับย้ายเครื่อง
- เวอร์ชันฟรีสร้างได้ไม่เกิน 2 พอร์ต (ตั้งค่าที่
PORT_LIMITใน index.html) — คนที่กดสร้างพอร์ตที่ 3 จะถูกนับเป็น eventportfolio-limitใน Umami ใช้วัดความต้องการแผนเสียเงินได้
-
Same master fund: แท็บที่ 3 รวมกองทุนไทยที่ลงทุนในกองทุนหลัก (master fund) ตัวเดียวกัน — เทียบ TER, การป้องกันความเสี่ยงค่าเงิน (Unhedged / Hedged / Dynamic) และผลตอบแทน กด "Compare" เพื่อเปรียบเทียบได้ทันที หน้ากองทุนแต่ละกองก็มีส่วน "Same master fund" เช่นกัน
- สมัครที่ https://cloud.umami.is (แผน Hobby ฟรี: 100,000 events/เดือน, 1 เว็บไซต์, เก็บข้อมูล 6 เดือน)
- Add website → Name:
Thai Fund NAV Board, Domain:pypptpp.github.io→ Save - เปิดเว็บไซต์ที่เพิ่ง add → Edit → คัดลอก Website ID (รูปแบบ
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) - ใน GitHub repo: Settings → Secrets and variables → Actions → แท็บ Variables → New repository variable
- Name:
UMAMI_WEBSITE_ID· Value: Website ID ที่คัดลอกมา → Add variable
- Name:
- Actions → Daily NAV update → Run workflow — หลังรันเสร็จ เว็บจะเริ่มส่งสถิติไป Umami
สิ่งที่ดูได้ใน Umami: จำนวนผู้เข้าชม, ประเทศ/จังหวัด/เมือง, อุปกรณ์, มาจากไหน (Google, LINE, Facebook),
หน้ากองทุนที่ถูกเปิดมากที่สุด (/fund/<รหัสกองทุน> ในรายงาน Pages) และการใช้ฟังก์ชันต่าง ๆ (รายงาน Events):
tab, quick-filter, filter, search, compare-add, compare-open, compare-view, watchlist,
master-theme, master-open, master-search, factsheet, portfolio-add, portfolio-create, portfolio-limit, portfolio-backup, portfolio-restore, portfolio-delete, dividends-sort, share (kind: fund, compare, watchlist, portfolio, tax, tax-calc, dividends), shared-open, shared-watch-add, export, inapp-banner, inapp-open-browser, since-shown, since-open, install-prompt, install-choice, app-installed, hero-search, tax-promo, tax-type, tax-sort, tax-scatter-open, tax-calc-max, language, dividends-filter, watchlist-period, chart-period, chart-mode, sort, dividends-toggle, dividend-calendar
- ไปที่ https://search.google.com/search-console → Add property → เลือกแบบ URL prefix → ใส่
https://pypptpp.github.io/thai-fund-nav/→ Continue - ในหน้าวิธียืนยัน เลือก HTML tag → คัดลอกเฉพาะค่าใน
content="..."(ไม่เอาเครื่องหมายคำพูด) - GitHub repo → Settings → Secrets and variables → Actions → Variables → New repository variable
- Name:
GOOGLE_SITE_VERIFICATION· Value: ค่าที่คัดลอกมา → Add variable
- Name:
- Actions → Daily NAV update → Run workflow แล้วรอจนเสร็จ (เครื่องหมายถูกสีเขียว)
- กลับไปที่ Search Console กด Verify
- เมนูซ้าย Sitemaps → ใส่
sitemap.xml→ Submit ข้อมูลคำค้นหาจะเริ่มแสดงภายในไม่กี่วัน (รายงาน Performance)
| อาการ | วิธีแก้ |
|---|---|
| Actions ขึ้น ❌ "ERROR 401" | API key ผิด → แก้ใน Settings → Secrets |
| Actions ขึ้น ❌ ตอน deploy | ตรวจว่า Settings → Pages → Source = GitHub Actions |
| เว็บไม่อัปเดต | ดูแท็บ Actions ว่ารันไหม; ถ้า repo ไม่มีความเคลื่อนไหว 60 วัน GitHub จะหยุดตารางเวลา ให้กด Enable workflow ใหม่ |
| อยากดึงประวัติย้อนหลังเพิ่ม | Actions → Run workflow → ใส่ From date เช่น 2016-01-01 (10 ปี) |
| อยากได้ประวัติทั้งหมดตั้งแต่ปี 2540 (1997) | รันทีละช่วงเพื่อไม่ให้เกินเวลา 6 ชม. ของ GitHub: (1) From 1997-01-01 To 2005-12-31 (2) From 2006-01-01 To 2015-12-31 (3) From 2016-01-01 — ข้อมูลรวม ~700 MB ใกล้เพดาน GitHub แนะนำทำตอนย้ายไป Supabase |
update.py fetchcallsGET https://api.sec.or.th/v2/fund/daily-info/nav?start_nav_date=…&end_nav_date=…(headerOcp-Apim-Subscription-Key), pages withnext_cursor(100 rows/page), and writes one file per NAV date todata/daily/. It also refreshes the active fund list from/v2/fund/general-info/profiles?fund_status=Registered|IPO.- Fees, factsheet returns, peer averages, volatility and risk level come from
/v2/fund/factsheet/fees,/factsheet/performanceand/factsheet/risk-spectrum, refreshed weekly intodata/factsheet.json(about 7,500 calls; the script backs off automatically on SEC rate limits and resumes on the next run if interrupted). - Dividends:
/v2/fund/daily-info/dividend-history(every payout since 1994, ~45 calls) and/v2/fund/factsheet/dividend-policy(pays or not, per class), refreshed daily intodata/dividends.json. Total returns add each payout back on the first NAV date on or after its book-close date, which is when the NAV drops in about 3 of 4 cases checked. The SEC record has gaps (almost nothing for 2021–2023, some payers missing). - Master funds: feeder funds' free-text master names are cleaned (Thai "กองทุน", ®, share-class suffixes, umbrella words) and grouped; a shorter name joins a longer one only when the extra words are fund-house/umbrella words. Hedging comes from the fund's FX policy, or from the class name (-H / -UH) when set per class.
- Factsheet links:
/v2/fund/factsheet/urls(the fund company's PDF and the SEC's copy for every share class, ~75 calls), refreshed daily intodata/factsheet_links.jsonand shown as a Factsheet PDF button on each fund page and a row in Compare. - Each run re-downloads the last 21 days so late or corrected NAVs are picked up (the SEC sometimes completes a day 1–2 weeks later).
update.py buildturnsdata/into the website insite/(latest table with 1D/1W/1M/3M/6M/YTD/1Y returns + one history file per fund) and the workflow deploys it to GitHub Pages.- Daily files are small (~200 KB) and never rewritten once settled, so the repo grows by roughly 50 MB a year.
- Upload
index.html,update.py,og.png,og-en.pngand.github/workflows/daily-update.ymlto this repository. - Settings → Secrets and variables → Actions → Variables → New variable:
SITE_URL=https://fundfig.com/ - Create a new public repository named move. Upload
move/index.htmlto it asindex.html. Settings → Pages → Deploy from branchmain, folder/ (root). - Cloudflare → fundfig.com → DNS → add these records, each set to DNS only (grey cloud):
- A
@185.199.108.153 / 185.199.109.153 / 185.199.110.153 / 185.199.111.153 - AAAA
@2606:50c0:8000::153 / 2606:50c0:8001::153 / 2606:50c0:8002::153 / 2606:50c0:8003::153 - CNAME
wwwpypptpp.github.io
- A
- This repository → Settings → Pages → Custom domain
fundfig.com→ Save. When the check turns green, tick Enforce HTTPS. - Actions → Daily NAV update → Run workflow.
- Afterwards: Google Search Console (add fundfig.com, submit
https://fundfig.com/sitemap.xml), Umami (change the domain), Facebook Sharing Debugger (re-scrape/and/en.html).
Saved watchlists and portfolios move across automatically on each visitor's first visit to fundfig.com until 2027-06-30. After that date, delete the move repository and the "Moving from pypptpp.github.io" script block at the top of index.html.