-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Pairs trade opening priority #6030
Comments
This is definitely not a supported way, and i'd discourage you (or any future reader) from pursuing it, as it can break your strategy in subtle ways during updates (or completely ...). It will also not work as you think it does - as you're modifying the order the pairs are analyzed (which is irrelevant anyway, and cannot be guaranteed on "candle time switches")- but not the order of the pairlist itself. Unfortunately however, messing with the pairlist (in a proper way) is not an easy task / approach. if we would want to enable this, then it would need to be called at the level of pairlists (where pairlists are populated) - also allowing users to provide new pairs from within the strategy. As such, i think this task is better left to dedicated pairlists plugin. |
@xmatthias Thanks for the answer.
It worth to say that I didn't mean exactly this. I meant that strategy might provide some optional "importance" signal along with "buy" signal. It may be even indicator itself - let's say RSI value (the lower RSI the more oversold the asset assumed to be and presumably more desired to buy for RSI-based strategy). It might be useful when many pairs generate "buy" signal simultaneously but the amount of free stake currency is not enough to enter them all - then it is probably worth to be greedy and enter most "important" / promising first. And then, the bot will be able to order analyzed pairs based on their importance in bot's main loop (not the strategy). If strategy does not provide any "importance" signal then there is no any preferred ordering for trades opening. |
Describe your environment
(if applicable)
python -V
)pip freeze | grep ccxt
)freqtrade -V
ordocker-compose run --rm freqtrade -V
for Freqtrade running in docker)Describe the enhancement
Sometimes it could be useful to order pairs after dataframe analysis for each pair is done (probably based on some indicator or whatever).
Let's imagine that target indicator is "probability of profit" for a pair during the following K candles, for instance predicted by some Machine Learning technique. Someone may want to open trades in max-to-min predicted probability order to maximize expected wins / by expected return based on predicted probability and position size to maximize expected capital growth / whatever else.
Currently there is no clear way to provide "priority" information out of the strategy so the bot will know which pair to enter first. One approach I can imagine right now is to override
analyze(self, pairs: List[str])
somehow like:or just simply
.sort()
pairs list inplace based on some column calculated inpopulate_indicators
. But is definitely not a straightforward and potentially dangerous approach as it is based on knowledge of bot cycle internals.What I imagine could be useful is change the
IStrategy
interface so there will be a point to explicitly provide priorities for the bot cycle and order pairs before enter_positions. This method could be optional to override with default return value of 0.0 so by default there will not be any specific ordering and everything will work exactly how it works right now.The text was updated successfully, but these errors were encountered: