OpenFIGI (https://api.openfigi.com/v3), Bloomberg's free and open symbology API: map ISINs, CUSIPs, SEDOLs, tickers and other identifiers to FIGIs, search and filter FIGIs by keyword and attributes, and list the values each mapping field accepts.

OpenFIGI returns identifiers and descriptive fields only (figi, name, ticker, exchCode, securityType, securityType2, marketSector, compositeFIGI, shareClassFIGI, securityDescription). It has no prices or reference data.

Request fields keep OpenFIGI's own names (idType, idValue, exchCode, micCode, currency, marketSecDes, securityType, securityType2, includeUnlistedEquities, optionType, strike, contractSize, coupon, expiration, maturity, stateCode), so the OpenFIGI documentation applies as written. Every function takes an optional trailing opts Map: api-key, base-url, and where it applies filters (extra request fields) and start (a page token).

Context Vars

Optional
  • openfigi.api-key
  • openfigi.base-url

Values

CHAR_VALUES

CHAR_VALUES: Map {
  "0": 0,
  "1": 1,
  "2": 2,
  "3": 3,
  "4": 4,
  "5": 5,
  "6": 6,
  "7": 7,
  "8": 8,
  "9": 9,
  A: 10,
  B: 11,
  C: 12,
  D: 13,
  E: 14,
  F: 15,
  G: 16,
  H: 17,
  I: 18,
  J: 19,
  K: 20,
  L: 21,
  M: 22,
  N: 23,
  O: 24,
  P: 25,
  Q: 26,
  R: 27,
  S: 28,
  T: 29,
  U: 30,
  V: 31,
  W: 32,
  X: 33,
  Y: 34,
  Z: 35
}

RESERVED_PREFIXES

RESERVED_PREFIXES: Vec [
  "BS",
  "BM",
  "GG",
  "GB",
  "GH",
  "KY",
  "VG"
]

VALUE_KEYS

VALUE_KEYS: Vec [
  "idType",
  "exchCode",
  "micCode",
  "currency",
  "marketSecDes",
  "securityType",
  "securityType2"
]

Functions

by-cusip

fn (cusip: Str): Vec<Map>
fn (cusip: Str, opts: Map): Vec<Map>

FIGIs for a nine-character CUSIP (ID_CUSIP).

Example

figis ::openfigi/by-cusip("037833100", {filters: {exchCode: "US"}})
map(figis, %.figi)

by-figi

fn (figi: Str): Map?
fn (figi: Str, opts: Map): Map?

The record for a FIGI (ID_BB_GLOBAL), or null when OpenFIGI has none.

Example

record ::openfigi/by-figi("BBG000B9XRY4")

// Null when OpenFIGI has no record for the FIGI
if(is-some(record), record.name, "not found")

by-isin

fn (isin: Str): Vec<Map>
fn (isin: Str, opts: Map): Vec<Map>

FIGIs for an ISIN (ID_ISIN). One ISIN usually maps to a FIGI per listing; add {filters: {exchCode: "US"}} to narrow it.

Example

figis ::openfigi/by-isin("US0378331005", {filters: {exchCode: "US"}})
map(figis, %.ticker)

by-sedol

fn (sedol: Str): Vec<Map>
fn (sedol: Str, opts: Map): Vec<Map>

FIGIs for a SEDOL (ID_SEDOL).

Example

figis ::openfigi/by-sedol("2046251")
map(figis, %.name)

by-ticker

fn (ticker: Str, exch-code: Str?): Vec<Map>
fn (ticker: Str, exch-code: Str?, opts: Map): Vec<Map>

FIGIs for a ticker on one exchange (TICKER with exchCode, e.g. "US" for the US composite, "LN" for London). Pass null as exch-code to match every exchange.

Example

first(::openfigi/by-ticker("IBM", "US")).figi   // "BBG000BLNNH6"

check-digit

fn (s: Str): Int

The FIGI check digit for the first 11 characters (pure): letters count A=10 … Z=35, every second character's value is doubled, the digits of all values are summed, and the check digit is (10 - sum mod 10) mod 10.

Example

::openfigi/check-digit("BBG000B9XRY")  // 4

collect

fn (fetch: Fn, opts: Map, limit: Int): Vec

Follow next tokens until limit items or the last page. fetch takes opts (with start set after the first page) and returns one page. Mind the search rate limit: each page is one request.

Example

::openfigi/collect((o) { ::openfigi/search("ibm", o) }, {filters: {exchCode: "US"}}, 300)

filter-figis

fn (opts: Map): Map
fn (query: Str?, opts: Map): Map

One page of FIGIs matching filters and optional keywords (POST /filter), sorted by FIGI. Returns {data, next, total}, where total counts every match. Shares the search rate limit.

Example

::openfigi/filter-figis({filters: {exchCode: "US", securityType2: "Common Stock"}}).total

is-figi

fn (figi: Any): Bool

True for a syntactically valid FIGI (pure): 12 characters, two consonants (not a reserved ISIN country prefix), G, eight consonants or digits, and a valid check digit.

Example

::openfigi/is-figi("BBG000B9XRY4")   // true
// A bad check digit
::openfigi/is-figi("BBG000B9XRY5")   // false

job

fn (id-type: Str, id-value: Any): Map
fn (id-type: Str, id-value: Any, extra: Map?): Map

One mapping job (pure): {idType, idValue} plus any extra request fields, with null values dropped.

Example

::openfigi/job("TICKER", "IBM", {exchCode: "US"})
// {idType: "TICKER", idValue: "IBM", exchCode: "US"}

map-all

fn (jobs: Vec): Vec<Map>
fn (jobs: Vec, opts: Map): Vec<Map>

Map any number of jobs, split into requests of the per-request limit, one after another. Returns [{job, figis, warning, error}] in job order (see mapping-results). The first failed request (often a 429) ends the call with its Err; nothing retries inside a run.

Without a key that is 10 jobs per request and 25 requests a minute, so about 250 jobs a minute; with a key, 100 jobs and 250 requests.

Example

isins ["US0378331005", "US4592001014", "US5949181045"]
out ::openfigi/map-all(map(isins, (i) { ::openfigi/job("ID_ISIN", i, {exchCode: "US"}) }))
map(out, (r) { [r.job.idValue, get(first(r.figis), "figi")] })

map-id

fn (id-type: Str, id-value: Any): Vec<Map>
fn (id-type: Str, id-value: Any, opts: Map): Vec<Map>

Map one identifier and return its FIGIs, or [] when OpenFIGI finds none. An Err when OpenFIGI rejects the job ("Invalid idValue format.", "securityType2 required with BASE_TICKER(idType)."). opts.filters adds request fields such as exchCode or currency.

Example

::openfigi/map-id("ID_CUSIP", "037833100", {filters: {exchCode: "US"}})

map-jobs

fn (jobs: Vec): Vec<Map>
fn (jobs: Vec, opts: Map): Vec<Map>

One POST /mapping call. Returns OpenFIGI's results in job order, one per job: {data: [figi, ...]}, {warning: "No identifier found."} or {error: "..."} (an invalid job, e.g. "Invalid idValue format."). An Err before any request when jobs holds more than the per-request limit (10 without a key, 100 with one); use map-all for longer lists.

Example

::openfigi/map-jobs([
  {idType: "ID_ISIN", idValue: "US0378331005", exchCode: "US"},
  {idType: "TICKER", idValue: "IBM", exchCode: "US"}
])

mapping-results

fn (jobs: Vec, results: Vec): Vec<Map>

Pair jobs with their raw results (pure): [{job, figis, warning, error}], where figis is [] unless the job matched. A missing result (a short response) counts as an error.

Example

jobs [::openfigi/job("TICKER", "IBM", {exchCode: "US"}), ::openfigi/job("TICKER", "NOPE")]
out ::openfigi/mapping-results(jobs, [{data: [{figi: "BBG000BLNNH6"}]}, {warning: "No identifier found."}])
first(out[0].figis).figi  // "BBG000BLNNH6"
out[1].figis  // []
out[1].warning  // "No identifier found."
fn (query: Str): Map
fn (query: Str, opts: Map): Map

One page (up to 100) of FIGIs matching keywords and filters (POST /search). Returns {data, next}; next is present when more pages exist and goes back as opts.start. OpenFIGI allows 5 searches a minute without a key and 20 with one.

Example

page ::openfigi/search("apple", {filters: {exchCode: "US", securityType: "Common Stock"}})
first(page.data).ticker   // "AAPL"

search-body

fn (query: Str?, opts: Map): Map

The request body for /search or /filter (pure): query, opts.filters and opts.start, with null and blank values dropped.

Example

::openfigi/search-body("apple", {filters: {exchCode: "US", currency: null}})  // {query: "apple", exchCode: "US"}
::openfigi/search-body(null, {filters: {exchCode: "US"}, start: "tok"})  // {exchCode: "US", start: "tok"}

values

fn (key: Str): Vec<Str>
fn (key: Str, opts: Map): Vec<Str>

The values a mapping field accepts (GET /mapping/values/{key}): key is one of idType, exchCode, micCode, currency, marketSecDes, securityType, securityType2. Counts against the mapping rate limit; the lists change rarely, so cache them.

Example

::openfigi/values("marketSecDes")   // ["Comdty", "Corp", "Curncy", ...]