@lambot/safeguard v0.3.29
@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 totrue
if sell orders should be placed when the stop threshold is undermined; otherwise the safeguard will just throw anError
- 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 to10
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 to10
the setup price needs to raise by 10% first before thresholds are updated. If the reset is set to0
(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 validstring
formats accepted by the ms package (i.e.1s
,1m
,5m
).
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago