sec

package module
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 14 Imported by: 0

README

SEC-Go

Go Reference Go Report Card

Go client library for the Thailand SEC OpenAPI V2 (api.sec.or.th).

Installation

go get github.com/jwitmann/sec-go

Getting API Keys

  1. Go to the SEC Open Data developer portal
  2. Sign up for a free developer account
  3. Go to your Profile menu (top-right icon → "View profile")
  4. Under Subscriptions, click Subscribe to create a subscription key
  5. Your Primary key and Secondary key will be displayed on your profile page

Both keys share the same quota. The secondary key is useful as a fallback if you hit rate limits on the primary key.

Note: The legacy V1 API (api-portal.sec.or.th) is obsolete. This library targets the V2 API (api.sec.or.th) exclusively.

Quick Start

package main

import (
    "context"
    "fmt"
    "log"
    "os"

    sec "github.com/jwitmann/sec-go"
)

func main() {
    client, err := sec.NewClient(os.Getenv("SEC_API_KEY"))
    if err != nil {
        log.Fatal(err)
    }

    ctx := context.Background()
    amcs, _, err := client.ListAMCs(ctx, 10, "")
    if err != nil {
        log.Fatal(err)
    }
    for _, amc := range amcs {
        fmt.Println(amc.CompNameEN)
    }
}

Authentication

Pass your API key directly to the constructor:

client, err := sec.NewClient("your-api-key")

Or use the environment variable helper:

client, err := sec.ClientFromEnv() // reads SEC_API_KEY

For primary/secondary key support:

client, err := sec.NewClient(
    "primary-key",
    sec.WithSecondaryKey("secondary-key"),
)

client.UseSecondaryKey() // switch to secondary key
client.UsePrimaryKey()   // switch back to primary key

Configuration Options

client, err := sec.NewClient(
    "your-api-key",
    sec.WithTimeout(60*time.Second),
    sec.WithMaxRetries(5),
    sec.WithRetryDelay(200*time.Millisecond),
    sec.WithBaseURL("https://custom.api.sec.or.th"),
    sec.WithCache(cache, 5*time.Minute),
    sec.WithLogger(log.New(os.Stdout, "[sec] ", log.LstdFlags)),
    sec.WithRequestHook(func(req *http.Request) {
        // e.g., add tracing headers
    }),
    sec.WithResponseHook(func(req *http.Request, resp *http.Response, err error) {
        // e.g., record metrics
    }),
    sec.WithLanguage(sec.LanguageThai),
)

Supported Endpoints

Currently implemented: 82 endpoints (complete coverage)

📋 Full API catalog: See docs/v2-schemas/API-DISCOVERY.md for all endpoints across 6 categories:

  • Fund (กองทุน) — 21 endpoints ✅ Implemented
  • Bond (ตราสารหนี้) — 6 endpoints ✅ Implemented
  • PVD (Provident Fund / กองทุนสำรองเลี้ยงชีพ) — 15 endpoints ✅ Implemented
  • License Check — 16 endpoints ✅ Implemented
  • One Report — 23 endpoints ✅ Implemented
  • Digital Asset (สินทรัพย์ดิจิทัล) — 1 endpoint ✅ Implemented
General Info
  • ListAMCs/v2/fund/general-info/amcs
  • GetFundProfiles/v2/fund/general-info/profiles
  • GetFundSpecifications/v2/fund/general-info/specifications
  • GetMutualFundFees/v2/fund/general-info/mutual-fund-fees
  • GetFundInvolveParties/v2/fund/general-info/involve-parties
Daily Info
  • GetDailyNAV/v2/fund/daily-info/nav
  • GetDividendHistory/v2/fund/daily-info/dividend-history
Factsheet
  • GetFactsheetFees/v2/fund/factsheet/fees
  • GetFactsheetPerformance/v2/fund/factsheet/performance
  • GetFactsheetSubscriptionRedemptionMinimums/v2/fund/factsheet/subscription-redemption-minimums
  • GetFactsheetSubscriptionRedemptionPeriods/v2/fund/factsheet/subscription-redemption-periods
  • GetFactsheetStatistics/v2/fund/factsheet/statistics
  • GetFactsheetDividendPolicy/v2/fund/factsheet/dividend-policy
  • GetFactsheetBenchmarks/v2/fund/factsheet/benchmarks
  • GetFundFactsheetURLs/v2/fund/factsheet/urls
  • GetFundIPOs/v2/fund/factsheet/ipos
  • GetAssetAllocation/v2/fund/factsheet/asset-allocation
  • GetRiskSpectrum/v2/fund/factsheet/risk-spectrum
  • GetTop5Holdings/v2/fund/factsheet/top5-holdings
Outstanding
  • GetQuarterlyPortfolio/v2/fund/outstanding/portfolio
  • GetMonthlyPortfolioAssetType/v2/fund/outstanding/portfolio-asset-type
Bond (ตราสารหนี้)
  • ListBondIssuers/v2/bond/general-info/amcs
  • GetBondFeatures/v2/bond/general-info/features
  • GetBondCreditRatings/v2/bond/credit-rating
  • GetBondOutstanding/v2/bond/outstanding
  • GetBondRelatedParties/v2/bond/related-party
  • GetBondInvestorHoldings/v2/bond/investor-holding
PVD (Provident Fund / กองทุนสำรองเลี้ยงชีพ)
  • ListPVDs/v1/pvd/general-info/list
  • GetPVDFundInfo/v1/pvd/general-info/fund-info
  • GetPVDFundSpecs/v1/pvd/general-info/fund-spec
  • GetPVDFundMembers/v1/pvd/fund-member
  • GetPVDFundAssets/v1/pvd/fund-asset
  • GetPVDFundTransactions/v1/pvd/fund-transaction
  • GetPVDFundContributions/v1/pvd/fund-contribution
  • GetPVDFundExpenses/v1/pvd/fund-expense
  • GetPVDFundLiquidity/v1/pvd/fund-liquidity
  • GetPVDFundPerformance/v1/pvd/fund-performance
  • GetPVDFundBenchmarks/v1/pvd/fund-benchmark
  • GetPVDFundDividends/v1/pvd/fund-dividend
  • GetPVDFundPolicies/v1/pvd/fund-policy
  • GetPVDFundFees/v1/pvd/fund-fee
  • GetPVDFundCompliance/v1/pvd/fund-compliance
License Check
  • CheckBondSaleReps/v1/license-check/bond-sale-rep
  • CheckSecuritiesCompanies/v1/license-check/securities-company
  • CheckDerivativesCompanies/v1/license-check/derivatives-company
  • CheckSecuritiesBrokers/v1/license-check/securities-broker
  • CheckDerivativesBrokers/v1/license-check/derivatives-broker
  • CheckInvestmentAdvisors/v1/license-check/investment-advisor
  • CheckSecuritiesFundManagers/v1/license-check/securities-fund-manager
  • CheckFundSupervisors/v1/license-check/fund-supervisor
  • CheckAuditors/v1/license-check/auditor
  • CheckCreditRatingCompanies/v1/license-check/credit-rating-company
  • CheckPrivateFunds/v1/license-check/private-fund
  • CheckDerivativesFundManagers/v1/license-check/derivatives-fund-manager
  • CheckSecuritiesBorrowingLending/v1/license-check/securities-borrowing-lending
  • CheckFinancialAdvisors/v1/license-check/financial-advisor
  • CheckAcquirers/v1/license-check/acquirer
  • CheckVentureCapitals/v1/license-check/venture-capital

All endpoints return paginated results: ([]T, nextCursor, error). Use FetchAllPages to automatically traverse cursors.

Convenience Helpers

Search by Company or Name
// Get all funds managed by an AMC
profiles, err := client.GetFundsByCompany(ctx, "Krungthai Asset Management")

// Search across fund IDs, Thai names, English names, and abbreviations
profiles, err := client.SearchFunds(ctx, "alpha")

// Find an AMC by Thai/English name or unique ID
amc, err := client.FindAMC(ctx, "กรุงศรี")

// Find a bond issuer by Thai/English name or unique ID
issuer, err := client.FindBondIssuer(ctx, "กรุงไทย")

// Find a provident fund by Thai/English name or unique ID
pvd, err := client.FindPVD(ctx, "กรุงศรี")
Fetch All Pages
// Fetch all bond issuers (auto-paginates)
issuers, err := client.FetchAllBondIssuers(ctx)

// Fetch all bond features for a project
features, err := client.FetchAllBondFeatures(ctx, sec.BondFeatureOptions{ProjID: "B123456"})

// Fetch all provident funds (auto-paginates)
pvds, err := client.FetchAllPVDs(ctx)

// Fetch all PVD fund info for a project
fundInfos, err := client.FetchAllPVDFundInfo(ctx, sec.PVDProjOptions{ProjID: "PVD123"})
Single-Fund Lookups
profile, err := client.GetFundProfile(ctx, "KT-Alpha")
nav, err := client.GetFundLatestNAV(ctx, "KT-Alpha")
rs, err := client.GetFundRiskSpectrum(ctx, "KT-Alpha")
fees, err := client.GetFundFactsheetFees(ctx, "KT-Alpha")
allocation, err := client.GetFundAssetAllocation(ctx, "KT-Alpha")
holdings, err := client.GetFundTop5Holdings(ctx, "KT-Alpha")
Unified Portfolio View

Fetches asset allocation, top 5 holdings, quarterly portfolio, and monthly asset breakdown concurrently:

portfolio, err := client.GetFundPortfolio(ctx, "KT-Alpha")
fmt.Println("Asset allocation:", portfolio.AssetAllocation)
fmt.Println("Top 5 holdings:", portfolio.Top5Holdings)
fmt.Println("Quarterly portfolio:", portfolio.QuarterlyPortfolio)
fmt.Println("Monthly asset breakdown:", portfolio.MonthlyAssetBreakdown)

Pagination

navs, err := sec.FetchAllPages(func(ctx context.Context, cursor string) ([]sec.DailyNAV, string, error) {
    return client.GetDailyNAV(ctx, sec.NAVOptions{
        ProjID:    "PRINCIPALi9",
        StartDate: start,
        EndDate:   end,
        Cursor:    cursor,
    })
})

Batch Operations

Fetch NAV history for multiple funds concurrently with built-in rate limiting:

results := sec.BatchGetNAVs(ctx, client, projIDs, startDate, endDate, sec.BatchNAVOptions{
    Concurrency: 4,
    Progress: func(completed, total int) {
        fmt.Printf("Progress: %d/%d\n", completed, total)
    },
})

for _, r := range results {
    if r.Err != nil {
        log.Printf("%s failed: %v", r.ProjID, r.Err)
        continue
    }
    fmt.Printf("%s: %d NAV records\n", r.ProjID, len(r.NAVs))
}

DateTime Handling

The SEC API returns datetime values in inconsistent formats (e.g., 2026-06-05T15:15:20.9 with fractional seconds but no timezone). The library uses a custom sec.DateTime type that transparently parses RFC3339, fractional-second timestamps, and plain dates (YYYY-MM-DD). You can use .Time() to get a standard time.Time value:

fmt.Println(amc.LastUpdDate.Time())

Rate Limiting

The client enforces a minimum 60ms delay between requests to comply with SEC's rate limits (5,000 calls per 300 seconds). The rate limiter is thread-safe and respects context cancellation.

Error Handling

var (
    sec.ErrRateLimited  // HTTP 429
    sec.ErrNotFound     // HTTP 204
    sec.ErrUnauthorized // HTTP 401 / missing API key
)

Retry behavior:

  • Retries on: 429, 500, 502, 503, 504, network errors
  • Does not retry on: 400, 401, 403, 404
  • Special handling for HTTP 421 with Retry-After header

Language Support

The SEC API returns bilingual fields (e.g., proj_name_th + proj_name_en) and some Thai-only fields. Use WithLanguage to set a client-wide preference, then use helper methods to pick the right value:

client, err := sec.NewClient("key", sec.WithLanguage(sec.LanguageThai))

profile := profiles[0]
fmt.Println(profile.Name(client.Language()))      // Thai or English fund name
fmt.Println(profile.CompanyName(client.Language())) // Thai or English AMC name

For Thai-only fields, use translation helpers (similar to finnomena-go):

fees, _, _ := client.GetMutualFundFees(ctx, sec.FeeOptions{})
sec.TranslateAllFees(fees, true) // true = use English

for _, fee := range fees {
    fmt.Println(fee.FeeTypeDesc) // "Management Fee" instead of "ค่าธรรมเนียมการจัดการ"
}

Supported translations:

  • TranslateFee / TranslateAllFees — fee types and units
  • TranslateFactsheetFee / TranslateAllFactsheetFees
  • TranslateAssetAllocation / TranslateAllAssetAllocations
  • TranslateTop5Holding / TranslateAllTop5Holdings
  • TranslateQuarterlyPortfolio / TranslateAllQuarterlyPortfolios
  • TranslateMonthlyPortfolioAssetType / TranslateAllMonthlyPortfolioAssetTypes
  • TranslateFactsheetBenchmark / TranslateAllFactsheetBenchmarks — benchmark names and remarks

Extend the public FeeTypeTranslation, FeeUnitTranslation, AssetNameTranslation, AssetLiabilityTranslation, and BenchmarkNameTranslation maps to add more translations as you discover them.

CLI Tool

A command-line tool is included for ad-hoc API queries:

go run ./cmd/sec-cli amcs
go run ./cmd/sec-cli profiles --company-info C0000000021
go run ./cmd/sec-cli nav --proj-id M0000_2552 --start 2024-01-01 --end 2024-01-31
go run ./cmd/sec-cli benchmarks --proj-id M0000_2552 --latest
go run ./cmd/sec-cli factsheet-urls --proj-id M0000_2552

The CLI reads API keys from config/sec-keys.json or falls back to the SEC_API_KEY environment variable.

Examples

See examples/:

  • examples/basic/ — list AMCs and get NAV
  • examples/batch/ — fetch NAV history for multiple funds
  • examples/thaifa/ — THAIFA fallback integration pattern

Testing

Run unit tests:

make test

Run all checks (format, lint, test, duplicate code):

make check

For integration tests (requires real API key in config/sec-keys.json):

make test-integration

Project Structure

sec-go/
├── client.go              # Core HTTP client
├── options.go             # Functional options
├── error.go               # Error types
├── rate.go                # Rate limiter
├── retry.go               # Retry logic
├── fund_service.go        # Fund API service methods (all 21 endpoints)
├── bond_service.go        # Bond API service methods (6 endpoints)
├── pvd_service.go         # PVD API service methods (15 endpoints)
├── license_check_service.go # License Check API service methods (16 endpoints)
├── models.go              # V2 response models (includes flexible DateTime parsing)
├── pagination.go          # Pagination helpers
├── batch.go               # Batch/concurrent operations
├── language.go            # Language type, constants, and bilingual field helpers
├── dictionaries.go        # Thai↔English translation maps
├── translate.go           # Struct-specific translation functions
├── dates.go               # Buddhist date conversion + Thai period translation
├── helpers_fund.go        # Fund convenience helpers: SearchFunds, GetFundsByCompany, etc.
├── helpers_bond.go        # Bond convenience helpers: FetchAllBondIssuers, FindBondIssuer, etc.
├── helpers_pvd.go         # PVD convenience helpers: FetchAllPVDs, FindPVD, etc.
├── client_test.go         # Client unit tests
├── fund_service_test.go   # Fund service tests
├── bond_service_test.go   # Bond service tests
├── pvd_service_test.go    # PVD service tests
├── license_check_service_test.go # License Check service tests
├── pagination_test.go     # Pagination tests
├── batch_test.go          # Batch operation tests
├── language_test.go       # Language/translation tests
├── helpers_fund_test.go   # Convenience helper tests
├── integration_test.go    # Real API integration tests
├── internal/
│   ├── cache/             # In-memory cache
│   └── testutil/          # Test helpers
├── config/
│   └── sec-keys.example.json  # API key config template
├── cmd/
│   ├── sec-cli/           # CLI tool for ad-hoc queries
│   └── sec-lookup/        # Debug tool for fund lookups
├── docs/
│   └── v2-schemas/        # Sample responses + API.md
├── examples/              # Usage examples
└── Makefile               # Build tasks

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRateLimited  = errors.New("rate limited")
	ErrNotFound     = errors.New("data not found")
	ErrUnauthorized = errors.New("invalid API key")
)
View Source
var AssetLiabilityTranslation = map[string]string{}/* 132 elements not displayed */

AssetLiabilityTranslation maps common Thai asset/liability category descriptions to English.

View Source
var AssetNameTranslation = map[string]string{
	"หน่วยลงทุน":             "Investment Units",
	"เงินฝากธนาคาร และอื่นๆ": "Bank Deposits and Others",
	"ตราสารหนี้":             "Debt Instruments",
	"หุ้นสามัญ":              "Common Stocks",
	"ทรัพย์สินอื่นๆ":         "Other Assets",
	"เงินสด":                 "Cash",
}

AssetNameTranslation maps common Thai asset type names to English.

View Source
var BenchmarkNameTranslation = map[string]string{
	"ผลการดำเนินงานของกองทุนรวมหลัก":                                                   "Performance of the Master Fund",
	"ดัชนีผลตอบแทนรวมพันธบัตรรัฐบาลอายุไม่เกิน 1 ปี ของสมาคมตลาดตราสารหนี้ไทย":         "ThaiBMA Government Bond 1-Year Total Return Index",
	"ผลตอบแทนรวมสุทธิของดัชนีพันธบัตรรัฐบาลอายุไม่เกิน 1 ปี ของสมาคมตลาดตราสารหนี้ไทย": "ThaiBMA Government Bond 1-Year Total Return Index",
}

BenchmarkNameTranslation maps Thai benchmark name templates to English.

View Source
var BenchmarkRemarkTranslation = map[string]string{
	"ปรับด้วยอัตราแลกเปลี่ยน เพื่อคำนวณผลตอบแทนเป็นสกุลเงินบาท ณ วันที่คำนวณผลตอบแทน":                               "Adjusted with exchange rate to calculate returns in Thai Baht as of the return calculation date",
	"ปรับด้วยต้นทุนการป้องกันความเสี่ยงด้านอัตราแลกเปลี่ยน เพื่อคำนวณผลตอบแทนเป็นสกุลเงินบาท ณ วันที่คำนวณผลตอบแทน": "Adjusted with foreign exchange hedging cost to calculate returns in Thai Baht as of the return calculation date",
}

BenchmarkRemarkTranslation maps Thai benchmark remark templates to English.

View Source
var FeeTypeTranslation = map[string]string{
	"ค่าธรรมเนียมการจัดการ":                                  "Management Fee",
	"ค่าธรรมเนียมผู้ดูแลผลประโยชน์":                          "Trustee Fee",
	"ค่าธรรมเนียมนายทะเบียนหน่วย":                            "Registrar Fee",
	"ค่าธรรมเนียมการขายหน่วยลงทุน (Front-end Fee)":           "Front-end Fee",
	"ค่าธรรมเนียมการรับซื้อคืนหน่วยลงทุน (Back-end Fee)":     "Back-end Fee",
	"ค่าธรรมเนียมการสับเปลี่ยนหน่วยลงทุนเข้า (SWITCHING IN)": "Switch-in Fee",
	"ค่าธรรมเนียมการสับเปลี่ยนหน่วยลงทุนออก (SWITCHING OUT)": "Switch-out Fee",
	"ค่าธรรมเนียมการโอนหน่วยลงทุน":                           "Transfer Fee",
	"ค่าใช้จ่ายอื่นๆ":                                        "Other Fee",
	"ค่าธรรมเนียมและค่าใช้จ่ายรวมทั้งหมด":                    "Total Expense Ratio",
}

FeeTypeTranslation maps Thai fee type descriptions to English. Extend this map for additional fee descriptions returned by the SEC API.

View Source
var FeeUnitTranslation = map[string]string{
	"ต่อปี ของมูลค่าทรัพย์สินสุทธิของกองทุน": "per year of NAV",
	"% ต่อปี": "% per year",
	"บาท":     "baht",
}

FeeUnitTranslation maps Thai fee unit descriptions to English.

View Source
var SubscriptionPeriodTranslation = map[string]string{
	"ทุกวันทำการ":                  "Every Business Day",
	"ทุกวันทำการของตลาดหลักทรัพย์": "Every Stock Exchange Business Day",
	"ทุกวันทำการของธนาคาร":         "Every Banking Day",
	"ทุกวันทำการของสถาบันการเงิน":  "Every Financial Institution Business Day",
	"วันทำการของตลาดหลักทรัพย์":    "Stock Exchange Business Day",
	"วันทำการของธนาคาร":            "Banking Day",
	"วันทำการของสถาบันการเงิน":     "Financial Institution Business Day",
	"วันทำการประจำสัปดาห์":         "Weekly Business Day",
	"ทุกวัน": "Every Day",
}

SubscriptionPeriodTranslation maps Thai subscription/redemption period descriptions to English.

Functions

func ConvertBuddhistDate added in v0.2.1

func ConvertBuddhistDate(dateStr string) string

ConvertBuddhistDate converts a Buddhist calendar date string to Gregorian. Expected input format: "DD/MM/YYYY" where year is Buddhist (e.g., "03/04/2557") Output format: "YYYY-MM-DD" Gregorian (e.g., "2014-04-03") If the year is already Gregorian (< 2500), returns the date converted to ISO format. Returns empty string for invalid/empty input.

func FetchAllPages

func FetchAllPages[T any](ctx context.Context, fetch func(ctx context.Context, cursor string) ([]T, string, error)) ([]T, error)

func IsRetryable

func IsRetryable(statusCode int) bool

func TranslateAllAssetAllocations

func TranslateAllAssetAllocations(allocs []AssetAllocation, useEnglish bool)

TranslateAllAssetAllocations translates every allocation in the slice when useEnglish is true.

func TranslateAllFactsheetBenchmarks added in v0.3.0

func TranslateAllFactsheetBenchmarks(benchmarks []FactsheetBenchmark, useEnglish bool)

TranslateAllFactsheetBenchmarks translates every benchmark in the slice when useEnglish is true.

func TranslateAllFactsheetFees

func TranslateAllFactsheetFees(fees []FactsheetFee, useEnglish bool)

TranslateAllFactsheetFees translates every factsheet fee in the slice when useEnglish is true.

func TranslateAllFactsheetStatistics added in v0.2.1

func TranslateAllFactsheetStatistics(statsList []FactsheetStatistics, useEnglish bool)

TranslateAllFactsheetStatistics translates every statistics record in the slice when useEnglish is true.

func TranslateAllFees

func TranslateAllFees(fees []MutualFundFee, useEnglish bool)

TranslateAllFees translates every fee in the slice when useEnglish is true.

func TranslateAllFundIPOs added in v0.2.1

func TranslateAllFundIPOs(ipos []FundIPO, useEnglish bool)

TranslateAllFundIPOs translates every IPO record in the slice when useEnglish is true.

func TranslateAllMonthlyPortfolioAssetTypes

func TranslateAllMonthlyPortfolioAssetTypes(items []MonthlyPortfolioAssetType, useEnglish bool)

TranslateAllMonthlyPortfolioAssetTypes translates every portfolio item in the slice when useEnglish is true.

func TranslateAllQuarterlyPortfolios

func TranslateAllQuarterlyPortfolios(items []QuarterlyPortfolio, useEnglish bool)

TranslateAllQuarterlyPortfolios translates every portfolio item in the slice when useEnglish is true.

func TranslateAllSubscriptionRedemptionPeriods added in v0.2.1

func TranslateAllSubscriptionRedemptionPeriods(periods []FactsheetSubscriptionRedemptionPeriod, useEnglish bool)

TranslateAllSubscriptionRedemptionPeriods translates every period in the slice when useEnglish is true.

func TranslateAllTop5Holdings

func TranslateAllTop5Holdings(holdings []Top5Holding, useEnglish bool)

TranslateAllTop5Holdings translates every holding in the slice when useEnglish is true.

func TranslateAssetAllocation

func TranslateAssetAllocation(alloc *AssetAllocation, useEnglish bool)

TranslateAssetAllocation translates the Thai asset name on an AssetAllocation to English when useEnglish is true. It mutates the provided allocation in place.

func TranslateBenchmarkName added in v0.3.0

func TranslateBenchmarkName(name string) string

TranslateBenchmarkName translates a Thai benchmark name to English. It handles exact matches and prefix patterns with variable index names.

func TranslateBenchmarkRemark added in v0.3.0

func TranslateBenchmarkRemark(remark string) string

TranslateBenchmarkRemark translates a Thai benchmark remark to English. It handles both exact-match templates and variable-percentage patterns.

func TranslateFactsheetBenchmark added in v0.3.0

func TranslateFactsheetBenchmark(bench *FactsheetBenchmark, useEnglish bool)

TranslateFactsheetBenchmark translates a FactsheetBenchmark to English when useEnglish is true. It mutates the provided benchmark in place.

func TranslateFactsheetFee

func TranslateFactsheetFee(fee *FactsheetFee, useEnglish bool)

TranslateFactsheetFee translates Thai fee descriptions on a FactsheetFee to English when useEnglish is true. It mutates the provided fee in place.

func TranslateFactsheetStatistics added in v0.2.1

func TranslateFactsheetStatistics(stats *FactsheetStatistics, useEnglish bool)

TranslateFactsheetStatistics translates Thai period strings and Buddhist dates in a FactsheetStatistics to English when useEnglish is true. It mutates the provided statistics in place.

func TranslateFee

func TranslateFee(fee *MutualFundFee, useEnglish bool)

TranslateFee translates Thai fee descriptions on a MutualFundFee to English when useEnglish is true. It mutates the provided fee in place.

func TranslateFundIPO added in v0.2.1

func TranslateFundIPO(ipo *FundIPO, useEnglish bool)

TranslateFundIPO translates Buddhist dates in a FundIPO to Gregorian when useEnglish is true. It mutates the provided IPO in place.

func TranslateMonthlyPortfolioAssetType

func TranslateMonthlyPortfolioAssetType(item *MonthlyPortfolioAssetType, useEnglish bool)

TranslateMonthlyPortfolioAssetType translates Thai asset/liability descriptions on a MonthlyPortfolioAssetType to English when useEnglish is true. It mutates the provided item in place.

func TranslateQuarterlyPortfolio

func TranslateQuarterlyPortfolio(item *QuarterlyPortfolio, useEnglish bool)

TranslateQuarterlyPortfolio translates Thai asset/liability descriptions on a QuarterlyPortfolio to English when useEnglish is true. It mutates the provided item in place.

func TranslateSubscriptionRedemptionPeriod added in v0.2.1

func TranslateSubscriptionRedemptionPeriod(period *FactsheetSubscriptionRedemptionPeriod, useEnglish bool)

TranslateSubscriptionRedemptionPeriod translates the Thai period description on a FactsheetSubscriptionRedemptionPeriod to English when useEnglish is true. It mutates the provided period in place.

func TranslateThaiPeriod added in v0.2.1

func TranslateThaiPeriod(period string) string

TranslateThaiPeriod converts Thai period descriptions to English. Input examples: "3 ปี 3 เดือน", "1 เดือน 13 วัน", "6 เดือน", "15 วัน", "ไม่มี", "-" Output examples: "3 years 3 months", "1 month 13 days", "6 months", "15 days", "None", "-" Returns the original string if it does not match expected Thai patterns.

func TranslateTop5Holding

func TranslateTop5Holding(holding *Top5Holding, useEnglish bool)

TranslateTop5Holding translates the Thai asset name on a Top5Holding to English when useEnglish is true. It mutates the provided holding in place.

Types

type AMC

type AMC struct {
	UniqueID    string   `json:"unique_id"`
	CompNameTH  string   `json:"comp_name_th"`
	CompNameEN  string   `json:"comp_name_en"`
	LastUpdDate DateTime `json:"last_upd_date"`
}

func (AMC) Name

func (a AMC) Name(lang Language) string

Name returns the company name in the client's preferred language. Falls back to the other language if the preferred one is empty.

type APIError

type APIError struct {
	StatusCode int
	Message    string
	RawBody    []byte
}

func (*APIError) Error

func (e *APIError) Error() string

type AssetAllocation

type AssetAllocation struct {
	ProjID         string   `json:"proj_id"`
	StartDate      string   `json:"start_date"`
	EndDate        string   `json:"end_date"`
	ProspectusType string   `json:"prospectus_type"`
	AssetSeq       int      `json:"asset_seq"`
	AssetName      string   `json:"asset_name"`
	AssetRatio     float64  `json:"asset_ratio"`
	LastUpdDate    DateTime `json:"last_upd_date"`
}

type BatchFundProfileResult

type BatchFundProfileResult struct {
	ProjID  string
	Profile *FundProfile
	Err     error
}

func BatchGetFundProfiles

func BatchGetFundProfiles(ctx context.Context, c *Client, projIDs []string, opts BatchProfileOptions) []BatchFundProfileResult

type BatchNAVOptions

type BatchNAVOptions struct {
	Concurrency int
	Progress    func(completed, total int)
}

type BatchNAVResult

type BatchNAVResult struct {
	ProjID string
	NAVs   []DailyNAV
	Err    error
}

func BatchGetNAVs

func BatchGetNAVs(ctx context.Context, c *Client, projIDs []string, startDate, endDate time.Time, opts BatchNAVOptions) []BatchNAVResult

type BatchProfileOptions

type BatchProfileOptions struct {
	Concurrency int
	Progress    func(completed, total int)
}

type BondCreditRating added in v0.5.0

type BondCreditRating struct {
	ProjID       string   `json:"proj_id"`
	Period       int      `json:"period"`
	RatingAgency string   `json:"rating_agency"`
	Rating       string   `json:"rating"`
	Outlook      string   `json:"outlook"`
	AsOfDate     string   `json:"as_of_date"`
	LastUpdDate  DateTime `json:"last_upd_date"`
}

BondCreditRating represents credit ratings for bonds by time period.

type BondFeature added in v0.5.0

type BondFeature struct {
	ProjID         string   `json:"proj_id"`
	ProjNameTH     string   `json:"proj_name_th"`
	ProjNameEN     string   `json:"proj_name_en"`
	ProjAbbrName   string   `json:"proj_abbr_name"`
	IssueDate      string   `json:"issue_date"`
	MaturityDate   string   `json:"maturity_date"`
	CouponRate     float64  `json:"coupon_rate"`
	FaceValue      float64  `json:"face_value"`
	IssueValue     float64  `json:"issue_value"`
	BondType       string   `json:"bond_type"`
	BondSubType    string   `json:"bond_sub_type"`
	SecuredFlag    string   `json:"secured_flag"`
	GuaranteeFlag  string   `json:"guarantee_flag"`
	CollateralDesc string   `json:"collateral_desc"`
	PurposeTH      string   `json:"purpose_th"`
	PurposeEN      string   `json:"purpose_en"`
	RemarkTH       string   `json:"remark_th"`
	RemarkEN       string   `json:"remark_en"`
	LastUpdDate    DateTime `json:"last_upd_date"`
}

BondFeature represents bond specifications and features.

type BondFeatureOptions added in v0.5.0

type BondFeatureOptions struct {
	PageSize int
	Cursor   string
	ProjID   string
}

BondFeatureOptions defines query options for GetBondFeatures.

type BondInvestorHolding added in v0.5.0

type BondInvestorHolding struct {
	ProjID       string  `json:"proj_id"`
	Period       int     `json:"period"`
	InvestorType string  `json:"investor_type"`
	HoldingQty   float64 `json:"holding_qty"`
	HoldingVal   float64 `json:"holding_val"`
	HoldingPct   float64 `json:"holding_pct"`
	LastUpdDate  string  `json:"last_upd_date"`
}

BondInvestorHolding represents investor holdings by type.

type BondIssuer added in v0.5.0

type BondIssuer struct {
	UniqueID    string   `json:"unique_id"`
	CompNameTH  string   `json:"comp_name_th"`
	CompNameEN  string   `json:"comp_name_en"`
	LastUpdDate DateTime `json:"last_upd_date"`
}

BondIssuer represents a bond issuer/AMC from the getAmcList endpoint.

type BondIssuerOptions added in v0.5.0

type BondIssuerOptions struct {
	PageSize int
	Cursor   string
}

BondIssuerOptions defines query options for ListBondIssuers.

type BondOutstanding added in v0.5.0

type BondOutstanding struct {
	ProjID         string  `json:"proj_id"`
	Period         int     `json:"period"`
	OutstandingQty float64 `json:"outstanding_qty"`
	OutstandingVal float64 `json:"outstanding_val"`
	HeldByInvestor float64 `json:"held_by_investor"`
	HeldByIssuer   float64 `json:"held_by_issuer"`
	LastUpdDate    string  `json:"last_upd_date"`
}

BondOutstanding represents outstanding values by time period.

type BondPeriodOptions added in v0.5.0

type BondPeriodOptions struct {
	PageSize    int
	Cursor      string
	ProjID      string
	StartPeriod int
	EndPeriod   int
}

BondPeriodOptions defines query options for bond endpoints that filter by period.

type BondRelatedParty added in v0.5.0

type BondRelatedParty struct {
	ProjID      string   `json:"proj_id"`
	Period      int      `json:"period"`
	PartyType   string   `json:"party_type"`
	PartyNameTH string   `json:"party_name_th"`
	PartyNameEN string   `json:"party_name_en"`
	LastUpdDate DateTime `json:"last_upd_date"`
}

BondRelatedParty represents related parties by time period.

type BondSaleRepOptions added in v0.5.0

type BondSaleRepOptions struct {
	PageSize  int
	Cursor    string
	LicenseNo string
	RepName   string
}

BondSaleRepOptions defines query options for bond sale representatives.

type CGPCodeOfConduct added in v0.5.0

type CGPCodeOfConduct struct {
	LastUpdDate DateTime `json:"last_upd_date"`
	ReportYear  string   `json:"report_year"`
	UniqueID    string   `json:"unique_id"`
}

CGPCodeOfConduct represents business code of conduct.

type CGPDirector added in v0.5.0

type CGPDirector struct {
	LastUpdDate DateTime `json:"last_upd_date"`
	ReportYear  string   `json:"report_year"`
	UniqueID    string   `json:"unique_id"`
}

CGPDirector represents director policies and practices.

type CGPGovernance added in v0.5.0

type CGPGovernance struct {
	LastUpdDate DateTime `json:"last_upd_date"`
	ReportYear  string   `json:"report_year"`
	UniqueID    string   `json:"unique_id"`
}

CGPGovernance represents corporate governance policy.

type CGSAuditorCompany added in v0.5.0

type CGSAuditorCompany struct {
	LastUpdDate DateTime `json:"last_upd_date"`
	ReportYear  string   `json:"report_year"`
	UniqueID    string   `json:"unique_id"`
}

CGSAuditorCompany represents auditor company information.

type CGSBoard added in v0.5.0

type CGSBoard struct {
	LastUpdDate DateTime `json:"last_upd_date"`
	ReportYear  string   `json:"report_year"`
	UniqueID    string   `json:"unique_id"`
}

CGSBoard represents board composition.

type CGSBods added in v0.5.0

type CGSBods struct {
	LastUpdDate DateTime `json:"last_upd_date"`
	ReportYear  string   `json:"report_year"`
	UniqueID    string   `json:"unique_id"`
}

CGSBods represents board of directors information.

type CGSCommitteesOthers added in v0.5.0

type CGSCommitteesOthers struct {
	LastUpdDate DateTime `json:"last_upd_date"`
	ReportYear  string   `json:"report_year"`
	UniqueID    string   `json:"unique_id"`
}

CGSCommitteesOthers represents other committees information.

type CGSDirectorPerformance added in v0.5.0

type CGSDirectorPerformance struct {
	LastUpdDate DateTime `json:"last_upd_date"`
	ReportYear  string   `json:"report_year"`
	UniqueID    string   `json:"unique_id"`
}

CGSDirectorPerformance represents board meeting attendance.

type CGSEmployee added in v0.5.0

type CGSEmployee struct {
	LastUpdDate DateTime `json:"last_upd_date"`
	ReportYear  string   `json:"report_year"`
	UniqueID    string   `json:"unique_id"`
}

CGSEmployee represents employee information.

type CGSExecutives added in v0.5.0

type CGSExecutives struct {
	LastUpdDate DateTime `json:"last_upd_date"`
	ReportYear  string   `json:"report_year"`
	UniqueID    string   `json:"unique_id"`
}

CGSExecutives represents executive information.

type Client

type Client struct {
	// contains filtered or unexported fields
}

func ClientFromEnv

func ClientFromEnv(opts ...Option) (*Client, error)

func NewClient

func NewClient(apiKey string, opts ...Option) (*Client, error)

func (*Client) CheckAcquirers added in v0.5.0

func (c *Client) CheckAcquirers(ctx context.Context, opts LicenseCheckOptions) ([]LicenseCheckResult, string, error)

CheckAcquirers checks acquirer licenses.

func (*Client) CheckAuditors added in v0.5.0

func (c *Client) CheckAuditors(ctx context.Context, opts LicenseCheckOptions) ([]LicenseCheckResult, string, error)

CheckAuditors checks auditor licenses.

func (*Client) CheckBondSaleReps added in v0.5.0

func (c *Client) CheckBondSaleReps(ctx context.Context, opts BondSaleRepOptions) ([]LicenseCheckResult, string, error)

CheckBondSaleReps checks bond sale representative licenses.

func (*Client) CheckCreditRatingCompanies added in v0.5.0

func (c *Client) CheckCreditRatingCompanies(ctx context.Context, opts LicenseCheckOptions) ([]LicenseCheckResult, string, error)

CheckCreditRatingCompanies checks credit rating company licenses.

func (*Client) CheckDerivativesBrokers added in v0.5.0

func (c *Client) CheckDerivativesBrokers(ctx context.Context, opts LicenseCheckOptions) ([]LicenseCheckResult, string, error)

CheckDerivativesBrokers checks derivatives broker licenses.

func (*Client) CheckDerivativesCompanies added in v0.5.0

func (c *Client) CheckDerivativesCompanies(ctx context.Context, opts LicenseCheckOptions) ([]LicenseCheckResult, string, error)

CheckDerivativesCompanies checks derivatives company licenses.

func (*Client) CheckDerivativesFundManagers added in v0.5.0

func (c *Client) CheckDerivativesFundManagers(ctx context.Context, opts LicenseCheckOptions) ([]LicenseCheckResult, string, error)

CheckDerivativesFundManagers checks derivatives fund manager licenses.

func (*Client) CheckFinancialAdvisors added in v0.5.0

func (c *Client) CheckFinancialAdvisors(ctx context.Context, opts LicenseCheckOptions) ([]LicenseCheckResult, string, error)

CheckFinancialAdvisors checks financial advisor licenses.

func (*Client) CheckFundSupervisors added in v0.5.0

func (c *Client) CheckFundSupervisors(ctx context.Context, opts LicenseCheckOptions) ([]LicenseCheckResult, string, error)

CheckFundSupervisors checks fund supervisor licenses.

func (*Client) CheckInvestmentAdvisors added in v0.5.0

func (c *Client) CheckInvestmentAdvisors(ctx context.Context, opts LicenseCheckOptions) ([]LicenseCheckResult, string, error)

CheckInvestmentAdvisors checks investment advisor licenses.

func (*Client) CheckPrivateFunds added in v0.5.0

func (c *Client) CheckPrivateFunds(ctx context.Context, opts LicenseCheckOptions) ([]LicenseCheckResult, string, error)

CheckPrivateFunds checks private fund licenses.

func (*Client) CheckSecuritiesBorrowingLending added in v0.5.0

func (c *Client) CheckSecuritiesBorrowingLending(ctx context.Context, opts LicenseCheckOptions) ([]LicenseCheckResult, string, error)

CheckSecuritiesBorrowingLending checks securities borrowing & lending licenses.

func (*Client) CheckSecuritiesBrokers added in v0.5.0

func (c *Client) CheckSecuritiesBrokers(ctx context.Context, opts LicenseCheckOptions) ([]LicenseCheckResult, string, error)

CheckSecuritiesBrokers checks securities broker licenses.

func (*Client) CheckSecuritiesCompanies added in v0.5.0

func (c *Client) CheckSecuritiesCompanies(ctx context.Context, opts SecuritiesCompanyOptions) ([]LicenseCheckResult, string, error)

CheckSecuritiesCompanies checks securities company licenses.

func (*Client) CheckSecuritiesFundManagers added in v0.5.0

func (c *Client) CheckSecuritiesFundManagers(ctx context.Context, opts LicenseCheckOptions) ([]LicenseCheckResult, string, error)

CheckSecuritiesFundManagers checks securities fund manager licenses.

func (*Client) CheckVentureCapitals added in v0.5.0

func (c *Client) CheckVentureCapitals(ctx context.Context, opts LicenseCheckOptions) ([]LicenseCheckResult, string, error)

CheckVentureCapitals checks venture capital licenses.

func (*Client) FetchAllBondFeatures added in v0.5.0

func (c *Client) FetchAllBondFeatures(ctx context.Context, opts BondFeatureOptions) ([]BondFeature, error)

FetchAllBondFeatures returns all bond features across every page.

func (*Client) FetchAllBondIssuers added in v0.5.0

func (c *Client) FetchAllBondIssuers(ctx context.Context) ([]BondIssuer, error)

FetchAllBondIssuers returns all bond issuers across every page.

func (*Client) FetchAllPVDFundInfo added in v0.5.0

func (c *Client) FetchAllPVDFundInfo(ctx context.Context, opts PVDProjOptions) ([]PVDFundInfo, error)

FetchAllPVDFundInfo returns all PVD fund info across every page.

func (*Client) FetchAllPVDs added in v0.5.0

func (c *Client) FetchAllPVDs(ctx context.Context) ([]PVDListItem, error)

FetchAllPVDs returns all provident funds across every page.

func (*Client) FindAMC

func (c *Client) FindAMC(ctx context.Context, query string) (*AMC, error)

FindAMC searches AMCs by Thai name, English name, or unique_id.

func (*Client) FindBondIssuer added in v0.5.0

func (c *Client) FindBondIssuer(ctx context.Context, query string) (*BondIssuer, error)

FindBondIssuer searches bond issuers by Thai name, English name, or unique_id.

func (*Client) FindPVD added in v0.5.0

func (c *Client) FindPVD(ctx context.Context, query string) (*PVDListItem, error)

FindPVD searches provident funds by Thai name, English name, or unique_id.

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string) ([]byte, error)

func (*Client) GetAssetAllocation

func (c *Client) GetAssetAllocation(ctx context.Context, opts FactsheetOptions) ([]AssetAllocation, string, error)

func (*Client) GetBondCreditRatings added in v0.5.0

func (c *Client) GetBondCreditRatings(ctx context.Context, opts BondPeriodOptions) ([]BondCreditRating, string, error)

GetBondCreditRatings returns credit ratings for bonds by time period.

func (*Client) GetBondFeatures added in v0.5.0

func (c *Client) GetBondFeatures(ctx context.Context, opts BondFeatureOptions) ([]BondFeature, string, error)

GetBondFeatures returns bond specifications and features.

func (*Client) GetBondInvestorHoldings added in v0.5.0

func (c *Client) GetBondInvestorHoldings(ctx context.Context, opts BondPeriodOptions) ([]BondInvestorHolding, string, error)

GetBondInvestorHoldings returns investor holdings by type.

func (*Client) GetBondOutstanding added in v0.5.0

func (c *Client) GetBondOutstanding(ctx context.Context, opts BondPeriodOptions) ([]BondOutstanding, string, error)

GetBondOutstanding returns outstanding values by time period.

func (*Client) GetBondRelatedParties added in v0.5.0

func (c *Client) GetBondRelatedParties(ctx context.Context, opts BondPeriodOptions) ([]BondRelatedParty, string, error)

GetBondRelatedParties returns related parties by time period.

func (*Client) GetCGPCodeOfConduct added in v0.5.0

func (c *Client) GetCGPCodeOfConduct(ctx context.Context, reportYear, uniqueID string) ([]CGPCodeOfConduct, error)

GetCGPCodeOfConduct returns business code of conduct.

func (*Client) GetCGPDirector added in v0.5.0

func (c *Client) GetCGPDirector(ctx context.Context, reportYear, uniqueID string) ([]CGPDirector, error)

GetCGPDirector returns director policies and practices.

func (*Client) GetCGPGovernance added in v0.5.0

func (c *Client) GetCGPGovernance(ctx context.Context, reportYear, uniqueID string) ([]CGPGovernance, error)

GetCGPGovernance returns corporate governance policy.

func (*Client) GetCGSAuditorCompany added in v0.5.0

func (c *Client) GetCGSAuditorCompany(ctx context.Context, reportYear, uniqueID string) ([]CGSAuditorCompany, error)

GetCGSAuditorCompany returns auditor company information.

func (*Client) GetCGSBoard added in v0.5.0

func (c *Client) GetCGSBoard(ctx context.Context, reportYear, uniqueID string) ([]CGSBoard, error)

GetCGSBoard returns board composition.

func (*Client) GetCGSBods added in v0.5.0

func (c *Client) GetCGSBods(ctx context.Context, reportYear, uniqueID string) ([]CGSBods, error)

GetCGSBods returns board of directors information.

func (*Client) GetCGSCommitteesOthers added in v0.5.0

func (c *Client) GetCGSCommitteesOthers(ctx context.Context, reportYear, uniqueID string) ([]CGSCommitteesOthers, error)

GetCGSCommitteesOthers returns other committees information.

func (*Client) GetCGSDirectorPerformance added in v0.5.0

func (c *Client) GetCGSDirectorPerformance(ctx context.Context, reportYear, uniqueID string) ([]CGSDirectorPerformance, error)

GetCGSDirectorPerformance returns board meeting attendance.

func (*Client) GetCGSEmployee added in v0.5.0

func (c *Client) GetCGSEmployee(ctx context.Context, reportYear, uniqueID string) ([]CGSEmployee, error)

GetCGSEmployee returns employee information.

func (*Client) GetCGSExecutives added in v0.5.0

func (c *Client) GetCGSExecutives(ctx context.Context, reportYear, uniqueID string) ([]CGSExecutives, error)

GetCGSExecutives returns executive information.

func (*Client) GetDailyNAV

func (c *Client) GetDailyNAV(ctx context.Context, opts NAVOptions) ([]DailyNAV, string, error)

func (*Client) GetDigitalAssetIntermediaries added in v0.5.0

func (c *Client) GetDigitalAssetIntermediaries(ctx context.Context, req DigitalAssetIntermediaryRequest) ([]DigitalAssetIntermediary, error)

GetDigitalAssetIntermediaries returns digital asset intermediary profiles. Pass an empty IntermediaryName to list all intermediaries.

func (*Client) GetDividendHistory

func (c *Client) GetDividendHistory(ctx context.Context, opts DividendHistoryOptions) ([]DividendHistory, string, error)

func (*Client) GetFactsheetBenchmarks

func (c *Client) GetFactsheetBenchmarks(ctx context.Context, opts FactsheetOptions) ([]FactsheetBenchmark, string, error)

func (*Client) GetFactsheetDividendPolicy

func (c *Client) GetFactsheetDividendPolicy(ctx context.Context, opts FactsheetOptions) ([]FundDividendPolicy, string, error)

func (*Client) GetFactsheetFees

func (c *Client) GetFactsheetFees(ctx context.Context, opts FactsheetOptions) ([]FactsheetFee, string, error)

func (*Client) GetFactsheetPerformance

func (c *Client) GetFactsheetPerformance(ctx context.Context, opts FactsheetOptions) ([]FactsheetPerformance, string, error)

func (*Client) GetFactsheetStatistics

func (c *Client) GetFactsheetStatistics(ctx context.Context, opts FactsheetOptions) ([]FactsheetStatistics, string, error)

func (*Client) GetFactsheetSubscriptionRedemptionMinimums

func (c *Client) GetFactsheetSubscriptionRedemptionMinimums(ctx context.Context, opts FactsheetOptions) ([]FactsheetSubscriptionRedemptionMinimum, string, error)

func (*Client) GetFactsheetSubscriptionRedemptionPeriods

func (c *Client) GetFactsheetSubscriptionRedemptionPeriods(ctx context.Context, opts FactsheetOptions) ([]FactsheetSubscriptionRedemptionPeriod, string, error)

func (*Client) GetFinancialStatement added in v0.5.0

func (c *Client) GetFinancialStatement(ctx context.Context, reportYear, uniqueID string) ([]FinancialStatement, error)

GetFinancialStatement returns financial statements and ratios.

func (*Client) GetFundAssetAllocation

func (c *Client) GetFundAssetAllocation(ctx context.Context, projID string) ([]AssetAllocation, error)

GetFundAssetAllocation returns the latest asset allocation for a single fund.

func (*Client) GetFundFactsheetFees

func (c *Client) GetFundFactsheetFees(ctx context.Context, projID string) ([]FactsheetFee, error)

GetFundFactsheetFees returns the latest factsheet fees for a single fund.

func (*Client) GetFundFactsheetURLs

func (c *Client) GetFundFactsheetURLs(ctx context.Context, opts FeeOptions) ([]FundFactsheetURL, string, error)

func (*Client) GetFundIPOs

func (c *Client) GetFundIPOs(ctx context.Context, opts FactsheetOptions) ([]FundIPO, string, error)

func (*Client) GetFundInvolveParties

func (c *Client) GetFundInvolveParties(ctx context.Context, opts InvolvePartyOptions) ([]FundInvolveParty, string, error)

func (*Client) GetFundLatestNAV

func (c *Client) GetFundLatestNAV(ctx context.Context, projID string) (*DailyNAV, error)

GetFundLatestNAV returns the most recent NAV for a single fund.

func (*Client) GetFundPortfolio

func (c *Client) GetFundPortfolio(ctx context.Context, projID string) (*FundPortfolioView, error)

GetFundPortfolio fetches asset allocation, top 5 holdings, quarterly portfolio, and monthly asset breakdown concurrently for a single fund.

func (*Client) GetFundProfile

func (c *Client) GetFundProfile(ctx context.Context, projID string) (*FundProfile, error)

GetFundProfile returns the latest profile for a single fund.

func (*Client) GetFundProfiles

func (c *Client) GetFundProfiles(ctx context.Context, opts ProfileOptions) ([]FundProfile, string, error)

func (*Client) GetFundRiskSpectrum

func (c *Client) GetFundRiskSpectrum(ctx context.Context, projID string) (*RiskSpectrum, error)

GetFundRiskSpectrum returns the latest risk spectrum for a single fund.

func (*Client) GetFundSpecifications

func (c *Client) GetFundSpecifications(ctx context.Context, opts FeeOptions) ([]FundSpecification, string, error)

func (*Client) GetFundTop5Holdings

func (c *Client) GetFundTop5Holdings(ctx context.Context, projID string) ([]Top5Holding, error)

GetFundTop5Holdings returns the latest top 5 holdings for a single fund.

func (*Client) GetFundsByCompany

func (c *Client) GetFundsByCompany(ctx context.Context, companyName string) ([]FundProfile, error)

GetFundsByCompany returns all fund profiles for a given AMC name or unique_id.

func (*Client) GetMonthlyPortfolioAssetType

func (c *Client) GetMonthlyPortfolioAssetType(ctx context.Context, opts OutstandingOptions) ([]MonthlyPortfolioAssetType, string, error)

func (*Client) GetMutualFundFees

func (c *Client) GetMutualFundFees(ctx context.Context, opts FeeOptions) ([]MutualFundFee, string, error)

func (*Client) GetPVDFundAssets added in v0.5.0

func (c *Client) GetPVDFundAssets(ctx context.Context, opts PVDPeriodOptions) ([]PVDFundAsset, string, error)

GetPVDFundAssets returns provident fund asset allocation.

func (*Client) GetPVDFundBenchmarks added in v0.5.0

func (c *Client) GetPVDFundBenchmarks(ctx context.Context, opts PVDPeriodOptions) ([]PVDFundBenchmark, string, error)

GetPVDFundBenchmarks returns provident fund benchmark comparisons.

func (*Client) GetPVDFundCompliance added in v0.5.0

func (c *Client) GetPVDFundCompliance(ctx context.Context, opts PVDPeriodOptions) ([]PVDFundCompliance, string, error)

GetPVDFundCompliance returns provident fund compliance data.

func (*Client) GetPVDFundContributions added in v0.5.0

func (c *Client) GetPVDFundContributions(ctx context.Context, opts PVDPeriodOptions) ([]PVDFundContribution, string, error)

GetPVDFundContributions returns provident fund contribution records.

func (*Client) GetPVDFundDividends added in v0.5.0

func (c *Client) GetPVDFundDividends(ctx context.Context, opts PVDProjOptions) ([]PVDFundDividend, string, error)

GetPVDFundDividends returns provident fund dividend history.

func (*Client) GetPVDFundExpenses added in v0.5.0

func (c *Client) GetPVDFundExpenses(ctx context.Context, opts PVDPeriodOptions) ([]PVDFundExpense, string, error)

GetPVDFundExpenses returns provident fund expense data.

func (*Client) GetPVDFundFees added in v0.5.0

func (c *Client) GetPVDFundFees(ctx context.Context, opts PVDProjOptions) ([]PVDFundFee, string, error)

GetPVDFundFees returns provident fund fee structures.

func (*Client) GetPVDFundInfo added in v0.5.0

func (c *Client) GetPVDFundInfo(ctx context.Context, opts PVDProjOptions) ([]PVDFundInfo, string, error)

GetPVDFundInfo returns provident fund information.

func (*Client) GetPVDFundLiquidity added in v0.5.0

func (c *Client) GetPVDFundLiquidity(ctx context.Context, opts PVDPeriodOptions) ([]PVDFundLiquidity, string, error)

GetPVDFundLiquidity returns provident fund liquidity metrics.

func (*Client) GetPVDFundMembers added in v0.5.0

func (c *Client) GetPVDFundMembers(ctx context.Context, opts PVDPeriodOptions) ([]PVDFundMember, string, error)

GetPVDFundMembers returns provident fund member statistics.

func (*Client) GetPVDFundPerformance added in v0.5.0

func (c *Client) GetPVDFundPerformance(ctx context.Context, opts PVDPeriodOptions) ([]PVDFundPerformance, string, error)

GetPVDFundPerformance returns provident fund performance data.

func (*Client) GetPVDFundPolicies added in v0.5.0

func (c *Client) GetPVDFundPolicies(ctx context.Context, opts PVDProjOptions) ([]PVDFundPolicy, string, error)

GetPVDFundPolicies returns provident fund investment policies.

func (*Client) GetPVDFundSpecs added in v0.5.0

func (c *Client) GetPVDFundSpecs(ctx context.Context, opts PVDProjOptions) ([]PVDFundSpec, string, error)

GetPVDFundSpecs returns provident fund specifications.

func (*Client) GetPVDFundTransactions added in v0.5.0

func (c *Client) GetPVDFundTransactions(ctx context.Context, opts PVDPeriodOptions) ([]PVDFundTransaction, string, error)

GetPVDFundTransactions returns provident fund transaction data.

func (*Client) GetQuarterlyPortfolio

func (c *Client) GetQuarterlyPortfolio(ctx context.Context, opts OutstandingOptions) ([]QuarterlyPortfolio, string, error)

func (*Client) GetRiskSpectrum

func (c *Client) GetRiskSpectrum(ctx context.Context, opts FactsheetOptions) ([]RiskSpectrum, string, error)

func (*Client) GetSBOExportIncome added in v0.5.0

func (c *Client) GetSBOExportIncome(ctx context.Context, reportYear, uniqueID string) ([]SBOExportIncome, error)

GetSBOExportIncome returns export income structure.

func (*Client) GetSBOInfo added in v0.5.0

func (c *Client) GetSBOInfo(ctx context.Context, reportYear, language string) ([]SBOInfo, error)

GetSBOInfo returns general company information. Language: "T" for Thai, "E" for English.

func (*Client) GetSBOProductIncome added in v0.5.0

func (c *Client) GetSBOProductIncome(ctx context.Context, reportYear, uniqueID string) ([]SBOProductIncome, error)

GetSBOProductIncome returns product income structure.

func (*Client) GetSBORD added in v0.5.0

func (c *Client) GetSBORD(ctx context.Context, reportYear, uniqueID string) ([]SBORD, error)

GetSBORD returns R&D information for a company.

func (*Client) GetSBORisk added in v0.5.0

func (c *Client) GetSBORisk(ctx context.Context, reportYear, uniqueID string) ([]SBORisk, error)

GetSBORisk returns risk management details.

func (*Client) GetSCPCSRActivity added in v0.5.0

func (c *Client) GetSCPCSRActivity(ctx context.Context, reportYear, uniqueID string) ([]SCPCSRActivity, error)

GetSCPCSRActivity returns CSR activities.

func (*Client) GetSCPEmployeeDevelopment added in v0.5.0

func (c *Client) GetSCPEmployeeDevelopment(ctx context.Context, reportYear, uniqueID string) ([]SCPEmployeeDevelopment, error)

GetSCPEmployeeDevelopment returns training and safety information.

func (*Client) GetSCPEmployeeInfo added in v0.5.0

func (c *Client) GetSCPEmployeeInfo(ctx context.Context, reportYear, uniqueID string) ([]SCPEmployeeInfo, error)

GetSCPEmployeeInfo returns employee and compensation information.

func (*Client) GetSCPLaborDispute added in v0.5.0

func (c *Client) GetSCPLaborDispute(ctx context.Context, reportYear, uniqueID string) ([]SCPLaborDispute, error)

GetSCPLaborDispute returns labor dispute information.

func (*Client) GetSustainabilityDetail added in v0.5.0

func (c *Client) GetSustainabilityDetail(ctx context.Context, reportYear, uniqueID string) ([]SustainabilityDetail, error)

GetSustainabilityDetail returns sustainability policy and targets.

func (*Client) GetSustainabilityEnvironmentIssue added in v0.5.0

func (c *Client) GetSustainabilityEnvironmentIssue(ctx context.Context, reportYear, uniqueID string) ([]SustainabilityEnvironmentIssue, error)

GetSustainabilityEnvironmentIssue returns environmental issues.

func (*Client) GetSustainabilityHumanRightsIssue added in v0.5.0

func (c *Client) GetSustainabilityHumanRightsIssue(ctx context.Context, reportYear, uniqueID string) ([]SustainabilityHumanRightsIssue, error)

GetSustainabilityHumanRightsIssue returns human rights issues.

func (*Client) GetTop5Holdings

func (c *Client) GetTop5Holdings(ctx context.Context, opts FactsheetOptions) ([]Top5Holding, string, error)

func (*Client) Language

func (c *Client) Language() Language

func (*Client) ListAMCs

func (c *Client) ListAMCs(ctx context.Context, pageSize int, cursor string) ([]AMC, string, error)

func (*Client) ListBondIssuers added in v0.5.0

func (c *Client) ListBondIssuers(ctx context.Context, opts BondIssuerOptions) ([]BondIssuer, string, error)

ListBondIssuers returns the list of bond issuers (AMCs).

func (*Client) ListPVDs added in v0.5.0

func (c *Client) ListPVDs(ctx context.Context, opts PVDListOptions) ([]PVDListItem, string, error)

ListPVDs returns the list of provident funds.

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, payload []byte) ([]byte, error)

func (*Client) SearchFunds

func (c *Client) SearchFunds(ctx context.Context, query string) ([]FundProfile, error)

SearchFunds searches across proj_id, proj_name_th, proj_name_en, and proj_abbr_name.

func (*Client) UsePrimaryKey

func (c *Client) UsePrimaryKey()

func (*Client) UseSecondaryKey

func (c *Client) UseSecondaryKey()

type DailyNAV

type DailyNAV struct {
	ProjID        string   `json:"proj_id"`
	UniqueID      string   `json:"unique_id"`
	FundClassName string   `json:"fund_class_name"`
	NavDate       string   `json:"nav_date"`
	NetAsset      float64  `json:"net_asset"`
	LastVal       float64  `json:"last_val"`
	SellPrice     float64  `json:"sell_price"`
	BuyPrice      float64  `json:"buy_price"`
	SellSwapPrice float64  `json:"sell_swap_price"`
	BuySwapPrice  float64  `json:"buy_swap_price"`
	LastUpdDate   DateTime `json:"last_upd_date"`
}

type DateTime

type DateTime struct {
	time.Time
}

DateTime is a flexible time.Time that parses multiple SEC datetime formats.

func (DateTime) MarshalJSON

func (dt DateTime) MarshalJSON() ([]byte, error)

func (*DateTime) UnmarshalJSON

func (dt *DateTime) UnmarshalJSON(data []byte) error

type DigitalAssetIntermediary added in v0.5.0

type DigitalAssetIntermediary struct {
	UniqueID      string `json:"unique_id"`
	NameTH        string `json:"name_th"`
	NameEN        string `json:"name_en"`
	LicCode       string `json:"lic_code"`
	LicActionCode string `json:"lic_action_code"`
	LicEffDate    string `json:"lic_efft_date"`
	LicActDate    string `json:"lic_act_date"`
	LicExpDate    string `json:"lic_exp_date"`
}

DigitalAssetIntermediary represents a digital asset intermediary profile.

type DigitalAssetIntermediaryRequest added in v0.5.0

type DigitalAssetIntermediaryRequest struct {
	IntermediaryName string `json:"IntermediaryName"`
}

DigitalAssetIntermediaryRequest represents the request body for searching digital asset intermediaries.

type DividendHistory

type DividendHistory struct {
	ProjID        string   `json:"proj_id"`
	UniqueID      string   `json:"unique_id"`
	ClassAbbrName string   `json:"class_abbr_name"`
	BookCloseDate string   `json:"book_close_date"`
	DividendDate  string   `json:"dividend_date"`
	DividendValue float64  `json:"dividend_value"`
	LastUpdDate   DateTime `json:"last_upd_date"`
}

type DividendHistoryOptions

type DividendHistoryOptions struct {
	PageSize      int
	Cursor        string
	ProjID        string
	StartDate     time.Time
	EndDate       time.Time
	ClassAbbrName string
}

type FactsheetBenchmark

type FactsheetBenchmark struct {
	ProjID         string   `json:"proj_id"`
	StartDate      string   `json:"start_date"`
	EndDate        string   `json:"end_date"`
	ProspectusType string   `json:"prospectus_type"`
	GroupSeq       int      `json:"group_seq"`
	Benchmark      string   `json:"benchmark"`
	Remark         string   `json:"benchmark_remark"`
	LastUpdDate    DateTime `json:"last_upd_date"`
}

type FactsheetFee

type FactsheetFee struct {
	ProjID         string   `json:"proj_id"`
	FundClassName  string   `json:"fund_class_name"`
	StartDate      string   `json:"start_date"`
	EndDate        string   `json:"end_date"`
	ProspectusType string   `json:"prospectus_type"`
	FeeTypeDesc    string   `json:"fee_type_desc"`
	Rate           float64  `json:"rate"`
	ActualValue    float64  `json:"actual_value"`
	FeeOtherDesc   string   `json:"fee_other_desc"`
	LastUpdDate    DateTime `json:"last_upd_date"`
}

type FactsheetOptions

type FactsheetOptions struct {
	PageSize      int
	Cursor        string
	ProjID        string
	StartDate     time.Time
	EndDate       time.Time
	Latest        bool
	FundClassName string
}

type FactsheetPerformance

type FactsheetPerformance struct {
	ProjID              string   `json:"proj_id"`
	FundClassName       string   `json:"fund_class_name"`
	StartDate           string   `json:"start_date"`
	EndDate             string   `json:"end_date"`
	ProspectusType      string   `json:"prospectus_type"`
	PerformanceTypeDesc string   `json:"performance_type_desc"`
	ReferencePeriod     string   `json:"reference_period"`
	PerformanceValue    float64  `json:"performance_value"`
	LastUpdDate         DateTime `json:"last_upd_date"`
}

type FactsheetStatistics

type FactsheetStatistics struct {
	ProjID                  string   `json:"proj_id"`
	FundClassName           string   `json:"fund_class_name"`
	StartDate               string   `json:"start_date"`
	EndDate                 string   `json:"end_date"`
	ProspectusType          string   `json:"prospectus_type"`
	PortfolioTurnoverRatio  string   `json:"portfolio_turnover_ratio"`
	RecoveringPeriod        string   `json:"recovering_period"`
	PortfolioDurationPeriod string   `json:"portfolio_duration_period"`
	MaximumDrawdown         string   `json:"maximum_drawdown"`
	SharpeRatio             string   `json:"sharpe_ratio"`
	Beta                    string   `json:"beta"`
	Alpha                   string   `json:"alpha"`
	FXHedging               string   `json:"fx_hedging"`
	TrackingError           string   `json:"tracking_error"`
	YieldToMaturity         string   `json:"yield_to_maturity"`
	LastUpdDate             DateTime `json:"last_upd_date"`
}

type FactsheetSubscriptionRedemptionMinimum

type FactsheetSubscriptionRedemptionMinimum struct {
	ProjID             string   `json:"proj_id"`
	FundClassName      string   `json:"fund_class_name"`
	StartDate          string   `json:"start_date"`
	EndDate            string   `json:"end_date"`
	ProspectusType     string   `json:"prospectus_type"`
	MinimumSubIPO      float64  `json:"minimum_sub_ipo"`
	MinimumSubIPOCur   string   `json:"minimum_sub_ipo_cur"`
	MinimumSub         float64  `json:"minimum_sub"`
	MinimumSubCur      string   `json:"minimum_sub_cur"`
	MinimumSubUnit     string   `json:"minimum_sub_unit"`
	MinimumRedempt     float64  `json:"minimum_redempt"`
	MinimumRedemptCur  string   `json:"minimum_redempt_cur"`
	MinimumRedemptUnit string   `json:"minimum_redempt_unit"`
	LowbalVal          float64  `json:"lowbal_val"`
	LowbalValCur       string   `json:"lowbal_val_cur"`
	LowbalUnit         string   `json:"lowbal_unit"`
	LastUpdDate        DateTime `json:"last_upd_date"`
}

type FactsheetSubscriptionRedemptionPeriod

type FactsheetSubscriptionRedemptionPeriod struct {
	ProjID           string   `json:"proj_id"`
	FundClassName    string   `json:"fund_class_name"`
	StartDate        string   `json:"start_date"`
	EndDate          string   `json:"end_date"`
	ProspectusType   string   `json:"prospectus_type"`
	Type             string   `json:"type"`
	Period           string   `json:"period"`
	RedempPeriodOth  string   `json:"redemp_period_oth"`
	SettlementPeriod string   `json:"settlement_period"`
	LastUpdDate      DateTime `json:"last_upd_date"`
}

type FeeOptions

type FeeOptions struct {
	PageSize      int
	Cursor        string
	ProjID        string
	FundClassName string
}

type FinancialStatement added in v0.5.0

type FinancialStatement struct {
	LastUpdDate DateTime `json:"last_upd_date"`
	ReportYear  string   `json:"report_year"`
	UniqueID    string   `json:"unique_id"`
}

FinancialStatement represents financial statements and ratios.

type FundDividendPolicy

type FundDividendPolicy struct {
	ProjID         string   `json:"proj_id"`
	FundClassName  string   `json:"fund_class_name"`
	StartDate      string   `json:"start_date"`
	EndDate        string   `json:"end_date"`
	ProspectusType string   `json:"prospectus_type"`
	DividendPolicy string   `json:"dividend_policy"`
	LastUpdDate    DateTime `json:"last_upd_date"`
}

type FundFactsheetURL

type FundFactsheetURL struct {
	ProjID          string   `json:"proj_id"`
	FundClassName   string   `json:"fund_class_name"`
	ProspectusType  string   `json:"prospectus_type"`
	AMCURLFactsheet string   `json:"amc_url_factsheet"`
	PDFFactsheet    string   `json:"pdf_factsheet"`
	AsOfDate        string   `json:"as_of_date"`
	LastUpdDate     DateTime `json:"last_upd_date"`
}

type FundIPO

type FundIPO struct {
	ProjID             string   `json:"proj_id"`
	StartDate          string   `json:"start_date"`
	EndDate            string   `json:"end_date"`
	ProspectusType     string   `json:"prospectus_type"`
	FirstSellStartDate string   `json:"first_sell_start_date"`
	FirstSellEndDate   string   `json:"first_sell_end_date"`
	LastUpdDate        DateTime `json:"last_upd_date"`
}

type FundInvolveParty

type FundInvolveParty struct {
	ProjID       string   `json:"proj_id"`
	EntityType   string   `json:"entity_type"`
	EntityNameTH string   `json:"entity_name_th"`
	EntityNameEN string   `json:"entity_name_en"`
	Address      string   `json:"address"`
	LastUpdDate  DateTime `json:"last_upd_date"`
}

func (FundInvolveParty) EntityName

func (f FundInvolveParty) EntityName(lang Language) string

EntityName returns the entity name in the client's preferred language.

type FundPortfolioView

type FundPortfolioView struct {
	ProjID                string
	AssetAllocation       []AssetAllocation
	Top5Holdings          []Top5Holding
	QuarterlyPortfolio    []QuarterlyPortfolio
	MonthlyAssetBreakdown []MonthlyPortfolioAssetType
}

FundPortfolioView aggregates the latest portfolio-related data for a single fund.

type FundProfile

type FundProfile struct {
	UniqueID                     string   `json:"unique_id"`
	CompNameTH                   string   `json:"comp_name_th"`
	CompNameEN                   string   `json:"comp_name_en"`
	ProjID                       string   `json:"proj_id"`
	RegisID                      string   `json:"regis_id"`
	InitDate                     string   `json:"init_date"`
	RegisDate                    string   `json:"regis_date"`
	CancelDate                   string   `json:"cancel_date"`
	ProjNameTH                   string   `json:"proj_name_th"`
	ProjNameEN                   string   `json:"proj_name_en"`
	ProjAbbrName                 string   `json:"proj_abbr_name"`
	FundStatus                   string   `json:"fund_status"`
	InvestCountryFlag            string   `json:"invest_country_flag"`
	ProjRetailType               string   `json:"proj_retail_type"`
	ProjTermFlag                 string   `json:"proj_term_flag"`
	ProjTermDay                  *int     `json:"proj_term_day"`
	ProjTermMonth                *int     `json:"proj_term_month"`
	ProjTermYear                 *int     `json:"proj_term_year"`
	PolicyDesc                   string   `json:"policy_desc"`
	InvestmentPolicyDesc         string   `json:"investment_policy_desc"`
	ManagementStyle              string   `json:"management_style"`
	FeederFundMasterFund         string   `json:"feederfund_master_fund"`
	FeederFundCountry            string   `json:"feederfund_country"`
	ExchangeRateProtectionPolicy string   `json:"exchange_rate_protection_policy"`
	FundClassName                string   `json:"fund_class_name"`
	FundClassDetail              string   `json:"fund_class_detail"`
	FundClassDescription         string   `json:"fund_class_description"`
	FundClassTaxIncentiveType    string   `json:"fund_class_tax_incentive_type"`
	FundClassISINCode            string   `json:"fund_class_isin_code"`
	LastUpdDate                  DateTime `json:"last_upd_date"`
}

func (FundProfile) CompanyName

func (p FundProfile) CompanyName(lang Language) string

CompanyName returns the AMC name in the client's preferred language.

func (FundProfile) Name

func (p FundProfile) Name(lang Language) string

Name returns the fund name in the client's preferred language. Falls back to the other language if the preferred one is empty.

type FundSpecification

type FundSpecification struct {
	ProjID        string   `json:"proj_id"`
	FundClassName string   `json:"fund_class_name"`
	SpecCode      string   `json:"spec_code"`
	SpecDesc      string   `json:"spec_desc"`
	LastUpdDate   DateTime `json:"last_upd_date"`
}

type InvolvePartyOptions

type InvolvePartyOptions struct {
	PageSize   int
	Cursor     string
	ProjID     string
	EntityType string
}

type Language

type Language string

Language represents the preferred display language for bilingual fields.

const (
	LanguageThai    Language = "th"
	LanguageEnglish Language = "en"
)

type LicenseCheckOptions added in v0.5.0

type LicenseCheckOptions struct {
	PageSize int
	Cursor   string
	// Optional filters
	LicenseNo     string
	EntityName    string
	LicenseStatus string
}

LicenseCheckOptions defines query options for license check endpoints.

type LicenseCheckResult added in v0.5.0

type LicenseCheckResult struct {
	LicenseID     string   `json:"license_id"`
	LicenseNo     string   `json:"license_no"`
	LicenseType   string   `json:"license_type"`
	EntityNameTH  string   `json:"entity_name_th"`
	EntityNameEN  string   `json:"entity_name_en"`
	LicenseStatus string   `json:"license_status"`
	IssueDate     string   `json:"issue_date"`
	ExpireDate    string   `json:"expire_date"`
	LicenseDetail string   `json:"license_detail"`
	Remark        string   `json:"remark"`
	LastUpdDate   DateTime `json:"last_upd_date"`
}

LicenseCheckResult represents a generic license check result. Fields vary by license type, so we use a flexible structure.

type MonthlyPortfolioAssetType

type MonthlyPortfolioAssetType struct {
	ProjID        string  `json:"proj_id"`
	Period        int     `json:"period"`
	AssetliabCode string  `json:"assetliab_code"`
	AssetliabDesc string  `json:"assetliab_desc"`
	MarketValue   float64 `json:"market_value"`
	PercentNAV    float64 `json:"percent_nav"`
}

type MutualFundFee

type MutualFundFee struct {
	ProjID        string   `json:"proj_id"`
	FundClassName string   `json:"fund_class_name"`
	FeeTypeDesc   string   `json:"fee_type_desc"`
	Rate          float64  `json:"rate"`
	RateUnit      string   `json:"rate_unit"`
	FeeOtherDesc  string   `json:"fee_other_desc"`
	LastUpdDate   DateTime `json:"last_upd_date"`
}
type NAVOptions struct {
	PageSize      int
	Cursor        string
	ProjID        string
	StartDate     time.Time
	EndDate       time.Time
	FundClassName string
}

type Option

type Option func(*Client)

func WithBaseURL

func WithBaseURL(url string) Option

func WithCache

func WithCache(cache cacheClient, ttl time.Duration) Option

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) Option

func WithLanguage

func WithLanguage(lang Language) Option

func WithLogger

func WithLogger(l logger) Option

func WithMaxRetries

func WithMaxRetries(n int) Option

func WithRateLimiter

func WithRateLimiter(rl RateLimiter) Option

func WithRequestHook

func WithRequestHook(hook RequestHook) Option

func WithResponseHook

func WithResponseHook(hook ResponseHook) Option

func WithRetryDelay

func WithRetryDelay(d time.Duration) Option

func WithSecondaryKey

func WithSecondaryKey(key string) Option

func WithTimeout

func WithTimeout(d time.Duration) Option

type OutstandingOptions

type OutstandingOptions struct {
	PageSize    int
	Cursor      string
	ProjID      string
	StartPeriod string
	EndPeriod   string
}

type PVDFundAsset added in v0.5.0

type PVDFundAsset struct {
	ProjID      string  `json:"proj_id"`
	Period      int     `json:"period"`
	AssetSeq    int     `json:"asset_seq"`
	AssetName   string  `json:"asset_name"`
	AssetRatio  float64 `json:"asset_ratio"`
	MarketValue float64 `json:"market_value"`
	LastUpdDate string  `json:"last_upd_date"`
}

PVDFundAsset represents provident fund asset allocation.

type PVDFundBenchmark added in v0.5.0

type PVDFundBenchmark struct {
	ProjID         string   `json:"proj_id"`
	FundClassName  string   `json:"fund_class_name"`
	Period         int      `json:"period"`
	Benchmark      string   `json:"benchmark"`
	BenchmarkValue float64  `json:"benchmark_value"`
	FundValue      float64  `json:"fund_value"`
	LastUpdDate    DateTime `json:"last_upd_date"`
}

PVDFundBenchmark represents provident fund benchmark comparisons.

type PVDFundCompliance added in v0.5.0

type PVDFundCompliance struct {
	ProjID           string   `json:"proj_id"`
	Period           int      `json:"period"`
	ComplianceType   string   `json:"compliance_type"`
	ComplianceStatus string   `json:"compliance_status"`
	Remark           string   `json:"remark"`
	LastUpdDate      DateTime `json:"last_upd_date"`
}

PVDFundCompliance represents provident fund compliance data.

type PVDFundContribution added in v0.5.0

type PVDFundContribution struct {
	ProjID          string  `json:"proj_id"`
	Period          int     `json:"period"`
	EmployeeContrib float64 `json:"employee_contrib"`
	EmployerContrib float64 `json:"employer_contrib"`
	TotalContrib    float64 `json:"total_contrib"`
	LastUpdDate     string  `json:"last_upd_date"`
}

PVDFundContribution represents provident fund contribution records.

type PVDFundDividend added in v0.5.0

type PVDFundDividend struct {
	ProjID        string   `json:"proj_id"`
	FundClassName string   `json:"fund_class_name"`
	DividendDate  string   `json:"dividend_date"`
	DividendValue float64  `json:"dividend_value"`
	BookCloseDate string   `json:"book_close_date"`
	LastUpdDate   DateTime `json:"last_upd_date"`
}

PVDFundDividend represents provident fund dividend history.

type PVDFundExpense added in v0.5.0

type PVDFundExpense struct {
	ProjID       string  `json:"proj_id"`
	Period       int     `json:"period"`
	ExpenseType  string  `json:"expense_type"`
	ExpenseValue float64 `json:"expense_value"`
	ExpenseRatio float64 `json:"expense_ratio"`
	LastUpdDate  string  `json:"last_upd_date"`
}

PVDFundExpense represents provident fund expense data.

type PVDFundFee added in v0.5.0

type PVDFundFee struct {
	ProjID        string   `json:"proj_id"`
	FundClassName string   `json:"fund_class_name"`
	FeeTypeDesc   string   `json:"fee_type_desc"`
	Rate          float64  `json:"rate"`
	RateUnit      string   `json:"rate_unit"`
	ActualValue   float64  `json:"actual_value"`
	LastUpdDate   DateTime `json:"last_upd_date"`
}

PVDFundFee represents provident fund fee structures.

type PVDFundInfo added in v0.5.0

type PVDFundInfo struct {
	ProjID          string   `json:"proj_id"`
	ProjNameTH      string   `json:"proj_name_th"`
	ProjNameEN      string   `json:"proj_name_en"`
	ProjAbbrName    string   `json:"proj_abbr_name"`
	FundStatus      string   `json:"fund_status"`
	InitDate        string   `json:"init_date"`
	RegisDate       string   `json:"regis_date"`
	CancelDate      string   `json:"cancel_date"`
	PolicyDesc      string   `json:"policy_desc"`
	ManagementStyle string   `json:"management_style"`
	FundClassName   string   `json:"fund_class_name"`
	LastUpdDate     DateTime `json:"last_upd_date"`
}

PVDFundInfo represents provident fund information.

type PVDFundLiquidity added in v0.5.0

type PVDFundLiquidity struct {
	ProjID       string  `json:"proj_id"`
	Period       int     `json:"period"`
	CashRatio    float64 `json:"cash_ratio"`
	CurrentRatio float64 `json:"current_ratio"`
	QuickRatio   float64 `json:"quick_ratio"`
	LastUpdDate  string  `json:"last_upd_date"`
}

PVDFundLiquidity represents provident fund liquidity metrics.

type PVDFundMember added in v0.5.0

type PVDFundMember struct {
	ProjID         string `json:"proj_id"`
	Period         int    `json:"period"`
	TotalMembers   int    `json:"total_members"`
	ActiveMembers  int    `json:"active_members"`
	RetiredMembers int    `json:"retired_members"`
	LastUpdDate    string `json:"last_upd_date"`
}

PVDFundMember represents provident fund member statistics.

type PVDFundPerformance added in v0.5.0

type PVDFundPerformance struct {
	ProjID           string   `json:"proj_id"`
	FundClassName    string   `json:"fund_class_name"`
	Period           int      `json:"period"`
	PerformanceType  string   `json:"performance_type"`
	ReferencePeriod  string   `json:"reference_period"`
	PerformanceValue float64  `json:"performance_value"`
	LastUpdDate      DateTime `json:"last_upd_date"`
}

PVDFundPerformance represents provident fund performance data.

type PVDFundPolicy added in v0.5.0

type PVDFundPolicy struct {
	ProjID         string   `json:"proj_id"`
	FundClassName  string   `json:"fund_class_name"`
	PolicyType     string   `json:"policy_type"`
	PolicyDesc     string   `json:"policy_desc"`
	MinEquityRatio float64  `json:"min_equity_ratio"`
	MaxEquityRatio float64  `json:"max_equity_ratio"`
	LastUpdDate    DateTime `json:"last_upd_date"`
}

PVDFundPolicy represents provident fund investment policies.

type PVDFundSpec added in v0.5.0

type PVDFundSpec struct {
	ProjID        string   `json:"proj_id"`
	FundClassName string   `json:"fund_class_name"`
	SpecCode      string   `json:"spec_code"`
	SpecDesc      string   `json:"spec_desc"`
	LastUpdDate   DateTime `json:"last_upd_date"`
}

PVDFundSpec represents provident fund specifications.

type PVDFundTransaction added in v0.5.0

type PVDFundTransaction struct {
	ProjID      string  `json:"proj_id"`
	Period      int     `json:"period"`
	TransType   string  `json:"trans_type"`
	TransValue  float64 `json:"trans_value"`
	TransCount  int     `json:"trans_count"`
	LastUpdDate string  `json:"last_upd_date"`
}

PVDFundTransaction represents provident fund transaction data.

type PVDListItem added in v0.5.0

type PVDListItem struct {
	UniqueID    string   `json:"unique_id"`
	CompNameTH  string   `json:"comp_name_th"`
	CompNameEN  string   `json:"comp_name_en"`
	LastUpdDate DateTime `json:"last_upd_date"`
}

PVDListItem represents a provident fund from the getPvdList endpoint.

type PVDListOptions added in v0.5.0

type PVDListOptions struct {
	PageSize int
	Cursor   string
}

PVDListOptions defines query options for ListPVDs.

type PVDPeriodOptions added in v0.5.0

type PVDPeriodOptions struct {
	PageSize    int
	Cursor      string
	ProjID      string
	StartPeriod int
	EndPeriod   int
}

PVDPeriodOptions defines query options for PVD endpoints that filter by period.

type PVDProjOptions added in v0.5.0

type PVDProjOptions struct {
	PageSize int
	Cursor   string
	ProjID   string
}

PVDProjOptions defines query options for PVD endpoints that filter by proj_id.

type PaginatedResponse

type PaginatedResponse struct {
	Message    string `json:"message"`
	PageSize   int    `json:"page_size"`
	NextCursor string `json:"next_cursor"`
}

type ProfileOptions

type ProfileOptions struct {
	PageSize      int
	Cursor        string
	ProjID        string
	FundClassName string
	FundStatus    string
	ProjectInfo   string
	CompanyInfo   string
}

type QuarterlyPortfolio

type QuarterlyPortfolio struct {
	ProjID         string  `json:"proj_id"`
	Period         int     `json:"period"`
	AsOfDate       string  `json:"as_of_date"`
	AssetliabID    string  `json:"assetliab_id"`
	AssetliabDesc  string  `json:"assetliab_desc"`
	IssueCode      string  `json:"issue_code"`
	ISINCode       string  `json:"isin_code"`
	Issuer         string  `json:"issuer"`
	AssetliabValue float64 `json:"assetliab_value"`
	PercentNAV     float64 `json:"percent_nav"`
	LastUpdDate    string  `json:"last_upd_date"`
}

type RateLimiter

type RateLimiter interface {
	Wait(ctx context.Context) error
}

func NewRateLimiter

func NewRateLimiter() RateLimiter

type RequestHook

type RequestHook func(req *http.Request)

type ResponseHook

type ResponseHook func(req *http.Request, resp *http.Response, err error)

type RiskSpectrum

type RiskSpectrum struct {
	ProjID           string   `json:"proj_id"`
	StartDate        string   `json:"start_date"`
	EndDate          string   `json:"end_date"`
	ProspectusType   string   `json:"prospectus_type"`
	RiskSpectrum     string   `json:"risk_spectrum"`
	RiskSpectrumDesc string   `json:"risk_spectrum_desc"`
	LastUpdDate      DateTime `json:"last_upd_date"`
}

type SBOExportIncome added in v0.5.0

type SBOExportIncome struct {
	LastUpdDate DateTime `json:"last_upd_date"`
	ReportYear  string   `json:"report_year"`
	UniqueID    string   `json:"unique_id"`
}

SBOExportIncome represents export income structure.

type SBOInfo added in v0.5.0

type SBOInfo struct {
	LastUpdDate          DateTime `json:"last_upd_date"`
	ReportYear           string   `json:"report_year"`
	UniqueID             string   `json:"unique_id"`
	Language             string   `json:"language"`
	CorpName             string   `json:"corp_name"`
	Symbol               string   `json:"symbol"`
	Address              string   `json:"address"`
	Province             string   `json:"province"`
	ZipCode              string   `json:"zip_code"`
	BusinessType         string   `json:"business_type"`
	RegisteredNumber     string   `json:"registered_number"`
	Telephone            string   `json:"telephone"`
	Fax                  string   `json:"fax"`
	Website              string   `json:"website"`
	Email                string   `json:"email"`
	CommonPaidupShare    float64  `json:"common_paidup_share"`
	PreferredPaidupShare float64  `json:"preferred_paidup_share"`
}

SBOInfo represents general company information from the One Report.

type SBOProductIncome added in v0.5.0

type SBOProductIncome struct {
	LastUpdDate                     DateTime `json:"last_upd_date"`
	ReportYear                      string   `json:"report_year"`
	UniqueID                        string   `json:"unique_id"`
	BusinessIncomeCode              string   `json:"business_income_code"`
	Sequence                        int      `json:"sequence"`
	BusinessIncomeDesc              string   `json:"business_income_desc"`
	AsofYear                        float64  `json:"asof_year"`
	AsofYesteryear                  float64  `json:"asof_yesteryear"`
	AsofYearBeforeYesteryear        float64  `json:"asof_year_before_yesteryear"`
	AsofYearPercent                 float64  `json:"asof_year_percent"`
	AsofYesteryearPercent           float64  `json:"asof_yesteryear_percent"`
	AsofYearBeforeYesteryearPercent float64  `json:"asof_year_before_yesteryear_percent"`
}

SBOProductIncome represents product income structure.

type SBORD added in v0.5.0

type SBORD struct {
	LastUpdDate DateTime `json:"last_upd_date"`
	ReportYear  string   `json:"report_year"`
	UniqueID    string   `json:"unique_id"`
}

SBORD represents R&D information.

type SBORisk added in v0.5.0

type SBORisk struct {
	LastUpdDate  DateTime `json:"last_upd_date"`
	ReportYear   string   `json:"report_year"`
	UniqueID     string   `json:"unique_id"`
	RiskCategory string   `json:"risk_category"`
	RiskCode     string   `json:"risk_code"`
	Sequence     int      `json:"sequence"`
	Choice       string   `json:"choice"`
	HolderRisk   string   `json:"holder_risk"`
	ForeignRisk  string   `json:"foreign_risk"`
}

SBORisk represents risk management details.

type SCPCSRActivity added in v0.5.0

type SCPCSRActivity struct {
	LastUpdDate DateTime `json:"last_upd_date"`
	ReportYear  string   `json:"report_year"`
	UniqueID    string   `json:"unique_id"`
}

SCPCSRActivity represents CSR activities.

type SCPEmployeeDevelopment added in v0.5.0

type SCPEmployeeDevelopment struct {
	LastUpdDate DateTime `json:"last_upd_date"`
	ReportYear  string   `json:"report_year"`
	UniqueID    string   `json:"unique_id"`
}

SCPEmployeeDevelopment represents training and safety information.

type SCPEmployeeInfo added in v0.5.0

type SCPEmployeeInfo struct {
	LastUpdDate DateTime `json:"last_upd_date"`
	ReportYear  string   `json:"report_year"`
	UniqueID    string   `json:"unique_id"`
}

SCPEmployeeInfo represents employee and compensation information.

type SCPLaborDispute added in v0.5.0

type SCPLaborDispute struct {
	LastUpdDate DateTime `json:"last_upd_date"`
	ReportYear  string   `json:"report_year"`
	UniqueID    string   `json:"unique_id"`
}

SCPLaborDispute represents labor dispute information.

type SecuritiesCompanyOptions added in v0.5.0

type SecuritiesCompanyOptions struct {
	PageSize    int
	Cursor      string
	LicenseNo   string
	CompanyName string
}

SecuritiesCompanyOptions defines query options for securities companies.

type SustainabilityDetail added in v0.5.0

type SustainabilityDetail struct {
	LastUpdDate DateTime `json:"last_upd_date"`
	ReportYear  string   `json:"report_year"`
	UniqueID    string   `json:"unique_id"`
}

SustainabilityDetail represents sustainability policy and targets.

type SustainabilityEnvironmentIssue added in v0.5.0

type SustainabilityEnvironmentIssue struct {
	LastUpdDate DateTime `json:"last_upd_date"`
	ReportYear  string   `json:"report_year"`
	UniqueID    string   `json:"unique_id"`
}

SustainabilityEnvironmentIssue represents environmental issues.

type SustainabilityHumanRightsIssue added in v0.5.0

type SustainabilityHumanRightsIssue struct {
	LastUpdDate DateTime `json:"last_upd_date"`
	ReportYear  string   `json:"report_year"`
	UniqueID    string   `json:"unique_id"`
}

SustainabilityHumanRightsIssue represents human rights issues.

type Top5Holding

type Top5Holding struct {
	ProjID         string   `json:"proj_id"`
	StartDate      string   `json:"start_date"`
	EndDate        string   `json:"end_date"`
	ProspectusType string   `json:"prospectus_type"`
	AssetSeq       int      `json:"asset_seq"`
	AssetName      string   `json:"asset_name"`
	AssetRatio     float64  `json:"asset_ratio"`
	LastUpdDate    DateTime `json:"last_upd_date"`
}

Directories

Path Synopsis
cmd
sec-cli command
sec-lookup command
examples
basic command
batch command
thaifa command
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL