A unified Go library for accessing financial markets data across multiple exchanges and countries.
Currently Supported:
- 🇮🇳 Indian equities (NSE)
- 🇮🇳 Indian mutual funds (AMFI)
- 💰 Precious metals (Gold, Silver, Platinum)
- 🪙 Cryptocurrencies (Bitcoin, Ethereum, Solana, and more)
Coming Soon:
- 🇺🇸 US equities (NYSE, NASDAQ)
- 🇮🇳 BSE stocks
Inspired by finance-go, this library provides a clean, exchange-agnostic API that automatically routes symbols to the appropriate data provider.
✅ Exchange-Agnostic API - Just use symbols, library handles routing ✅ Auto-Detection - Automatically detects market from symbol pattern ✅ Configurable - Set default markets and override per-request ✅ Batch Fetching - Fetch multiple quotes efficiently ✅ Zero Dependencies - Only uses Go standard library ✅ Type-Safe - Comprehensive type definitions ✅ Well-Tested - Includes integration tests ✅ Structured Logging - Built-in logging with multiple levels and formats
Requirements: Go 1.22 or higher (1.24 recommended)
go get github.com/Vikramarjuna/findata-gopackage main
import (
"fmt"
"log"
"github.com/Vikramarjuna/findata-go/equity"
)
func main() {
// Just use the symbol - library auto-detects the exchange!
quote, err := equity.Get("RELIANCE")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s (%s): %s %.2f (%.2f%%)\n",
quote.Symbol, quote.Exchange, quote.Currency,
quote.LastPrice, quote.PChange)
// Batch fetch multiple symbols
symbols := []string{"TCS", "INFY", "WIPRO"}
quotes, _ := equity.GetMultiple(symbols)
for symbol, q := range quotes {
fmt.Printf("%s: %s %.2f\n", symbol, q.Currency, q.LastPrice)
}
}Output:
RELIANCE (NSE): INR 1577.00 (-0.96%)
TCS: INR 3213.00
INFY: INR 1604.10
WIPRO: INR 263.00
import (
"github.com/Vikramarjuna/findata-go/config"
"github.com/Vikramarjuna/findata-go/equity"
)
func main() {
// Set default market (optional - defaults to India)
config.SetDefaultMarket(config.MarketIndia)
// Now all symbols default to Indian market
quote, _ := equity.Get("RELIANCE") // Uses NSE
// Override per-request with options
quote, _ = equity.Get("RELIANCE",
equity.WithExchange(config.ExchangeNSE))
// Or specify market
quote, _ = equity.Get("RELIANCE",
equity.WithMarket(config.MarketIndia))
// Custom HTTP client
client := &http.Client{Timeout: 60 * time.Second}
config.SetHTTPClient(client)
}import "github.com/Vikramarjuna/findata-go/mf"
func main() {
// Search for funds
results, _ := mf.Search("HDFC Flexi Cap")
for _, nav := range results {
fmt.Printf("%s: ₹%.4f\n", nav.SchemeName, nav.NAV)
}
// Get by ISIN, scheme code, or name
nav, _ := mf.Get("INF179K01997")
fmt.Printf("NAV: ₹%.4f (as of %s)\n", nav.NAV, nav.Date)
// Batch fetch
navs, _ := mf.GetMultiple([]string{"119551", "119552"})
}import "github.com/Vikramarjuna/findata-go/metals"
func main() {
// Get specific metal price
goldPrice, _ := metals.Get(metals.Gold, "24K")
fmt.Printf("Gold 24K: ₹%.2f per gram\n", goldPrice.PricePerGram)
// Get all metal prices
allPrices, _ := metals.GetAll()
for _, price := range allPrices {
fmt.Printf("%s %s: ₹%.2f per gram\n",
price.Metal, price.Purity, price.PricePerGram)
}
// Supported metals and purities:
// Gold: 24K, 22K, 18K, 14K
// Silver: 999, 925
// Platinum: 999, 950
}import "github.com/Vikramarjuna/findata-go/crypto"
func main() {
// Get specific crypto quote in USD
btcQuote, _ := crypto.Get("bitcoin")
fmt.Printf("Bitcoin: $%.2f\n", btcQuote.CurrentPrice)
fmt.Printf("24h Change: %.2f%%\n", btcQuote.PriceChangePct24h)
// Get crypto quote in different currency
ethQuote, _ := crypto.Get("ethereum", crypto.WithCurrency("INR"))
fmt.Printf("Ethereum: ₹%.2f\n", ethQuote.CurrentPrice)
// Get multiple crypto quotes
coinIDs := []string{"bitcoin", "ethereum", "solana"}
quotes, _ := crypto.GetMultiple(coinIDs)
for coinID, quote := range quotes {
fmt.Printf("%s: $%.2f\n", coinID, quote.CurrentPrice)
}
// Use CoinGecko coin IDs (e.g., "bitcoin", "ethereum", "solana", "cardano", etc.)
// See https://www.coingecko.com/ for full list of supported coins
}The main package for fetching stock quotes across all supported exchanges.
Functions:
equity.Get(symbol string, opts ...Option) (*Quote, error)- Fetch a single quoteequity.GetMultiple(symbols []string, opts ...Option) (map[string]*Quote, []error)- Batch fetch
Options:
equity.WithMarket(market config.Market)- Override default marketequity.WithExchange(exchange config.Exchange)- Specify exact exchange
Quote Structure:
type Quote struct {
Symbol string
Exchange config.Exchange // NSE, BSE, NYSE, NASDAQ
CompanyName string
Industry string
Sector string
LastPrice float64
Currency string // INR, USD, etc.
Change float64
PChange float64
PreviousClose float64
Open float64
DayHigh float64
DayLow float64
YearHigh float64
YearLow float64
Volume float64
Value float64
Indices []string
Metadata map[string]string
}Global configuration for the library.
Functions:
config.SetDefaultMarket(market Market)- Set default market (India, US, Auto)config.GetDefaultMarket() Market- Get current default marketconfig.SetHTTPClient(client *http.Client)- Set custom HTTP clientconfig.SetAPIKey(provider, key string)- Set API key for providersconfig.SetUserAgent(ua string)- Set custom user agent
Constants:
// Markets
config.MarketIndia // "IN"
config.MarketUS // "US"
config.MarketAuto // "AUTO"
// Exchanges
config.ExchangeNSE // "NSE"
config.ExchangeBSE // "BSE"
config.ExchangeNYSE // "NYSE"
config.ExchangeNASDAQ // "NASDAQ"Mutual fund NAV data from AMFI.
Functions:
mf.GetAll() (map[string]*NAV, error)- Fetch all NAVsmf.Get(identifier string) (*NAV, error)- Get by code/ISIN/namemf.Search(query string) ([]*NAV, error)- Search by namemf.GetMultiple(identifiers []string) (map[string]*NAV, []error)- Batch fetch
NAV Structure:
type NAV struct {
SchemeCode string
ISIN string // Primary ISIN
ISINReinv string // Reinvestment ISIN
SchemeName string
NAV float64
Date string
}The library provides optional structured logging using Go's standard log/slog package.
By default, logging is disabled (silent). This follows Go library best practices - the library won't pollute your logs unless you explicitly enable it.
import "github.com/Vikramarjuna/findata-go/logger"
// Enable with default settings (INFO level, text format, stderr)
logger.SetLogger(logger.NewSlogLogger())
// Enable with custom configuration
logger.SetLogger(logger.NewSlogLogger(
logger.WithLevel(logger.LevelDebug), // DEBUG, INFO, WARN, ERROR
logger.WithFormat(logger.FormatJSON), // FormatText or FormatJSON
logger.WithOutput(logFile), // Any io.Writer
))
// Disable logging
logger.SetLogger(nil)time=2026-01-06T21:54:51.887+05:30 level=INFO msg="successfully fetched NSE quote" symbol=RELIANCE price=1577.00 currency=INR
Implement the logger.Logger interface to use your own logging framework:
type Logger interface {
Debug(msg string, keysAndValues ...any)
Info(msg string, keysAndValues ...any)
Warn(msg string, keysAndValues ...any)
Error(msg string, keysAndValues ...any)
}
logger.SetLogger(myCustomLogger)See the logger package documentation for full API details.
See the examples directory for complete working examples.
This project follows Semantic Versioning. See CHANGELOG.md for release history.
Contributions are welcome! Please read CONTRIBUTING.md for details on:
- How to report bugs
- How to suggest features
- Development setup
- Coding standards
- Pull request process
MIT License - see LICENSE file for details.
- Inspired by finance-go
- Data sources: NSE India, AMFI India