---
id: "M:cAlgo.API.Internals.Symbol.GetEstimatedMargin(cAlgo.API.TradeType,System.Double)"
kind: "method"
type: "T:cAlgo.API.Internals.Symbol"
url: "https://help.ctrader.com/ctrader-algo/references/MarketData/Symbols/Symbol/GetEstimatedMargin/"
---

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

# Symbol.GetEstimatedMargin

Member of [Symbol](https://help.ctrader.com/ctrader-algo/references/MarketData/Symbols/Symbol/index.md).

## GetEstimatedMargin(TradeType tradeType, double volume)

Returns the amount of margin you need for x amount of volume.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
double GetEstimatedMargin(TradeType tradeType, double volume)
```

Python:

```python
api.Symbol.GetEstimatedMargin(tradeType: TradeType, volume: float) -> float
```

### Parameters

- `tradeType` (`TradeType`, Python `TradeType`): Order trade type
- `volume` (`double`, Python `float`): Amount of volume

### Returns

`double` — Amount of Margin

### Examples

C#:

```csharp
var volume = Symbol.QuantityToVolumeInUnits(1);
var margin = Symbol.GetEstimatedMargin(TradeType.Buy, volume);
if (margin < Account.FreeMargin)
    ExecuteMarketOrder(TradeType.Buy, SymbolName, volume);
else
    Print("Not enough free margin, required: {0}", margin);
```

Python:

```python
volume = api.Symbol.QuantityToVolumeInUnits(1)
margin = api.Symbol.GetEstimatedMargin(TradeType.Buy, volume)
if margin < api.Account.FreeMargin:
    api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, volume)
else:
    api.Print(f"Not enough free margin, required: {margin}")
```

