Click or drag to resize

Reports

The S# provides a reports generating mechanism for strategies created on the basis of Strategy. The report includes the instrument code (StrategySecurity), the total working time (StrategyTotalWorkingTime), slippage (SlippageManager), P&L (StrategyPnLManager) etc. Also, reports generation includes detailed statistics by all the orders (StrategyOrders) and trades (StrategyMyTrades), which have been registered during the strategy work.

The reports framework is based on the StrategyReport class that normally has the following implementations:

  • ExcelStrategyReport - report generation in the Excel format. With this generation, you can use the template file (Template) which already contains the necessary formulas and charts based on the generated data. Data from the template before generating copied to the output file whose name is passed through the constructor.

    By default, the ExcelStrategyReport uses an Excel worksheet called "report", where it records the data. If such a sheet in the template file is not present, it will be automatically created.

  • XmlStrategyReport - report generation in the Xml format. This format is useful when you need to pass strategy parameters from trading algorithm to another program.
  • CsvStrategyReport - report generation in the CSV format. A simplified version of the Excel report, supported by a large number of third-party programs.
Prerequisites

Excel report generation adding to the SampleSMA

  1. You need to add the report generate button on the form:

    <Button x:Name="Report" Grid.Column="0" Width="100" Grid.ColumnSpan="2" Grid.Row="11" IsEnabled="False" Content="Отчет" Click="Report_Click" />
  2. The generation code (starts by pressing a button):

    private void Report_Click(object sender, RoutedEventArgs e)
    {
        new ExcelStrategyReport(_strategy, "sma.xlsx").Generate();
    
        // oppening the result file
        Process.Start("sma.xlsx");
    }
  3. As a result, the generated file will be located in the same folder as the SampleSMA.exe

Next Steps