---
id: "M:cAlgo.API.Plugin.RefreshData"
kind: "method"
type: "T:cAlgo.API.Plugin"
url: "https://help.ctrader.com/ctrader-algo/references/General/Plugin/RefreshData/"
---

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

# Plugin.RefreshData

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

## RefreshData()

Updates Bars, Positions, PendingOrders, History, etc. And sends postponed events after Thread sleep call. If you put the main thread on sleep by calling Thread sleep method then you have to call RefreshData after Thread wakes up to send the postponed events while thread was sleeping.

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 void RefreshData()
```

Python:

```python
api.RefreshData() -> None
```

### Examples

C#:

```csharp
var operation = ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000);
while (operation.IsExecuting)
{
    Sleep(100);
    // Without RefreshData the trade result and events are not delivered while waiting
    RefreshData();
}
Print("Order executed: {0}", operation.TradeResult.IsSuccessful);
```

Python:

```python
operation = api.ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000)
while operation.IsExecuting:
    api.Sleep(100)
    # Without RefreshData the trade result and events are not delivered while waiting
    api.RefreshData()
api.Print(f"Order executed: {operation.TradeResult.IsSuccessful}")
```

