finnomena

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 8 Imported by: 0

README

finnomena-go

Go Reference Go Report Card

Go client for the Finnomena.com Thai mutual fund API.

Installation

go get github.com/jwitmann/finnomena-go

Usage

import finnomena "github.com/jwitmann/finnomena-go"

// Create client
client := finnomena.NewClient()

// Get all funds
funds, err := client.GetFundsList()

// Get historical prices
from := time.Now().AddDate(-1, 0, 0)
to := time.Now()
bars, err := client.GetHistoricalPrices("FUND-A", "D", from, to)

// Get fund info
latest, perf, overview, err := client.GetFundInfo("F000001")

Features

  • All Finnomena API endpoints
  • Automatic retry with exponential backoff
  • Thai-to-English fee translation
  • Zero external dependencies

Retry Configuration

client := finnomena.NewClient()
client.SetRetryConfig(5, 2*time.Second)

Default: 3 retries with 1s, 2s, 4s exponential backoff.

API Coverage

  • GetFundsList - All available funds
  • GetHistoricalPrices - OHLCV bars
  • GetFundLatest - Current NAV
  • GetFundPerformance - Returns, Sharpe, drawdown
  • GetFundOverview - 3D metrics
  • GetFundFee - Fee structure
  • GetFundPortfolio - Holdings and allocation

Fee Translation Example

Thai fund fees are returned in Thai language. Use TranslateFee to convert them to English:

// Get fund fee information
fee, err := client.GetFundFee("F000001")
if err != nil {
    log.Fatal(err)
}

// Translate Thai fee descriptions to English
for i := range fee.Fees {
    finnomena.TranslateFee(&fee.Fees[i], true) // true = use English names
    fmt.Printf("%s: %s %s\n", 
        fee.Fees[i].Description,  // Now in English
        fee.Fees[i].Rate,
        fee.Fees[i].Unit)
}

// Output:
// Management Fee: 1.50 % per year
// Purchase Fee: 2.00 %
// Redemption Fee: 0.00 %

Available translations:

  • ค่าธรรมเนียมการจัดการmanagement fee
  • ค่าธรรมเนียมการขายหน่วยลงทุน (Front-end Fee)purchase fee
  • ค่าธรรมเนียมการรับซื้อคืนหน่วยลงทุน (Back-end Fee)redemption fee
  • And more...

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Disclaimer

This is an unofficial client for the Finnomena.com API. It is not affiliated with or endorsed by Finnomena.

License

MIT License - see LICENSE file for details

Documentation

Index

Constants

View Source
const (
	BaseURL = "https://www.finnomena.com/fn3/api/fund/v2/public"

	// Default retry configuration
	DefaultMaxRetries      = 3
	DefaultRetryDelay      = 1 * time.Second
	RetryBackoffMultiplier = 2
)

Variables

View Source
var FeeDescriptionTranslation = map[string]string{
	"ค่าใช้จ่ายอื่นๆ":                                        "other fee",
	"ค่าธรรมเนียมการขายหน่วยลงทุน (Front-end Fee)":           "purchase fee",
	"ค่าธรรมเนียมการจัดการ":                                  "management fee",
	"ค่าธรรมเนียมการรับซื้อคืนหน่วยลงทุน (Back-end Fee)":     "redemption fee",
	"ค่าธรรมเนียมการสับเปลี่ยนหน่วยลงทุนเข้า (SWITCHING IN)": "switch in fee",
	"ค่าธรรมเนียมการสับเปลี่ยนหน่วยลงทุนออก (SWITCHING OUT)": "switch out fee",
	"ค่าธรรมเนียมและค่าใช้จ่ายรวมทั้งหมด":                    "total expense ratio",
	"ค่าธรรมเนียมการโอนหน่วยลงทุน":                           "unit transfer fee",
	"ค่าธรรมเนียมนายทะเบียนหน่วย":                            "registrar fee",
	"ค่าธรรมเนียมผู้ดูแลผลประโยชน์":                          "trustee fee",
}
View Source
var FeeOtherDescTranslation = map[string]string{
	"บริษัทจัดการอาจเรียกเก็บค่าธรรมเนียมการขายและค่าธรรมเนียมการรับซื้อคืนกับผู้ลงทุนแต่ละกลุ่มไม่เท่ากัน ทั้งนี้ ผู้ลงทุนสามารถดูรายละเอียดเพิ่มเติมได้ที่หนังสือชี้ชวนส่วนข้อมูลกองทุนรวม":                              "The fund management company may charge different sales fees and redemption fees to different investor groups. Investors can find more details in the fund information section of the prospectus.",
	"บริษัทจัดการอาจพิจารณาเปลี่ยนแปลงค่าธรรมเนียมที่เรียกเก็บจริงเพื่อให้สอดคล้องกับกลยุทธ์หรือค่าใช้จ่ายในการบริหารจัดการ และรวมค่าใช้จ่ายเป็นข้อมูลของรอบปีบัญชีล่าสุดหรือประมาณการเบื้องต้น (กรณียังไม่ครบรอบปีบัญชี)": "The management company may consider adjusting the actual fees charged to align with its strategy or management expenses, and include these expenses in the data for the latest accounting year or a preliminary estimate (if the accounting year has not yet ended).",
}
View Source
var FeeUnitTranslation = map[string]string{
	"ต่อปี ของมูลค่าทรัพย์สินสุทธิของกองทุน": "per year of NAV",
	"% ต่อปี": "% per year",
	"บาท":     "baht",
}

Functions

func TranslateFee

func TranslateFee(fee *models.Fee, useEnglish bool)

Types

type Client

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

Client represents the Finnomena API client

func NewClient

func NewClient() *Client

NewClient creates a new Finnomena API client

func NewClientWithRetry

func NewClientWithRetry(maxRetries int, retryDelay time.Duration) *Client

NewClientWithRetry creates a new Finnomena API client with custom retry configuration

func NewClientWithTimeout

func NewClientWithTimeout(timeout time.Duration) *Client

NewClientWithTimeout creates a new Finnomena API client with custom timeout

func (*Client) GetFundFee

func (c *Client) GetFundFee(fundID string) (*models.FundFee, error)

GetFundFee retrieves fee information for a specific fund

func (*Client) GetFundLatest

func (c *Client) GetFundLatest(fundID string) (*models.FundLatest, error)

GetFundLatest retrieves the latest data for a specific fund

func (*Client) GetFundOverview

func (c *Client) GetFundOverview(fundID string) (*models.FundOverview, error)

GetFundOverview retrieves overview data for a specific fund

func (*Client) GetFundPerformance

func (c *Client) GetFundPerformance(fundID string) (*models.FundPerformance, error)

GetFundPerformance retrieves performance data for a specific fund

func (*Client) GetFundPortfolio

func (c *Client) GetFundPortfolio(fundID string) (*models.FundPortfolio, error)

func (*Client) GetFundVerify

func (c *Client) GetFundVerify(fundID string) (*models.FundVerify, error)

GetFundVerify retrieves verification data including available periods for a fund

func (*Client) GetFundsList

func (c *Client) GetFundsList() ([]models.Fund, error)

GetFundsList retrieves the list of all available funds

func (*Client) GetHistoricalPrices

func (c *Client) GetHistoricalPrices(symbol, resolution string, from, to time.Time) (*models.BarsResponse, error)

GetHistoricalPrices retrieves historical OHLCV bars for a fund

func (*Client) GetServerTime

func (c *Client) GetServerTime() (int64, error)

GetServerTime retrieves the server time from the API

func (*Client) GetSymbolInfo

func (c *Client) GetSymbolInfo(symbol string) (*models.SymbolInfo, error)

GetSymbolInfo retrieves symbol information for a specific fund

func (*Client) SearchFund

func (c *Client) SearchFund(query string) (*models.Fund, error)

SearchFund searches for a fund by short code or name

func (*Client) SetRetryConfig

func (c *Client) SetRetryConfig(maxRetries int, retryDelay time.Duration)

SetRetryConfig configures the retry behavior for the client

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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