-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Feature 5285 ig brokerage integration #9266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Feature 5285 ig brokerage integration #9266
Conversation
- Add IGBrokerageModel with support for Forex, CFD, Crypto, Index, Equity - Add IG market constant to Market.cs - Add IG configuration entries to Launcher/config.json - Configure zero fee model (fees built into spread) - Support Market, Limit, StopMarket, StopLimit order types
Update all project files to target .NET 6.0 instead of net10.0. This change addresses SDK compatibility while the codebase uses C# 12 features. Note: Building requires .NET 8+ SDK due to C# 12 syntax in Compression.cs. The net6.0 target is for runtime compatibility.
- Add IGFeeModel implementing IG Markets fee structure * Forex/Crypto: Zero commission (spread-based) * Index/CFD/Equity: 0.1% commission with £10 GBP minimum - Update IGBrokerageModel to use IGFeeModel instead of ConstantFeeModel - Add IG to BrokerageName enum for transaction and execution rules This completes the Lean engine integration for the IG Markets brokerage.
|
Hi @fabiankliem! Thanks for the contribution. Please revert the .net6 changes in LEAN and upgrade the brokerage to support .net10. Please test locally completely -- doing live trading -- before making a PR here. You can run the nunit regression tests to confirm a lot of it works (doubt these have been run at all). Once nunit passes have LEAN compose the IG DLL as a brokerage and run a local test. Post a screen shot of the LEAN instance running and logging market data sourced the IG brokerage, and placing trades. Will leave open for a week but will close soon as will take a fair bit of work to get ready for production. I'm not sure if prepared to take on this 😅 Claude's good but not quite up to implementing brokerages yet. |
|
Hi @jaredbroad, thanks for taking a look. Will take care of it and do another PR once done. |
Revert all 23 .csproj files from net6.0 back to net10.0, undoing the temporary framework downgrade (e78a022). The IG brokerage plugin and all LEAN projects now target .NET 10. IG Markets integration changes: - Register IG market (ID 43) in Market.cs with HardcodedMarkets entry - Add BrokerageName.IG enum value and IGBrokerageModel to IBrokerageModel - Add IG market hours and symbol properties to data databases - Add live-ig environment and IG configuration keys to Launcher config.json - Add IGLiveTestAlgorithm for live trading validation Verified: LEAN builds with 0 errors on .NET 10, IG brokerage composes via MEF, live test confirms Lightstreamer streaming, market data, and trade execution all working.
|
@jaredbroad all nunit tests passing. See screenshot attached of LEAN instance running, getting data and placing trades. |
|
Epic we'll review shortly and let you know further feedback. |
|
Hi @fabiankliem - can you please get in touch to assist with testing this? We'd love to merge your work. I sent you a connection request on LinkedIn |

Description
This PR adds complete IG Markets brokerage integration to the Lean engine core. The changes include:
IGFeeModel.cs - New fee model implementing IG Markets pricing structure:
IGBrokerageModel.cs - Updated to return
IGFeeModelinstead ofConstantFeeModel(0m)BrokerageName.cs - Added
IGenum value to enable transaction and execution rules for IG MarketsRelated Issue
Closes #5285 - Add IG Markets brokerage support
Complete brokerage implementation available at: https://github.com/fabiankliem/Lean.Brokerages.IG
Motivation and Context
IG Markets is a leading global CFD and spread betting provider with access to forex, indices, commodities, cryptocurrencies, and equities. This integration enables Lean users to:
The fee model correctly implements IG's pricing:
This follows the same pattern as existing brokerages (FXCM, OANDA, TradeStation, etc.) and integrates seamlessly with Lean's brokerage framework.
Requires Documentation Change
No documentation changes required. IG configuration is already present in
Launcher/config.json:live-igenvironment: lines 470-483How Has This Been Tested?
Testing Environment:
Tests Performed:
Fee Calculation Tests (20+ unit tests in brokerage plugin):
Brokerage Model Tests (8+ integration tests):
Integration Tests:
All tests pass successfully. Test files available in:
Lean.Brokerages.IG/QuantConnect.IGBrokerage.Tests/Types of changes
Checklist:
bug-<issue#>-<description>orfeature-<issue#>-<description>*Additional Context:
Files Changed:
Common/Orders/Fees/IGFeeModel.cs(new file, 117 lines)Common/Brokerages/IGBrokerageModel.cs(updated GetFeeModel method)Common/Brokerages/BrokerageName.cs(added IG enum value)Complete Implementation:
The full brokerage implementation includes:
Repository: https://github.com/fabiankliem/Lean.Brokerages.IG