Files
sure/config/exchanges.yml
Artem Danilov b57bb938da feat(prices): add Moscow Exchange (MOEX ISS) securities + FX provider (#2394)
* feat(prices): add Moscow Exchange (MOEX ISS) securities + FX provider

Add Provider::MoexPublic, a keyless provider built on the free MOEX ISS API
(https://iss.moex.com/iss), modeled on Provider::BinancePublic.

Securities: shares, funds/ETF/БПИФ (e.g. LQDT), and bonds (OFZ + corporate).
Bonds are priced clean — LAST% × FACEVALUE / 100 in the instrument currency,
with per-row FACEVALUE for amortizing issues; NKD/accrued coupon excluded.

Exchange rates: also implements ExchangeRateConcept for RUB↔{USD,EUR,CNY} via
selt TOM instruments (USD000UTSTOM/EUR_RUB__TOM/CNYRUB_TOM); the selt quote is
X/RUB, inverted for RUB→X, nil for non-RUB-crossed pairs.

Details:
- Board/engine resolution via the ISS primary-board flag with a hardcoded
  priority fallback (TQBR, TQTF, TQOB, TQCB, …).
- Instrument currency from CURRENCYID/FACEUNIT (handles USD/CNY eurobonds &
  FX funds), normalizing legacy SUR/RUR → RUB; default RUB.
- Full history via from/till + start= pagination; current price fallback chain
  LAST → MARKETPRICE → LCURRENTPRICE → LCLOSEPRICE → PREVPRICE → latest history
  close.
- Bare SECID identity, exchange_operating_mic=MISX, country_code=nil (wildcard
  like Binance); search accepts .ME/.MOEX/.MISX/.MCX aliases and ISIN.
- RateLimitable throttling, SslConfigurable, Faraday retry/timeouts; all public
  methods wrapped in with_provider_response.

Wired into Provider::Registry for both :securities and :exchange_rates, the
hosting provider-selection UI, locales, and config/exchanges.yml (MISX).

Docker-tested (devcontainer, Ruby 3.4.9): 29 new tests green, full provider
suite + i18n green, rubocop clean; smoke-tested against live ISS (SBER price,
OFZ clean price, USD/RUB FX).

* fix(moex): address review — FX weekend lookback, dead branch, translated hints

- fetch_exchange_rate now fetches a 10-day lookback window (not just the exact
  day) so a weekend/holiday request resolves to the prior trading day's close,
  matching Yahoo's behavior (Codex P2).
- Remove dead identical if/else branches in history_row_price (CodeRabbit).
- Translate moex_public_hint into ca/fr/hu/vi/zh-CN instead of English copy
  (CodeRabbit).
- Add a test covering the FX prior-trading-day lookback.

* fix(moex): guard ISS date parsing; doc TQTE in board priority

Address maintainer review (jjmata):
- parse_iss_date wraps Date.parse so a malformed ISS TRADEDATE skips just that
  row (with a contextual log warning) instead of failing the whole history/FX
  fetch. Used in history_row_price and fx_history.
- Add TQTE to the BOARD_PRIORITY doc comment (it was in the constant but missing
  from the comment).
- Add a test covering the unparseable-date skip.
2026-06-18 10:36:20 +02:00

324 lines
4.1 KiB
YAML

# ISO 10383 MIC codes mapped to user-friendly exchange names
# Source: https://www.iso20022.org/market-identifier-codes
#
# Format:
# MIC_CODE:
# name: Display Name
# country: ISO 3166-1 alpha-2 country code (optional, for future use)
# United States - NASDAQ family (Operating MIC: XNAS)
XNAS:
name: NASDAQ
country: US
XNGS:
name: NASDAQ
country: US
XNMS:
name: NASDAQ
country: US
XNCM:
name: NASDAQ
country: US
XBOS:
name: NASDAQ BX
country: US
XPSX:
name: NASDAQ PSX
country: US
XNDQ:
name: NASDAQ Options
country: US
# United States - NYSE family (Operating MIC: XNYS)
XNYS:
name: NYSE
country: US
ARCX:
name: NYSE Arca
country: US
XASE:
name: NYSE American
country: US
XCHI:
name: NYSE Chicago
country: US
XCIS:
name: NYSE National
country: US
AMXO:
name: NYSE American Options
country: US
ARCO:
name: NYSE Arca Options
country: US
# United States - OTC Markets (Operating MIC: OTCM)
OTCM:
name: OTC Markets
country: US
PINX:
name: OTC Pink
country: US
OTCQ:
name: OTCQX
country: US
OTCB:
name: OTCQB
country: US
PSGM:
name: OTC Grey
country: US
# United States - Other
XCBO:
name: CBOE
country: US
XCME:
name: CME
country: US
XCBT:
name: CBOT
country: US
XNYM:
name: NYMEX
country: US
BATS:
name: CBOE BZX
country: US
EDGX:
name: CBOE EDGX
country: US
IEXG:
name: IEX
country: US
MEMX:
name: MEMX
country: US
# United Kingdom
XLON:
name: London Stock Exchange
country: GB
XLME:
name: London Metal Exchange
country: GB
# Germany
XETR:
name: Xetra
country: DE
XFRA:
name: Frankfurt
country: DE
XSTU:
name: Stuttgart
country: DE
XMUN:
name: Munich
country: DE
XBER:
name: Berlin
country: DE
XHAM:
name: Hamburg
country: DE
XDUS:
name: Düsseldorf
country: DE
XHAN:
name: Hannover
country: DE
# Euronext
XPAR:
name: Euronext Paris
country: FR
XAMS:
name: Euronext Amsterdam
country: NL
XBRU:
name: Euronext Brussels
country: BE
XLIS:
name: Euronext Lisbon
country: PT
XDUB:
name: Euronext Dublin
country: IE
XOSL:
name: Euronext Oslo
country: "NO"
XMIL:
name: Euronext Milan
country: IT
# Other Europe
XSWX:
name: SIX Swiss
country: CH
XVTX:
name: SIX Swiss
country: CH
XMAD:
name: BME Madrid
country: ES
XWBO:
name: Vienna
country: AT
XCSE:
name: Copenhagen
country: DK
XHEL:
name: Helsinki
country: FI
XSTO:
name: Stockholm
country: SE
XICE:
name: Iceland
country: IS
XPRA:
name: Prague
country: CZ
XWAR:
name: Warsaw
country: PL
XATH:
name: Athens
country: GR
XIST:
name: Istanbul
country: TR
# Canada
XTSE:
name: Toronto
country: CA
XTSX:
name: TSX Venture
country: CA
XCNQ:
name: CSE
country: CA
NEOE:
name: NEO
country: CA
# Australia & New Zealand
XASX:
name: ASX
country: AU
XNZE:
name: NZX
country: NZ
# Asia - Japan
XTKS:
name: Tokyo
country: JP
XJPX:
name: Japan Exchange
country: JP
XOSE:
name: Osaka
country: JP
XNGO:
name: Nagoya
country: JP
XSAP:
name: Sapporo
country: JP
XFKA:
name: Fukuoka
country: JP
# Asia - China
XSHG:
name: Shanghai
country: CN
XSHE:
name: Shenzhen
country: CN
XHKG:
name: Hong Kong
country: HK
# Asia - Other
XKRX:
name: Korea Exchange
country: KR
XKOS:
name: KOSDAQ
country: KR
XTAI:
name: Taiwan
country: TW
XSES:
name: Singapore
country: SG
XBKK:
name: Thailand
country: TH
XIDX:
name: Indonesia
country: ID
XKLS:
name: Malaysia
country: MY
XPHS:
name: Philippines
country: PH
XBOM:
name: BSE India
country: IN
XNSE:
name: NSE India
country: IN
# Latin America
XMEX:
name: Mexico
country: MX
XBUE:
name: Buenos Aires
country: AR
XBOG:
name: Colombia
country: CO
XSGO:
name: Santiago
country: CL
BVMF:
name: B3 Brazil
country: BR
XLIM:
name: Lima
country: PE
# Crypto exchanges
BNCX:
name: Binance
country: AE
# Middle East & Africa
XTAE:
name: Tel Aviv
country: IL
XDFM:
name: Dubai
country: AE
XADS:
name: Abu Dhabi
country: AE
XSAU:
name: Saudi (Tadawul)
country: SA
XJSE:
name: Johannesburg
country: ZA
# Russia - Moscow Exchange (Operating MIC: MISX)
MISX:
name: Moscow Exchange
country: RU