---
id: "P:cAlgo.API.Deal.ClosedBy"
kind: "property"
type: "T:cAlgo.API.Deal"
url: "https://help.ctrader.com/ctrader-algo/references/Trading/Deals/Deal/ClosedBy/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# Deal.ClosedBy

Member of [Deal](https://help.ctrader.com/ctrader-algo/references/Trading/Deals/Deal/index.md).

## ClosedBy

If deal was an opening deal then this property will return the deals that closed current deal.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
IReadonlyList<Deal> ClosedBy {get;}
```

Python:

```python
deal.ClosedBy: IReadonlyList[Deal]
```

### Returns

`IReadonlyList<Deal>` — 

Available since cAlgo.API 5.1.

### Examples

C#:

```csharp
foreach (var position in Positions)
{
    foreach (var deal in position.Deals.Where(positionDeal => positionDeal.PositionImpact == DealPositionImpact.Opening))
        Print("Opening deal {0} partially closed by {1} deals", deal.Id, deal.ClosedBy.Count);
}
```

Python:

```python
for position in api.Positions:
    for deal in [positionDeal for positionDeal in position.Deals if positionDeal.PositionImpact == DealPositionImpact.Opening]:
        api.Print(f"Opening deal {deal.Id} partially closed by {deal.ClosedBy.Count} deals")
```

