Skip to content

Fix CryptoFuture.IsCryptoCoinFuture() misclassifying USD-quoted linea…#9628

Open
iharshlalakiya wants to merge 1 commit into
QuantConnect:masterfrom
iharshlalakiya:bug-9574-crypto-future-usd-quoted-classification
Open

Fix CryptoFuture.IsCryptoCoinFuture() misclassifying USD-quoted linea…#9628
iharshlalakiya wants to merge 1 commit into
QuantConnect:masterfrom
iharshlalakiya:bug-9574-crypto-future-usd-quoted-classification

Conversation

@iharshlalakiya

Copy link
Copy Markdown

Fixes #9574

IsCryptoCoinFuture() used a quote-currency whitelist (USDT/BUSD/USDC) to distinguish linear from coin-margined futures. This broke any exchange quoting linear perpetuals in fiat USD instead of a stablecoin — the case for EU MiCA-compliant exchanges (Kraken Futures, OKX EU), which are barred from using stablecoins for derivative settlement.

Since CryptoFutureHolding.GetQuantityValue() and CryptoFutureMarginModel.GetCollateralCash() both derive their behavior from this shared classification, the misclassification cascaded into wrong holdings value, collateral attribution, and total portfolio value for USD-quoted linear futures.

IsCryptoCoinFuture now also considers market: Binance keeps its existing quote-currency heuristic (Binance's coin-margined contracts are also nominally quoted in USD, e.g. BTCUSD_PERP), while other markets are treated as linear/USD-margined, since Lean currently has no coin-margined contracts outside Binance.

Added tests confirming Binance's BTCUSD coin-margined classification is unchanged, and that a Kraken-market BTCUSD future is now correctly treated as linear.

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.

CryptoFuture.IsCryptoCoinFuture() incorrectly classifies USD-quoted linear futures as coin-margined, breaking EU MiCA-compliant exchanges

1 participant