Skip to content

Add venue config option for IB #2851

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

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft

Add venue config option for IB #2851

wants to merge 2 commits into from

Conversation

sunlei
Copy link
Collaborator

@sunlei sunlei commented Aug 14, 2025

Pull Request

  • I have reviewed the CONTRIBUTING.md and followed the established practices

Summary

Add venue config option for IB.

Type of change

  • New feature (non-breaking)

@sunlei sunlei marked this pull request as draft August 14, 2025 17:39
@faysou
Copy link
Collaborator

faysou commented Aug 14, 2025

I don't think it makes sense to use another value than IB_VENUE for IB, the whole adapter needs this constant. Because account updates from IB come for the full IB, it's not by venue, or sub venue, and we use IB_VENUE as convention. IB_VENUE is used as constant in other places in the system, in the cache and the risk engine. So basically the IB adapater shouldn't be used with another venue as config.

@sunlei
Copy link
Collaborator Author

sunlei commented Aug 15, 2025

@faysou

This PR is similar to a previously merged one: #1738

In the IB-based strategy I'm currently developing, I need to operate multiple accounts within a single strategy to perform order-related operations.

I made these changes to allow configuring multiple clients in TradingNodeConfig.exec_clients, as shown in the example below:

exec_clients={
    "IB_ACCOUNT_1": InteractiveBrokersExecClientConfig(
        venue=Venue("IB_ACCOUNT_1"),
        ibg_host=ibg_host,
        ibg_port=ibg_port,
        ibg_client_id=ibg_client_id,
        account_id=account_id,
        instrument_provider=instrument_provider,
    ),
    "IB_ACCOUNT_2": InteractiveBrokersExecClientConfig(
        venue=Venue("IB_ACCOUNT_2"),
        ibg_host=ibg_host,
        ibg_port=ibg_port,
        ibg_client_id=ibg_client_id,
        account_id=account_id,
        instrument_provider=instrument_provider,
    ),
},

It's somewhat similar in that both aim to configure multiple exec_clients.
The difference is that I'm doing it to set up multiple accounts, whereas the example is configuring different venues:
https://github.com/nautechsystems/nautilus_trader/blob/develop/examples/live/binance/binance_spot_and_futures_market_maker.py

@faysou
Copy link
Collaborator

faysou commented Aug 15, 2025

Ok IB_VENUE is used as constant in nautilus, you would need to think of what to do so it works not only with this constant. You need to search for IB_VENUE or IB in the code base.

@sunlei
Copy link
Collaborator Author

sunlei commented Aug 15, 2025

@faysou Thank you.

I've already searched for IB_VENUE and identified the areas that need modification.

However, I haven't developed the specific trading logic yet, which is why I've set this PR as a draft. I'll make further adjustments based on the actual development progress.
Once I've confirmed everything is working fine in live trading, I'll update the status of the current PR.

@faysou
Copy link
Collaborator

faysou commented Aug 15, 2025

Ok thank you

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