> This page is for TWS API.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://ibkrcampus.com/docs/llms.txt.

# Subscribe to Display Groups

## 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.

---

\


#### Python

```python
self.subscribeToGroupEvents(19002, 1)
```

#### Java

```java
client.subscribeToGroupEvents(9002, 1);
```

#### C++

```cpp
m_pClient->subscribeToGroupEvents(9002, 1);
```

#### C\#

```csharp
client.subscribeToGroupEvents(9002, 1);
```

#### VB.NET

```vbnet
client.subscribeToGroupEvents(9002, 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.

---

\


#### Python

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

#### Java

```java
@Override
public void displayGroupUpdated(int reqId, String contractInfo) {
	System.out.println("Display Group Updated. ReqId: " + reqId + ", Contract info: " + contractInfo + "\n");
}
```

#### C++

```cpp
void TestCppClient::displayGroupUpdated( int reqId, const std::string& contractInfo) {
    std::cout << "Display Group Updated. ReqId: " << reqId << ", Contract Info: " << contractInfo << std::endl;
}
```

#### C\#

```csharp
public virtual void displayGroupUpdated(int reqId, string contractInfo)
{
	Console.WriteLine("displayGroupUpdated. Request: " + reqId + ", ContractInfo: " + contractInfo);
}
```

#### VB.NET

```vbnet
Public Sub displayGroupUpdated(reqId As Integer, contractInfo As String) Implements IBApi.EWrapper.displayGroupUpdated
	Console.WriteLine("DisplayGroupUpdated - ReqId [" & reqId & "] ContractInfo [" & contractInfo & "]")
End Sub
```

---

## Cancel Group Events Subscription

`EClient.unsubscribeFromGroupEvents(requestId)`

Cancels a TWS Window Group subscription.

**`requestId`** `int`

Request identifier used to track data.

---

\


#### Python

```python
self.unsubscribeFromGroupEvents(19002)
```

#### Java

```java
client.unsubscribeFromGroupEvents(9002);
```

#### C++

```cpp
m_pClient->unsubscribeFromGroupEvents(9002);
```

#### C\#

```csharp
client.unsubscribeFromGroupEvents(9002);
```

#### VB.NET

```vbnet
client.unsubscribeFromGroupEvents(9002)
```