Skip to content

Add KOSPI 200 Index (KM) Futures#9585

Merged
Martin-Molinero merged 4 commits into
QuantConnect:masterfrom
AlexCatarino:feature-km-futures
Jul 14, 2026
Merged

Add KOSPI 200 Index (KM) Futures#9585
Martin-Molinero merged 4 commits into
QuantConnect:masterfrom
AlexCatarino:feature-km-futures

Conversation

@AlexCatarino

@AlexCatarino AlexCatarino commented Jul 2, 2026

Copy link
Copy Markdown
Member
  • Add Market.KRX (Korea Exchange) constant with market id 43
  • Add Futures.Indices.Kospi200 = "KM" constant
  • Add expiry function: last trading day is the second Thursday of the contract month (quarterly Mar/Jun/Sep/Dec), holiday-adjusted backward, terminating 15:20 KST
  • Add symbol properties: multiplier 250,000, tick 0.05 (krx, KRW), plus krx,[*] index wildcard
  • Add margin file Data/future/krx/margins/KM.csv (placeholder from current KRX rates: initial 8.1%, maintenance 5.4%)
  • Add Future-krx-KM and Future-krx-[*] market-hours entries (Asia/Seoul, 09:00–15:45 with 08:00–09:00 pre-open auction)
  • Add 8 test date pairs (2024–2025 quarterly contracts) to FuturesExpiryFunctionsTestData.xml
  • Add [TestCase(Indices.Kospi200, ThreeTwentyPMKoreaTime)] to IndicesExpiryDateFunction_WithDifferentDates_ShouldFollowContract

Description

Adds LEAN support for the KOSPI 200 Index Futures (KM) traded on the Korea Exchange (KRX). KOSPI 200 futures are cash-settled, quoted in KRW with a KRW 250,000 point multiplier and 0.05 tick, listed on the quarterly March/June/September/December cycle.

⚠️ Draft — placeholder values to firm up before merging

This PR is intentionally a draft. Two values are placeholders and should be confirmed against authoritative KRX sources before it is marked ready for review:

  1. Margin file (Data/future/krx/margins/KM.csv) — the initial/maintenance amounts are not real historical KRX margins. They were derived from the current KRX margin rates (initial 8.1%, maintenance 5.4%) applied to a representative notional (index ≈ 350 × KRW 250,000 ≈ KRW 87.5M), giving initial 7,087,500 / maintenance 4,725,000 under the 19900101 placeholder date. This should be replaced with the exchange's published performance-bond schedule (ideally with historical change dates).
  2. Last-trading-day settlement time (15:20 KST) — encoded as TimeSpan(15, 20, 0) in the expiry function and mirrored by the ThreeTwentyPMKoreaTime = "15:20:00" test constant. Sources vary on the exact termination time of the expiring contract (15:15 / 15:20 / 15:45 KST). If a different time is authoritative, it is a one-line change in both FuturesExpiryFunctions.cs and FuturesExpiryFunctionsTests.cs.

The contract multiplier (KRW 250,000/point), tick (0.05), currency (KRW), quarterly cycle, and second-Thursday last-trading-day rule are confirmed and not placeholders.

Related Issue

No linked issue.

Motivation and Context

The KOSPI 200 future is one of the most actively traded index futures in Asia. Without this entry, users cannot trade or backtest KOSPI 200 futures in LEAN.

Requires Documentation Change

N/A

How Has This Been Tested?

Added test cases to Tests/Common/Securities/Futures/FuturesExpiryFunctionsTests.cs. All futures expiry tests pass locally (Failed: 0, Passed: 192), and Market / SymbolPropertiesDatabase / MarketHoursDatabase test suites pass (Failed: 0, Passed: 152).

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the code style of this project.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My branch follows the naming convention feature-[description]

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
AlexCatarino and others added 3 commits July 7, 2026 19:26
Expand the compact single-line session arrays in Forex-interactivebrokers-[*]
to the multi-line style used throughout the market-hours database.

Add South Korean (KRX) market-closure holidays (2000-2027) to Future-krx-[*]
and Future-krx-KM, including lunar holidays (Seollal, Buddha's Birthday,
Chuseok), substitute holidays, election-day closures, year-end closures, and
the reinstated Constitution Day (7/17/2026 onward).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Enables USD/KRW live trading/pricing through the Interactive Brokers
brokerage.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Roll non-quarterly contract months forward to the HMUZ cycle in the
  Kospi200 expiry function, with regression tests covering the cycle
  normalization and holiday walk-backs (2002 election day, Chuseok
  2003 double walk-back, Chuseok 2019)
- Remove holidays duplicated in Future-krx-KM: they are inherited from
  Future-krx-[*] at load time (MarketHoursDatabaseJsonConverter unions
  specific entries with the market wildcard)
- Add missing KRX closures: Constitution Day 2000-2007 (holiday until
  abolished in 2008), 7/1/2002 World Cup temporary holiday and
  1/3/2000 Y2K closure
- Fix KRX derivatives sessions per exchange specs: regular session
  08:45-15:45 (pre-open auction 08:30-08:45) and night session
  18:00-06:00 as extended hours
- Add late opens (09:45) for the first trading day of each year and
  CSAT exam days 2000-2027, which delay the exchange open by one hour
- Add Index-krx market hours entries (09:00-15:30, 10:00 late opens)
  and map the KM index ticker to Market.KRX in IndexSymbol

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Martin-Molinero
Martin-Molinero marked this pull request as ready for review July 14, 2026 19:34
@Martin-Molinero
Martin-Molinero merged commit 3a39c58 into QuantConnect:master Jul 14, 2026
7 of 8 checks passed
Martin-Molinero added a commit to QuantConnect/Lean.Brokerages.InteractiveBrokers that referenced this pull request Jul 15, 2026
* Add Interactive Brokers KOSPI 200 (KM) futures support

Route KM/Market.KRX futures to IB's KSE exchange and map IB's K200 ticker
to LEAN's KM root, the brokerage counterpart to QuantConnect/Lean#9585.

Also allow Forex subscriptions on Market.InteractiveBrokers so LEAN can
derive the KRW->USD conversion rate from IB's USD/KRW spot (CASH IDEALPRO)
feed, which is required to value KRW-denominated KOSPI 200 positions in a
USD account.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Support KM index data

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Martin Molinero <martin.molinero1@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants