Add Interactive Brokers KRX future fees - #9655
Merged
Martin-Molinero merged 1 commit intoAug 5, 2026
Merged
Conversation
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
approved these changes
Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a
Market.KRXentry toInteractiveBrokersFeeModel'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
KRWcurrency string and its₩display symbol toCurrencies.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
InteractiveBrokersFeeModelonly knew aboutMarket.USA,Market.HKFEandMarket.EUREX, sothe future fee lookup threw
KeyNotFoundException: InteractiveBrokersFeeModel(): unexpected future Market krxfor every KM order. The transaction handler catches it and invalidates theorder with
Error executing margin models, so the order never reaches the brokerage: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:
KoreaFutureFeeinInteractiveBrokersFeeModelTests, for both the canonical and thecontract symbol, asserting the fee amount and its KRW currency. The whole
InteractiveBrokersFeeModelTestsfixture 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:
With this change, the same order placed through the standard fee model reaches IB and fills,
instead of being invalidated locally.
Types of changes
Checklist:
bug-<issue#>-<description>orfeature-<issue#>-<description>🤖 Generated with Claude Code