---
id: "P:cAlgo.API.ChartKeyboardEventArgs.Key"
kind: "property"
type: "T:cAlgo.API.ChartKeyboardEventArgs"
url: "https://help.ctrader.com/ctrader-algo/references/EventArgs/ChartKeyboardEventArgs/Key/"
---

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

# ChartKeyboardEventArgs.Key

Member of [ChartKeyboardEventArgs](https://help.ctrader.com/ctrader-algo/references/EventArgs/ChartKeyboardEventArgs/index.md).

## Key

Keyboard key

Environments: Desktop supported · CLI not supported · Cloud not supported.

- CLI: Never raised in the CLI: the events that pass it never fire there (Chart.KeyDown).
- Cloud: Never raised in the cloud: the events that pass it never fire there (Chart.KeyDown).

C#:

```csharp
public Key Key {get;}
```

Python:

```python
chartKeyboardEventArgs.Key: Key
```

### Returns

`Key` — 

### Examples

C#:

```csharp
protected override void OnStart()
{
    Chart.KeyDown += OnChartKeyDown;
}

private void OnChartKeyDown(ChartKeyboardEventArgs args)
{
    if (args.Key == Key.B)
        ExecuteMarketOrder(TradeType.Buy, SymbolName, 10000, "keyboard");
    else if (args.Key == Key.S)
        ExecuteMarketOrder(TradeType.Sell, SymbolName, 10000, "keyboard");
}
```

Python:

```python
def on_start(self):
    api.Chart.KeyDown += self.on_chart_key_down

def on_chart_key_down(self, args):
    if args.Key == Key.B:
        api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, 10000, "keyboard")
    elif args.Key == Key.S:
        api.ExecuteMarketOrder(TradeType.Sell, api.SymbolName, 10000, "keyboard")
```

