Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Avhz RustQuant Financial Standards

From Leeroopedia


Knowledge Sources
Domains Financial_Infrastructure, Regulatory_Standards
Last Updated 2026-02-07 21:00 GMT

Overview

RustQuant implements key ISO financial standards -- ISO 4217 (currencies), ISO 3166 (countries), ISO 10383 (market identifiers), and ISIN (securities identification) -- providing strongly typed representations for use across the library's financial instruments.

Description

Financial standards provide the canonical identifiers used throughout global financial markets. RustQuant encodes four major standards as Rust types.

ISO 4217 -- Currency Codes: The ISO_4217 struct stores the alphabetic code (e.g., "USD") and the numeric code (e.g., "840"). Currency codes follow the convention where the first two letters correspond to the ISO 3166 country code and the third letter is derived from the currency name. The module defines constants for over 150 currencies (e.g., USD, EUR, GBP, JPY), enabling type-safe currency handling across the library's bond, option, and foreign exchange modules.

ISO 3166 -- Country Codes: The ISO_3166 struct provides three representations for each country: the alpha-2 code (e.g., "US"), the alpha-3 code (e.g., "USA"), and the numeric code (e.g., "840"). The module includes constants for all 249 countries and territories defined by the standard and provides a from_alpha_2 lookup function for converting string codes to structured types. These codes are used by the calendar system to identify which holiday schedule applies to a given market.

ISO 10383 -- Market Identifier Codes (MIC): The ISO_10383 struct represents a securities exchange or trading venue with fields for the operating MIC, country code, operating/segment flag, status (Active, Updated, or Expired), city, and a textual description. The OperatingOrSegment enum distinguishes between operating-level MICs (identifying the exchange operator) and segment-level MICs (identifying specific market segments). This standard links exchanges to their associated business calendars and regulatory jurisdictions.

ISIN -- International Securities Identification Number: The ISIN struct decomposes a 12-character securities identifier into its three components: the ISO 3166 alpha-2 country code (2 characters), the NSIN (National Securities Identifying Number, 9 characters), and a check digit (1 character). For example, Apple Inc.'s ISIN is US0378331005, where "US" is the country, "037833100" is the NSIN, and "5" is the check digit.

Usage

Use financial standards when defining currencies for bonds and options, identifying the country or exchange associated with a financial instrument, linking instruments to their appropriate calendars and regulatory frameworks, or validating securities identifiers. These types ensure consistency and prevent errors from mismatched or malformed identifiers.

Theoretical Basis

ISO financial standards are maintained by the International Organization for Standardization and serve as the universal language of global financial markets:

  • ISO 4217 assigns unique three-letter and three-digit codes to each currency, eliminating ambiguity in multi-currency systems. The standard also covers supranational currencies (e.g., XDR for Special Drawing Rights) and precious metals (e.g., XAU for gold).
  • ISO 3166 partitions the world into uniquely identified jurisdictions, enabling automated routing of regulatory, tax, and settlement rules based on country of issuance.
  • ISO 10383 uniquely identifies trading venues worldwide using four-character codes, supporting trade reporting, regulatory compliance (e.g., MiFID II), and market data distribution.
  • ISIN (defined by ISO 6166) provides a globally unique identifier for any financial security. The check digit is computed using the Luhn algorithm applied to the numeric encoding of the ISIN string, providing basic error detection.

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment