---
id: "T:cAlgo.API.AccountSwitchedEventArgs"
kind: "class"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/EventArgs/AccountSwitchedEventArgs/"
---

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

# AccountSwitchedEventArgs (class)

Provides data for the account switched event.

Environments: Desktop supported · CLI supported · Cloud supported.

## Definition

```csharp
public class AccountSwitchedEventArgs
```

## Examples

C#:

```csharp
protected override void OnStart()
{
    Account.Switched += OnAccountSwitched;
}

private void OnAccountSwitched(AccountSwitchedEventArgs args)
{
    Print("Account switched from {0} to {1}", args.PreviousAccountNumber, args.CurrentAccountNumber);
}
```

Python:

```python
def on_start(self):
    api.Account.Switched += self.on_account_switched

def on_account_switched(self, args):
    api.Print(f"Account switched from {args.PreviousAccountNumber} to {args.CurrentAccountNumber}")
```

## Properties

- `public int CurrentAccountNumber {get;}` — Returns new account number. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/AccountSwitchedEventArgs/CurrentAccountNumber/index.md)
- `public int PreviousAccountNumber {get;}` — Returns previous account number. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/AccountSwitchedEventArgs/PreviousAccountNumber/index.md)

