0.3.29 • Published 4 years ago

@lambot/safeguard v0.3.29

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
4 years ago

@lambot/safeguard

Trailing stop order implementation for exchanges supported by the Lambot trading framework.

Installation

  • npm: npm i -g @lambot/safeguard

Usage

CLI

After installing this package globally, you can run it from the terminal:

lambot-safeguard --config "<path/to/your/config.json>"

Configuration

The configuration must be saved in valid JSON.

Example

[
  {
    "active": true,
    "apiKey": "YOUR_API_KEY",
    "apiSecret": "YOUR_API_SECRET",
    "base": "EOS",
    "counter": "ETH",
    "dryMode": false,
    "exchange": "BINANCE",
    "price": "100",
    "stop": "10",
    "reset": "50",
    "updateInterval": "1m"
  }
]

In the example above, the trading pair "EOS/ETH" will be watched on Binance with an interval of 1 minute.

The configuration allows the initial price of "100 ETH" to drop by 10% before the safeguard places a sell order. When the market price falls below "90 ETH", the safeguard will place a limit sell order of "90 ETH".

If the market price goes beyond the setup price plus 50% (which is defined with reset), the safeguard will update the thresholds.

Given the fact that the price increases to "160 ETH" on the next interval, the safeguard will take the "160 ETH" as new pivot price (because the reset price has been breached) and it will create a stop at "144 ETH" and a new reset at "240 ETH".

Options

  • active (boolean): True if you want to activate/run the configuration
  • apiKey (string): Your account's API key from the exchange
  • apiSecret (string): Your account's API secret from the exchange
  • base (string): Symbol of the base currency
  • counter (string): Symbol of the counter currency (market)
  • dryMode (boolean): Set it to true if sell orders should be placed when the stop threshold is undermined; otherwise the safeguard will just throw an Error
  • exchange (BINANCE | COINBASE): Lambot's identifier for the exchange you want to use
  • price (string | CURRENT_BUY_PRICE | LAST_BUY_PRICE): You can setup a price from which the thresholds should be calculated (i.e. 5.00). You can also take the current market price (CURRENT_BUY_PRICE) as your setup price. If you bought the base currency already, then you can also take your last buy price (LAST_BUY_PRICE) as the initial setup price.
  • stop (string): Percentage which the price is allowed to drop before a sell order gets triggered, i.e. if set to 10 the setup price can drop by 10% before a sell order is made
  • reset (string): Percentage which the price needs to climb up before thresholds are recalculated, i.e. if set to 10 the setup price needs to raise by 10% first before thresholds are updated. If the reset is set to 0 (default), then thresholds will be updated as soon as the market price goes above the setup price.
  • updateInterval (string): Interval in which the safeguard checks for price updates. Values must be provided in valid string formats accepted by the ms package (i.e. 1s, 1m, 5m).
0.3.29

4 years ago

0.3.28

4 years ago

0.3.27

4 years ago

0.3.26

4 years ago

0.3.25

4 years ago

0.3.24

4 years ago

0.3.23

5 years ago

0.3.22

5 years ago

0.3.21

5 years ago

0.3.20

5 years ago

0.3.19

5 years ago

0.3.18

5 years ago

0.3.17

5 years ago

0.3.16

5 years ago

0.3.15

5 years ago

0.3.14

5 years ago

0.3.13

5 years ago

0.3.12

5 years ago

0.3.11

5 years ago

0.3.10

5 years ago

0.3.9

5 years ago

0.3.8

5 years ago

0.3.7

5 years ago

0.3.6

5 years ago

0.3.5

5 years ago

0.3.4

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago