---
id: "T:cAlgo.API.BacktestingDataSourceOptions"
kind: "record"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/DataSource/BacktestingDataSourceOptions/"
---

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

# BacktestingDataSourceOptions (record)

Represents options of a backtesting data source, used for creating new data source.

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

- CLI: Available to plugins only, and plugins cannot run in the CLI.
- Cloud: Available to plugins only, and plugins cannot run in the cloud.

## Definition

```csharp
public class BacktestingDataSourceOptions
```

Available since cAlgo.API 5.3.

## Examples

C#:

```csharp
protected override void OnStart()
{
    var options = new BacktestingDataSourceOptions(BacktestingDataSourceDataType.Tick | BacktestingDataSourceDataType.M1OpenPrices, OnMinMaxTimeRequested, OnDataRequested);
    Backtesting.DataSources.Add("My Data", options);
    Print("Supported data types: {0}", options.SupportedDataTypes);
}

private BacktestingMinMaxTime OnMinMaxTimeRequested(BacktestingDataSourceMinMaxTimeArgs args) => new(Server.Time.AddMonths(-6), Server.Time);

private void OnDataRequested(BacktestingDataRequest request) => request.Fail("Data is not available yet");
```

Python:

```python
from System import Action, Func

def on_start(self):
    options = BacktestingDataSourceOptions(BacktestingDataSourceDataType.Tick | BacktestingDataSourceDataType.M1OpenPrices, Func[BacktestingDataSourceMinMaxTimeArgs, BacktestingMinMaxTime](self.on_min_max_time_requested), Action[BacktestingDataRequest](self.on_data_requested))
    api.Backtesting.DataSources.Add("My Data", options)
    api.Print(f"Supported data types: {options.SupportedDataTypes}")

def on_min_max_time_requested(self, args):
    return BacktestingMinMaxTime(api.Server.Time.AddMonths(-6), api.Server.Time)

def on_data_requested(self, request):
    request.Fail("Data is not available yet")
```

## Constructors

- `public BacktestingDataSourceOptions(BacktestingDataSourceDataType SupportedDataTypes, Func<BacktestingDataSourceMinMaxTimeArgs, BacktestingMinMaxTime> MinMaxTimeHandler, Action<BacktestingDataRequest> DataRequestHandler)` — Represents options of a backtesting data source, used for creating new data source. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/DataSource/BacktestingDataSourceOptions/Constructor/index.md)
- `public BacktestingDataSourceOptions(BacktestingDataSourceOptions original)` —  [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/DataSource/BacktestingDataSourceOptions/Constructor/index.md)

## Properties

- `public Action<BacktestingDataRequest> DataRequestHandler {get; set;}` — Handler function for handling data requests. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/DataSource/BacktestingDataSourceOptions/DataRequestHandler/index.md)
- `public Func<BacktestingDataSourceMinMaxTimeArgs, BacktestingMinMaxTime> MinMaxTimeHandler {get; set;}` — Handler function for getting minimum and maximum time. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/DataSource/BacktestingDataSourceOptions/MinMaxTimeHandler/index.md)
- `public BacktestingDataSourceDataType SupportedDataTypes {get; set;}` — Supported data types (ex: BacktestingDataSourceDateType.Tick | BacktestingDataSourceDateType.M1OpenPrices) [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/DataSource/BacktestingDataSourceOptions/SupportedDataTypes/index.md)

