---
id: "M:cAlgo.API.BacktestingDataSourceOptions.#ctor(cAlgo.API.BacktestingDataSourceDataType,System.Func{cAlgo.API.BacktestingDataSourceMinMaxTimeArgs,cAlgo.API.BacktestingMinMaxTime},System.Action{cAlgo.API.BacktestingDataRequest})"
kind: "constructor"
type: "T:cAlgo.API.BacktestingDataSourceOptions"
url: "https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/DataSource/BacktestingDataSourceOptions/Constructor/"
---

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

# BacktestingDataSourceOptions constructor

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

## BacktestingDataSourceOptions(BacktestingDataSourceDataType SupportedDataTypes, Func<BacktestingDataSourceMinMaxTimeArgs, BacktestingMinMaxTime> MinMaxTimeHandler, Action<BacktestingDataRequest> DataRequestHandler)

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.

C#:

```csharp
public BacktestingDataSourceOptions(BacktestingDataSourceDataType SupportedDataTypes, Func<BacktestingDataSourceMinMaxTimeArgs, BacktestingMinMaxTime> MinMaxTimeHandler, Action<BacktestingDataRequest> DataRequestHandler)
```

Python:

```python
BacktestingDataSourceOptions(SupportedDataTypes: BacktestingDataSourceDataType, MinMaxTimeHandler: Callable[[BacktestingDataSourceMinMaxTimeArgs], BacktestingMinMaxTime], DataRequestHandler: Callable[[BacktestingDataRequest], None])
```

### Parameters

- `SupportedDataTypes` (`BacktestingDataSourceDataType`, Python `BacktestingDataSourceDataType`): Supported data types (ex: BacktestingDataSourceDateType.Tick \| BacktestingDataSourceDateType.M1OpenPrices)
- `MinMaxTimeHandler` (`Func<BacktestingDataSourceMinMaxTimeArgs, BacktestingMinMaxTime>`, Python `Callable[[BacktestingDataSourceMinMaxTimeArgs], BacktestingMinMaxTime]`): Handler function for getting minimum and maximum time.
- `DataRequestHandler` (`Action<BacktestingDataRequest>`, Python `Callable[[BacktestingDataRequest], None]`): Handler function for handling data requests.

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")
```

## BacktestingDataSourceOptions(BacktestingDataSourceOptions original)



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.

C#:

```csharp
public BacktestingDataSourceOptions(BacktestingDataSourceOptions original)
```

Python:

```python
BacktestingDataSourceOptions(original: BacktestingDataSourceOptions)
```

### Parameters

- `original` (`BacktestingDataSourceOptions`, Python `BacktestingDataSourceOptions`):

Available since cAlgo.API 5.3.

