Skip to content

BacktestingDataSourceOptions

record cAlgo.API Since 5.3

DesktopCLICloud

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

Environment behaviour

CLI — not supported. Available to plugins only, and plugins cannot run in the CLI.

Cloud — not supported. Available to plugins only, and plugins cannot run in the cloud.

Definition

public class BacktestingDataSourceOptions

Namespace: cAlgo.API · Group: DataSource

Examples

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

Name Description
BacktestingDataSourceOptions 2 overloadsDesktopCLICloud Represents options of a backtesting data source, used for creating new data source.

Properties

Name Description
DataRequestHandlerDesktopCLICloudAction<BacktestingDataRequest> Handler function for handling data requests.
MinMaxTimeHandlerDesktopCLICloudFunc<BacktestingDataSourceMinMaxTimeArgs, BacktestingMinMaxTime> Handler function for getting minimum and maximum time.
SupportedDataTypesDesktopCLICloudBacktestingDataSourceDataType Supported data types (ex: BacktestingDataSourceDateType.Tick | BacktestingDataSourceDateType.M1OpenPrices)

See also