Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: conservative sell strategy #585

Merged

Conversation

rando128
Copy link
Contributor

@rando128 rando128 commented Jan 12, 2023

Description

This PR provides the ability to reduce the sell trigger price as the grid gets deeper (i.e. with more executed buys). This is useful in bear market conditions as the user might want to maximize the possibility to breakeven rather than to maximize the profit. When the feature is enabled, a configurable conservative ratio reduces the sell trigger price proportionally to the executed grid depth, the objectif being to be less greedy as the grid gets deeper.

The conservative sell doesn't apply for grids with only one executed buy. In such cases, the bot will sell normally, at the expected sell trigger percentage.

Changes:

  • Addition of 2 new properties in the default.json model: conservativeMode.enabled, conservativeMode.factor
  • A migration is included to flush the configuration cache
  • A new UI section has been added to the SELL CONFIGURATION to enable the conservative mode and set the conservative ratio
  • The sell signal header UI has been updated to reflect whether the conservative mode is enabled or not
  • The trigger price indication UI has been changed to reflect the new sell trigger price if the conservative mode becomes active (i.e. the conservative mode is enabled, and the grid has at least 2 executed buys)
  • Additional logic has been added in get-indicators.js to compute the sell triggerPercentage in case the conservative mode is active.

Caveats:

  • It is possible that the conservative ratio leads to a triggerPercentage that becomes lower than the sell stop price percentage. This could produce a sell with a slight loss.

Motivation and Context

When a coin starts going down in a grid with multiple buy steps, I often find myself reconfiguring the sell trigger percentage to a lower value with the objective to increase the possibility to make a smaller positive sell, rather than the original higher sell target (which might take too long to achieve, or even might never occur).

The capability goes a bit in the line of #579: the conservative mode is a way to offer a dynamic sell trigger based on the grid depth.

How Has This Been Tested?

It has been running on my production server since a couple of days.

Screenshots (if appropriate):

Conservative mode disabled
Screenshot 2023-01-12 at 12 27 43

Conservative mode enabled and active
Screenshot 2023-01-12 at 12 26 52

Sell Settings
Screenshot 2023-01-12 at 12 33 03

First information pop-up
Screenshot 2023-01-12 at 12 28 53

Second information pop-up
Screenshot 2023-01-12 at 12 32 11

@rando128 rando128 changed the title Feat/conservative sell strategy feat:conservative sell strategy Jan 12, 2023
@chrisleekr chrisleekr added the enhancement New feature or request label Jan 12, 2023
@chrisleekr
Copy link
Owner

This looks really good @rando128

I found no test written, do you need help writing tests?

@rando128
Copy link
Contributor Author

Thx @chrisleekr. Yes I would need your help with the test cases as I’m not skilled enough yet to write them.

@chrisleekr chrisleekr changed the title feat:conservative sell strategy feat: conservative sell strategy Jan 14, 2023
@chrisleekr
Copy link
Owner

@rando128 I've refactored some of your code.
Basically, if the value is already available from the backend, then the frontend does not need to re-calculate again.

Check it out e38b499

I will merge in.

Thank you for the good feature!

@chrisleekr chrisleekr merged commit 1f8237f into chrisleekr:master Jan 14, 2023
@rando128
Copy link
Contributor Author

Makes total sense. Thx for the code improvement @chrisleekr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants