Add the bounded OpenFIGI v3 adapter, authenticated search route, and server-side configuration. Refs #3 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
26 lines
647 B
Go
26 lines
647 B
Go
package indices
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"strings"
|
|
"unicode/utf8"
|
|
)
|
|
|
|
type Index struct {
|
|
Name string `json:"name"`
|
|
Symbol string `json:"symbol"`
|
|
FIGI string `json:"figi"`
|
|
}
|
|
type IndexSearcher interface {
|
|
Search(context.Context, string, int) ([]Index, error)
|
|
}
|
|
|
|
var ErrRateLimited = errors.New("index search rate limited")
|
|
var ErrUnavailable = errors.New("index search unavailable")
|
|
var ErrInvalidQuery = errors.New("invalid index search query")
|
|
|
|
func ValidQuery(query string, limit int) bool {
|
|
return utf8.ValidString(query) && strings.TrimSpace(query) != "" && utf8.RuneCountInString(query) <= 100 && limit >= 1 && limit <= 20
|
|
}
|