Go client for the Finnomena.com Thai mutual fund API.
go get github.com/jwitmann/finnomena-goimport (
"context"
"time"
finnomena "github.com/jwitmann/finnomena-go"
)
func main() {
client := finnomena.NewClient()
// Get all funds
funds, err := client.GetFundsList(context.Background())
// Get historical prices
from := time.Now().AddDate(-1, 0, 0)
to := time.Now()
bars, err := client.GetHistoricalPrices(context.Background(), "FUND-A", "D", from, to)
// Get fund latest NAV
latest, err := client.GetFundLatest(context.Background(), "F000001")
}All API response types are available in the models subpackage:
import "github.com/jwitmann/finnomena-go/models"
// Direct access to types
var fund models.Fund
var bars models.BarsResponseNote: The standalone
finnomena-modelsmodule has been merged into this package. Update your import fromgithub.com/jwitmann/finnomena-modelstogithub.com/jwitmann/finnomena-go/models.
- All Finnomena API endpoints
- Context support for cancellation/timeouts
- Automatic retry with exponential backoff
- Thai-to-English fee translation
- Zero external dependencies
client := finnomena.NewClient()
client.SetRetryConfig(5, 2*time.Second)Default: 3 retries with 1s, 2s, 4s exponential backoff.
GetFundsList(ctx)- All available fundsSearchFund(query)- Find fund by short code or IDGetSymbolInfo(ctx, symbol)- Trading symbol metadata
GetHistoricalPrices(ctx, symbol, resolution, from, to)- OHLCV bars
GetFundLatest(ctx, fundID)- Current NAV and changeGetFundPerformance(ctx, fundID)- Returns, Sharpe, drawdownGetFundOverview(ctx, fundID)- 3D metrics (PP, RR, DD scores)GetFundFee(ctx, fundID)- Fee structureGetFundPortfolio(ctx, fundID)- Holdings and allocationGetFundVerify(ctx, fundID)- Available data periods
GetServerTime(ctx)- Server timestamp
Thai fund fees are returned in Thai language. Use TranslateFee to convert them to English:
fee, err := client.GetFundFee(context.Background(), "F000001")
if err != nil {
log.Fatal(err)
}
for i := range fee.Fees {
finnomena.TranslateFee(&fee.Fees[i], true)
fmt.Printf("%s: %s %s\n",
fee.Fees[i].Description,
fee.Fees[i].Rate,
fee.Fees[i].Unit)
}- finnomena-models - Deprecated. Types merged into this repo.
- thai-market-data - Thai market data (AIMC, SET)
This is an unofficial client for the Finnomena.com API. It is not affiliated with or endorsed by Finnomena.
MIT License - see LICENSE file for details