Crate codes_iso_10383

Source
Expand description

This package contains an implementation of the ISO-10383 Securities and related financial instruments — Codes for exchanges and Market Identification (MIC) specification.

ISO 10383 specifies a universal method of identifying exchanges, trading platforms, regulated or non-regulated markets and trade reporting facilities as sources of prices and related information in order to facilitate automated processing.

It is intended for use in any application and communication for identification of places

  • where a financial instrument is listed (place of official listing),
  • where a related trade is executed (place of trade), and
  • where trade details are reported (trade reporting facility).

Note that field descriptions are taken from ISO 10383 Market Identifier Codes - Release 2.0 Factsheet.

§Example

use codes_iso_10383::{Category, MarketIdCode, Status};

let market = MarketIdCode::XNCM;
assert_eq!(market.code(), "XNCM");
assert_eq!(market.operating_code(), Some(MarketIdCode::XNAS));
assert_eq!(market.is_segment(), true);
assert_eq!(market.status(), Status::Active);
assert_eq!(market.market_category_code(), Some(Category::NSPD));
assert_eq!(market.acronym(), None);

// feature = "real_url"
// assert_eq!(market.website_url(), Some(url::Url::from_str("http://www.nasdaq.com").unwrap()));
// or
// assert_eq!(market.website_url(), Some("http://www.nasdaq.com"));

// feature = "market_name"
// assert_eq!(market.market_name(), "NASDAQ CAPITAL MARKET");

// feature = "location"
// assert_eq!(market.country_code(), Some(CountryCode::US));
// assert_eq!(market.city(), Some("NEW YORK"));

// feature = "legal_entity"
// assert_eq!(market.legal_entity_name(), None);
// assert_eq!(market.legal_entity_id(), None);

// feature = "dates"
// assert_eq!(market.creation_date(), "2008-02-25");
// assert_eq!(market.last_update_date(), Some("2008-02-25"));
// assert_eq!(market.last_validation_date(), None);
// assert_eq!(market.expiration_date(), None);

// feature = "comments"
// assert_eq!(market.comments(), Some("..."));

The following demonstrates the from_str_extended which searches the acronym values if there is not a direct MIC match via from_str.

use codes_iso_10383::MarketIdCode;
use std::str::FromStr;

assert!(MarketIdCode::from_str("NASDAQ").is_err());

let market = MarketIdCode::from_str_extended("NASDAQ");
assert!(market.is_ok());
assert_eq!(market.unwrap().code(), "XNAS");

§Features

By default only the serde feature is enabled, the MarketIdCode::code and MarketIdCode::operating_code, and MarketIdCode::is_segment methods cannot be excluded.

Enums§

Category
The Market Category specifies the type of market. The list of market types is predefined.
MarketIdCode
See more at iso.org.
MarketIdCodeError
Common Error type, mainly used for FromStr failures.
Status

Constants§

ALL_CODES
Provides an array of all defined MarketIdCode codes, useful for queries.
ISO_10383
An instance of the Standard struct defined in the codes_agency package that describes the ISO-10383 specification.