figi

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Copyright 2024 SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	OPENFIGI_MAPPING_URL string = "https://api.openfigi.com/v3/mapping"
)

Variables

This section is empty.

Functions

func Enrich

func Enrich(assets ...*data.Asset)

func FormatSyntheticFIGI

func FormatSyntheticFIGI(ticker, name string) string

FormatSyntheticFIGI is a convenience that generates a synthetic FIGI and returns it as a formatted string for logging/debugging.

func GenerateSyntheticFIGI

func GenerateSyntheticFIGI(ticker, name string) string

GenerateSyntheticFIGI generates a deterministic FIGI-format identifier for a given ticker and name. The identifier uses the "PV" issuer prefix to distinguish it from real OpenFIGI-assigned identifiers.

Format: PVG{8 alphanumeric chars}{check digit}

The 8 body characters are derived from a SHA-256 hash of "ticker|name" mapped onto the valid FIGI alphabet.

func IsSyntheticFIGI

func IsSyntheticFIGI(figi string) bool

IsSyntheticFIGI returns true if the given FIGI was generated by GenerateSyntheticFIGI (i.e., has the "PVG" prefix).

func LoadCacheFromDB

func LoadCacheFromDB(ctx context.Context, dbConn *pgxpool.Conn)

func LookupFigi

func LookupFigi(assets []*data.Asset, rateLimiter *rate.Limiter) map[string]*OpenFigiAsset

func LookupFigiUnlisted

func LookupFigiUnlisted(assets []*data.Asset, rateLimiter *rate.Limiter) map[string]*OpenFigiAsset

func MapInstance

func MapInstance() *haxmap.Map[string, string]

func RateLimit

func RateLimit() *rate.Limiter

func ValidateFIGICheckDigit

func ValidateFIGICheckDigit(figi string) bool

ValidateFIGICheckDigit validates whether the 12th character of a FIGI identifier is the correct check digit per the modified Luhn algorithm.

Types

type MappingResponse

type MappingResponse struct {
	Data []*OpenFigiAsset `json:"data"`
}

type OpenFigiAsset

type OpenFigiAsset struct {
	Figi                string `json:"figi"`
	SecurityType        string `json:"securityType"`
	MarketSector        string `json:"marketSector"`
	Ticker              string `json:"ticker"`
	Name                string `json:"name"`
	ExchangeCode        string `json:"exchCode"`
	ShareClassFIGI      string `json:"shareClassFIGI"`
	CompositeFIGI       string `json:"compositeFIGI"`
	SecurityType2       string `json:"securityType2"`
	SecurityDescription string `json:"securityDescription"`
}

type OpenFigiQuery

type OpenFigiQuery struct {
	IdType                  string `json:"idType"`
	IdValue                 string `json:"idValue"`
	ExchangeCode            string `json:"exchCode"`
	MarketSectorDescription string `json:"marketSecDes"`
	IncludeUnlistedEquities *bool  `json:"includeUnlistedEquities,omitempty"`
}

Jump to

Keyboard shortcuts

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