---
id: "P:cAlgo.API.Plugin.MarketData"
kind: "property"
type: "T:cAlgo.API.Plugin"
url: "https://help.ctrader.com/ctrader-algo/references/General/Plugin/MarketData/"
---

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

# Plugin.MarketData

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

## MarketData

Provides access to Market Data.

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

- CLI: Plugins cannot run in the CLI: ctrader-cli runs cBots only.
- Cloud: Plugins cannot run in the cloud: it runs cBots only.

C#:

```csharp
public MarketData MarketData {get;}
```

Python:

```python
api.MarketData: MarketData
```

### Returns

`MarketData` — 

### Examples

C#:

```csharp
var bars = MarketData.GetBars(TimeFrame.Hour, "EURUSD");
Print("EURUSD H1 bars: {0}, last close: {1}", bars.Count, bars.LastBar.Close);
var marketDepth = MarketData.GetMarketDepth("GBPUSD");
```

Python:

```python
bars = api.MarketData.GetBars(TimeFrame.Hour, "EURUSD")
api.Print(f"EURUSD H1 bars: {bars.Count}, last close: {bars.LastBar.Close}")
marketDepth = api.MarketData.GetMarketDepth("GBPUSD")
```

