---
id: "M:cAlgo.API.Asset.Convert(cAlgo.API.Asset,System.Double)"
kind: "method"
type: "T:cAlgo.API.Asset"
url: "https://help.ctrader.com/ctrader-algo/references/MarketData/Assets/Asset/Convert/"
---

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

# Asset.Convert

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

## Convert(Asset to, double value)

Converts value to another asset.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
double Convert(Asset to, double value)
```

Python:

```python
asset.Convert(to: Asset, value: float) -> float
```

### Parameters

- `to` (`Asset`, Python `Asset`): Target asset
- `value` (`double`, Python `float`): The value you want to convert from current Asset

### Returns

`double` — Value in to / target asset

### Examples

C#:

```csharp
var cad = Assets.GetAsset("CAD");
if (cad == null)
{
    Print("Asset CAD not found");
    return;
}

var balanceInCad = Account.Asset.Convert(cad, Account.Balance);
Print("Balance in CAD: {0}", balanceInCad);
```

Python:

```python
cad = api.Assets.GetAsset("CAD")
if cad is None:
    api.Print("Asset CAD not found")
else:
    balanceInCad = api.Account.Asset.Convert(cad, api.Account.Balance)
    api.Print(f"Balance in CAD: {balanceInCad}")
```

## Convert(string to, double value)

Converts value to another asset.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
double Convert(string to, double value)
```

Python:

```python
asset.Convert(to: str, value: float) -> float
```

### Parameters

- `to` (`string`, Python `str`): Target asset
- `value` (`double`, Python `float`): The value you want to convert from current Asset

### Returns

`double` — Value in to / target asset

### Examples

C#:

```csharp
if (!Assets.Exists("CAD"))
{
    Print("Asset CAD not found");
    return;
}

var balanceInCad = Account.Asset.Convert("CAD", Account.Balance);
Print("Balance in CAD: {0}", balanceInCad);
```

Python:

```python
if not api.Assets.Exists("CAD"):
    api.Print("Asset CAD not found")
else:
    balanceInCad = api.Account.Asset.Convert("CAD", api.Account.Balance)
    api.Print(f"Balance in CAD: {balanceInCad}")
```

