Skip to content

Add Interactive Brokers KRX future fees - #9655

Merged
Martin-Molinero merged 1 commit into
QuantConnect:masterfrom
AlexCatarino:fix-ib-fee-model-krx-futures
Aug 5, 2026
Merged

Add Interactive Brokers KRX future fees#9655
Martin-Molinero merged 1 commit into
QuantConnect:masterfrom
AlexCatarino:fix-ib-fee-model-krx-futures

Conversation

@AlexCatarino

Copy link
Copy Markdown
Member

Description

Adds a Market.KRX entry to InteractiveBrokersFeeModel's future fee map, so KOSPI 200 (KM)
futures can be traded through the Interactive Brokers brokerage.

Unlike the per contract fees of the currently supported markets, IB charges Korea Exchange
futures a flat percentage of the trade value (0.004%) that already includes the exchange,
regulatory, clearing and carrying fees, so the fee is computed from the security price and its
contract multiplier, and returned in the contract quote currency (KRW).

Also adds the KRW currency string and its display symbol to Currencies.

Related Issue

Follow up of #9585, which added the KOSPI 200 (KM) futures, and of
QuantConnect/Lean.Brokerages.InteractiveBrokers#239, its brokerage counterpart. Neither updated
the fee model.

Motivation and Context

InteractiveBrokersFeeModel only knew about Market.USA, Market.HKFE and Market.EUREX, so
the future fee lookup threw KeyNotFoundException: InteractiveBrokersFeeModel(): unexpected future Market krx for every KM order. The transaction handler catches it and invalidates the
order with Error executing margin models, so the order never reaches the brokerage:

Order Error: id: 1, Error executing margin models:
  InteractiveBrokersFeeModel(): unexpected future Market krx

This affects every KRX future order regardless of the account permissions or the market state:
the data side of the KOSPI 200 support works, but the security cannot be traded at all.

Requires Documentation Change

No.

How Has This Been Tested?

Unit tests: KoreaFutureFee in InteractiveBrokersFeeModelTests, for both the canonical and the
contract symbol, asserting the fee amount and its KRW currency. The whole
InteractiveBrokersFeeModelTests fixture passes (128 tests).

The fee rate was measured live against IB, trading the front KM contract on a paper account with
the fee model bypassed. Both legs of the round trip match 0.004% of the trade value exactly, as
reported by IB's own commission report:

Fill Price Trade value (KRW) IB commission (KRW) Rate
Buy 1 1046 1046 x 250,000 = 261,500,000 10,460 0.004%
Sell 1 1049 1049 x 250,000 = 262,250,000 10,490 0.004%

With this change, the same order placed through the standard fee model reaches IB and fills,
instead of being invalidated locally.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Refactor (non-breaking change which improves implementation)
  • Performance (non-breaking change which improves performance. Please add associated performance test and results)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Non-functional change (xml comments/documentation/etc)

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 bug-<issue#>-<description> or feature-<issue#>-<description>

🤖 Generated with Claude Code

KOSPI 200 (KM) futures were added in QuantConnect#9585, but the Interactive Brokers
fee model had no entry for Market.KRX, so its future fee lookup threw
'unexpected future Market krx'. The transaction handler surfaced it as
'Error executing margin models' and invalidated the order before it
reached the brokerage, making every KRX future order fail regardless of
the account permissions or the market state.

IB charges Korea Exchange futures a flat percentage of the trade value
that already includes the exchange, regulatory, clearing and carrying
fees, unlike the per contract fees of the other supported markets, so
the fee is computed from the security price and its contract multiplier
and returned in the contract quote currency.

Also add the KRW currency string and its display symbol.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Martin-Molinero
Martin-Molinero merged commit da1bade into QuantConnect:master Aug 5, 2026
7 of 8 checks passed
@AlexCatarino
AlexCatarino deleted the fix-ib-fee-model-krx-futures branch August 5, 2026 14:46
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