2.0.8 • Published 6 months ago

@debut/plugin-virtual-takes v2.0.8

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

@debut/plugin-virtual-takes

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-virtual-takes --save

Settings

NameTypeDescription
takeProfitnumberPercentage level from order opening price
stopLossnumberPercentage level from order opening price (positive number as well)
reduceWhennumberPecentage level from order price - reduce order size when reached
reduceSizenumberHow many size of order need to reduce, default = 0.5 mean 50%, 1 - 100%, 0 - 0%
trailingnumber1 - tradiling from opening, 2 - trailing ater take reached, 3 - trailing after each new take reached (trailing is disabled by default)
ignoreTicksbooleanIgnore ticks, check takes on each candle closed
maxRetryOrdersnumberAllows open new orders insted of closing by stop loss, no more than value
manualbooleanManual control, for using API

Plugin API

NameDescription
setForOrdersetup stop and take prices for signle order, setting up by passed options parameters (manual)
setPricesForOrdersetup stop and take prices for signle order, setting up by precalculated prices (manual)
setTrailingForOrdersetup stop and take prices for signle order, setting up by passed options parameters (manual)
getTakesget take and stop price for order from plugin state
isManualreturn manual state for plugin, need to use when another plugin depends from takes plugin

Takeaway setting

// in context of Debut...
async onCandle({ c }) {
    // some entry conditions
    const order = await this.createOrder(target);
    let take = c + c * 0.15; // Assume 15%
    let stop = c - c * 0.10; // And the stop is 10%

    // If the trade is of the SELL type, swap the stop and take positions
    if (target === OrderType.SELL) {
        [take, stop] = [stop, take];
    }

    // Hand over the cid (client-id) to the price plugin.
    // Then it will monitor when it reaches a take or stop
    // after which it will automatically close the trade
    this.plugins.takes.setForOrder(order.cid, take, stop);

    return order;
}
2.0.7

6 months ago

2.0.6

9 months ago

2.0.8

6 months ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

2 years ago

2.0.0

2 years ago

1.3.5

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

2 years ago

1.4.0-beta.7

2 years ago

1.4.0-beta.6

2 years ago

1.4.0-beta.5

2 years ago

1.2.8-esm.0

2 years ago

1.4.0-beta.4

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

2 years ago

1.2.6

2 years ago

1.2.5

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

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.11

3 years ago

1.0.10

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

3 years ago

1.0.0

3 years ago