Skip to navigation

Subscribe to Display Groups

View as MarkdownOpen in Claude

Introduction

To integrate with a specific Group, you need to first subscribe to the group number by invoking EClient.subscribeToGroupEvents. The EWrapper.displayGroupUpdated callback is triggered once after receiving the subscription request, and will be sent again if the selected contract in the subscribed display group has changed.


Request Group Events Subscription

EClient.subscribeToGroupEvents(requestId, groupId)

Integrates API client and TWS window grouping.

requestId
int

Request identifier used to track data.

groupId
int

The display group for integration.


self.subscribeToGroupEvents(19002, 1)

Receive Group Events Subscription

EWrapper.displayGroupUpdated(requestId, contractInfo)

Call triggered once after receiving the subscription request, and will be sent again if the selected contract in the subscribed display group has changed.

requestId
int

Request identifier used to track data.

contractInfo
string

Contract information produced for the active display group.


def displayGroupUpdated(self, reqId: int, contractInfo: str):
print("DisplayGroupUpdated. ReqId:", reqId, "ContractInfo:", contractInfo)

Cancel Group Events Subscription

EClient.unsubscribeFromGroupEvents(requestId)

Cancels a TWS Window Group subscription.

requestId
int

Request identifier used to track data.


self.unsubscribeFromGroupEvents(19002)