Skip to content

Commit

Permalink
Ignore order and account updates when running only as a data provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin-Molinero committed Sep 20, 2024
1 parent f206733 commit f8ca4ce
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1284,17 +1284,21 @@ private void Initialize(

_client = new IB.InteractiveBrokersClient(_signal);

// set up event handlers
_client.UpdatePortfolio += HandlePortfolioUpdates;
_client.OrderStatus += HandleOrderStatusUpdates;
_client.OpenOrder += HandleOpenOrder;
_client.OpenOrderEnd += HandleOpenOrderEnd;
// running as a data provider only
if (_algorithm != null)
{
// set up event handlers
_client.UpdatePortfolio += HandlePortfolioUpdates;
_client.OrderStatus += HandleOrderStatusUpdates;
_client.OpenOrder += HandleOpenOrder;
_client.OpenOrderEnd += HandleOpenOrderEnd;
_client.ExecutionDetails += HandleExecutionDetails;
_client.CommissionReport += HandleCommissionReport;
}
_client.UpdateAccountValue += HandleUpdateAccountValue;
_client.AccountSummary += HandleAccountSummary;
_client.ManagedAccounts += HandleManagedAccounts;
_client.FamilyCodes += HandleFamilyCodes;
_client.ExecutionDetails += HandleExecutionDetails;
_client.CommissionReport += HandleCommissionReport;
_client.Error += HandleError;
_client.TickPrice += HandleTickPrice;
_client.TickSize += HandleTickSize;
Expand Down

0 comments on commit f8ca4ce

Please sign in to comment.