Documentation
¶
Overview ¶
Package openfigi is the library behind the openfigi command line: the HTTP client, request shaping, and the typed data models for the OpenFIGI financial instrument identifier API.
The Client paces requests so a busy session stays inside the unauthenticated rate limit (25 req/min), retries transient failures (429, 5xx), and exposes two methods that cover the two live endpoints: Map and Search.
Index ¶
Constants ¶
const DefaultUserAgent = "openfigi/dev (+https://github.com/tamnd/openfigi-cli)"
DefaultUserAgent identifies the client to OpenFIGI.
const Host = "openfigi.com"
Host is the site this client's domain driver claims.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
HTTP *http.Client
UserAgent string
BaseURL string
// Rate is the minimum gap between requests. Zero means no pacing.
Rate time.Duration
Retries int
// contains filtered or unexported fields
}
Client talks to the OpenFIGI API over HTTP.
func NewClient ¶
func NewClient() *Client
NewClient returns a Client with the default config applied.
type Config ¶
Config holds tunable Client parameters.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns conservative defaults for unauthenticated access. The unauthenticated rate limit is 25 req/min, so we pace at 1s per request.
type Domain ¶
type Domain struct{}
Domain is the openfigi driver. It carries no state; the per-run client is built by the factory Register hands kit.
func (Domain) Classify ¶
Classify turns any accepted input into (uriType, id).
- Starts with "BBG" -> ("figi", input)
- Matches ISIN pattern -> ("isin", input)
- Else -> ("query", input)
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, the hostnames a pasted link is matched against, and the identity reused for the binary's help and version.
type Instrument ¶
type Instrument struct {
FIGI string `kit:"id" json:"figi"`
Name string `json:"name"`
Ticker string `json:"ticker"`
ExchCode string `json:"exch_code"`
SecurityType string `json:"security_type"`
MarketSector string `json:"market_sector"`
CompositeFIGI string `json:"composite_figi"`
}
Instrument is the output record for both Map and Search operations.