1.4.2 • Published 6 months ago

@debut/plugin-report v1.4.2

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
6 months ago

@debut/plugin-report

Debut plugin, for setting targets and stops in manual mode. Allows you to set or change the stop and take prices for open positions at any time, using their identifier. It also allows you to optionally make additions instead of closing unprofitable positions. By default, the plugin draws balance changes and the used margin (if the strategy has more than 1 trade at a time). It has some API to customize it.

Install

npm install @debut/plugin-report --save

Settings

Creation of indicators

During initialization, you can pass an array of data to the plugin to build a chart of indicators. To do this, create a method, for example getIndicators that returns the indicators plotting scheme IndicatorsSchema

import { ReportPluginAPI, IndicatorsSchema } from '@debut/plugin-report';
// ...

// In Debut context.
public getIndicators = (): IndicatorsSchema => {
    return [{
        // Indicator name
        name: 'cci',
        // array of lines
        lines: [{
            name: 'cci',
            getValue: () => {
                return this.cciValue;
            },
        }],
        // levels
        levels: [-100, 100],
    }];

Initialize plugin

In the create method in the meta file of the strategy, add to the tester environment for initialization

// ...
async create(transport: BaseTransport, cfg: MyStrategyNameOptions, env: WorkingEnv) {
    const bot = new MyStrategyName(transport, cfg);
    // ...
    // environment-specific plugins
    if (env === WorkingEnv.tester) {
        // Plugin registration
        bot.registerPlugins([reportPlugin()]);

        // installing the indicators
        bot.plugins.report.addIndicators(bot.getIndicators());
    }

    // ...
    return bot;
},

Web server for viewing statistics

The server is started with the command npm run serve to do this, add the appropriate command to the scripts section in the package.json file.

// ...
"scripts": {
    "serve": 'report-serve',
    // ...
}

Description of indicator circuit `Indicator

NameTypeDescription
namestringname of curve group, not shown on the chart, serves for the creation and storage of service information about the indicator.
FiguresArray<{ name: string; getValue: () => number; fill: boolean; type: FigureType; }>array of lines, the name field - describes the line name on the chart, the getValue method - returns the current indicator value at this time, fill - allows to fill by FillType either to axis or to line below, FigureType supports line and bar.
levelsnumber[]array of numbers, to draw constant lines of levels on the chart
inChartbooleanway of placing the indicator. If true the indicator will be drawn on a candlestick chart, on top of the candlesticks. If false, the indicator is drawn separately from the price chart. For example, the SMA or Bollinger Bands indicators are drawn in inChart: true mode.

API description

All API is available through the call this.plugins.report.method_name, you can read more about how the API works in the documentation.

Method nameDescription
addIndicatorsAllows you to pass the scheme for creation of indicators, it is called once at plugin initialization
disableProfitPlotWhen called, disables profit drawing on the chart. It is mainly used for convenience, when there is not enough space on the chart to draw indicators or candlesticks.
setXRangeSets the range of values for the X-axis, allows you to cut off the beginning and end. It takes values from and to what time to cut off.
disableOrdersDisplayDisables trade visualization when called
setManualOrderAllows you to draw on the chart any deal in the manual mode, using the passed price and time parameters.
addOpenTargetAllows you to create on the chart only the point of opening a deal in manual mode
resetOrdersClear trades on the chart

Example MACD indicator

public getIndicators = (): IndicatorsSchema => {
    return [
        {
            name: `MACD Indicator',
            shapes: [
                {
                    name: 'signal',
                    fill: FillType.tozeroy,
                    getValue: () => {
                        return this.macdValue.signal;
                    },
                    color: 'red',
                    fillcolor: 'rgba(255, 0, 0, 0.2)',
                },
                {
                    name: 'macd',
                    fill: FillType.tozeroy,
                    getValue: () => {
                        return this.macdValue.macd;
                    },
                },
                {
                    name: 'histogram',
                    type: FigureType.bar,
                    getValue: () => {
                        return this.macdValue.histogram;
                    },
                },
            ],
        },
    ];
};
1.4.2

6 months ago

1.4.1

1 year ago

1.4.0

2 years ago

1.4.0-beta.24

2 years ago

1.4.0-beta.25

2 years ago

1.4.0-beta.26

2 years ago

1.4.0-beta.27

2 years ago

1.4.0-beta.21

2 years ago

1.4.0-beta.22

2 years ago

1.4.0-beta.23

2 years ago

1.4.0-beta.28

2 years ago

1.4.0-beta.29

2 years ago

1.4.0-beta.13

2 years ago

1.4.0-beta.14

2 years ago

1.4.0-beta.15

2 years ago

1.4.0-beta.16

2 years ago

1.4.0-beta.10

2 years ago

1.4.0-beta.11

2 years ago

1.4.0-beta.12

2 years ago

1.4.0-beta.9

2 years ago

1.4.0-beta.8

2 years ago

1.4.0-beta.7

2 years ago

1.4.0-beta.6

2 years ago

1.4.0-beta.17

2 years ago

1.4.0-beta.18

2 years ago

1.4.0-beta.4

2 years ago

1.4.0-beta.19

2 years ago

1.4.0-beta.3

2 years ago

1.4.0-beta.2

2 years ago

1.4.0-beta.1

2 years ago

1.4.0-beta.0

2 years ago

1.3.5

2 years ago

1.2.5-esm.0

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.4.0-beta.30

2 years ago

1.4.0-beta.31

2 years ago

1.2.5-beta.5

2 years ago

1.2.5-beta.6

2 years ago

1.2.5-beta.1

2 years ago

1.2.5-beta.2

2 years ago

1.2.5-beta.3

2 years ago

1.2.5-beta.4

2 years ago

1.2.5-beta.0

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.0

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.16

2 years ago

1.1.15

2 years ago

1.1.14

2 years ago

1.1.18

2 years ago

1.1.12

3 years ago

1.1.11

3 years ago

1.1.10

3 years ago

1.1.9

3 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.19

3 years ago

1.0.2

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago