1.3.4 • Published 2 months ago

@debut/plugin-session v1.3.4

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

@debut/plugin-session

The Debut plugin, for limiting the trading session time. Allows you to configure the working hours for the strategy, as well as to detect the change of the day. The plugin automatically performs the correction of time zones, at the transition of USA to summer and winter time, so there are no failures on time shifts during testing. It is recommended to use to block work on pre or post market exchanges.

Install

npm install @debut/plugin-session --save

Settings

The plugin has a number of parameters available for customization during initialization.

Parameters

NameTypeDescription
fromstringstring in format HH:MM, for example 10:00 (GMT+3) time of opening of the main session of exchange MOEX
tostringstring in the format HH:MM, for example 19:00 (GMT+3) time of the end of the main session of the MOEX
onDayChangedFunctionOptionally, you can pass a function to be called on day change
noTimeSwitchingbooleanDefault is false, use this parameter for non DST zones

The time is set locally. The plugin automatically adjusts for the current time zone.

Attention!

Be aware with

Initialization

import { SessionPluginOptions, sessionPlugin } from '@debut/plugin-session';

export interface MyStrategyOpts extends DebutOptions, SessionPluginOptions;

// ...
constructor(transport: BaseTransport, opts: MyStrategyOpts) {
    super(transport, opts);

    this.registerPlugins([
        // ...
        this.opts.from && this.opts.to && sessionPlugin(this.opts),
        // ...
    ]);

Work with Genetic

The plugin automatically removes candles, which are not within a range specified in the time settings. This will increase the speed of the strategy optimization.

To enable the candlestick filtration, add the appropriate filter in the meta file (meta.ts)

import { createSessionValidator } from '@debut/plugin-session';

// ...
ticksFilter(cfg: MyStrategyOpts) {
    if (!cfg.from && !cfg.to) {
        return () => true;
    }

    const tickValidator = createSessionValidator(cfg.from, cfg.to, cfg.noTimeSwitching);

    return (tick) => {
        return tickValidator(tick.time).inSession;
    };
},
// ...
1.3.4

2 months ago

1.3.3

2 months ago

1.3.2

6 months ago

1.3.1

1 year ago

1.3.0

2 years ago

1.2.0

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.1

2 years ago

1.3.0-beta.1

2 years ago

1.3.0-beta.2

2 years ago

1.3.0-beta.0

2 years ago

1.1.1-esm.0

2 years ago

1.0.19

2 years ago

1.1.0

2 years ago

1.0.20

2 years ago

1.0.17

3 years ago

1.0.16

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.2

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.11

3 years ago

1.0.10

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago