-
Notifications
You must be signed in to change notification settings - Fork 533
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
Issue with Trading Bot in dry-run Mode and Connected Real Accounts Bots #369
Comments
Could you verify on exchange that 5x (and 3x leverage for signal 61) is allowed ? I assume the leverage is 1x instead, right ? |
I've confirmed that trading with leverage works as expected by running the bot with my custom strategy, which trades with the specified leverage. However, it seems to be an issue specific to this particular strategy, as other strategies are functioning correctly. That's why I suspect the problem lies within this strategy. As for "Signal 61," could you provide more details about it? What does it represent or signify in the context of the strategy? Understanding the specifics of Signal 61 could help in troubleshooting the issue more effectively. If You was referring to the "rebuy" mode, the configuration in the strategy is as follows:
These settings indicate that the strategy is set to futures mode with a leverage of 6.0, and in "rebuy" mode, the leverage is adjusted to 3.0. |
It's with 5x. That still is too high, if you ask me. Signal 61 is the so called "rebuy mode", it's going to buy 20% of the normal stake, then more if there are dips. This is 3x. |
Well, yes. But this does not explain the behavior described above at all. In dry-run mode, it is included at 6x, but on real accounts, it is included in most deals at 1x, and in some at 20x. Where do these numbers come from? They are not specified in the strategy |
Yes, it should get it from leverage() function, that is 5x, unless signals 61, that is 3x ... 1x it can happen, in case that 5x is not possible for the pair in question. But 20x ? |
Well, exactly, 20x. I myself can't understand where this number comes from. In the leverage() method, only futures_mode_leverage and futures_mode_leverage_rebuy_mode are used, the values of which I've provided earlier. And the most interesting thing is that this behavior occurs only with a real account; in dry-run mode, we enter trades with 6x leverage as specified in the strategy. I'm puzzled. The screenshot shows two real accounts "Vladislav" and "Valbort" and one in the dry-run mode "freqtrade" with absolutely identical strategy settings (except for the DRY-RUN mode) and connected to the same strategy. In the strategy, only those parameters that I changed above have been changed. The rest remains unchanged. |
Is there anything in the logs ? Maybe don't change the value to 6, leave the default 5. |
There are similar messages in the logs: |
corrected the leverage value to 5. Only changed is_futures_mode = True Here is the part in the log where the purchase is made with 20x leverage:
trade.freqtradebot - INFO - Long signal found: about create a new trade for PYTH/USDT:USDT with stake_amount: 5.54078282802 ...
trade.freqtradebot - INFO - Order #423633325 was created for PYTH/USDT:USDT and status is closed.
trade.wallets - INFO - Wallets synced.
trade.rpc.rpc_manager - INFO - Sending rpc message: {'trade_id': 30, 'type': entry, 'buy_tag': '61 ', 'enter_tag': '61 ', 'exchange': 'Binance', 'pair': 'PYTH/USDT:USDT', 'leverage': 20.0, 'direction': 'Long', 'limit': 0.3178, 'open_rate': 0.3178, 'order_type': 'market', 'stake_amount': 5.529719999999999, 'stake_currency': 'USDT', 'base_currency': 'PYTH', 'fiat_currency': 'USD', 'amount': 348.0, 'open_date': datetime.datetime(2024, 1, 19, 16, 18, 47, 293918, tzinfo=datetime.timezone.utc), 'current_rate': 0.3178, 'sub_trade': False}
trade.freqtradebot - INFO - Found open order for Trade(id=30, pair=PYTH/USDT:USDT, amount=348.00000000, is_short=False, leverage=20.0, open_rate=0.31780000, open_since=2024-01-19 16:18:47)
trade.persistence.trade_model - INFO - Updating trade (id=30) ...
trade.persistence.trade_model - INFO - MARKET_BUY has been fulfilled for Trade(id=30, pair=PYTH/USDT:USDT, amount=348.00000000, is_short=False, leverage=20.0, open_rate=0.31780000, open_since=2024-01-19 16:18:47).
Nothing seems unusual. Except that the leverage of 20x came from somewhere. |
No need to change the mode, it's going to read it from your config. Is this something to do with the producer/consumer I wonder ? I have to look into it. |
Changing the variable futures_mode_leverage back to its original value of 5 resolved the issue. Now, both on the demo account and on the real accounts, the bot enters trades with a leverage of 5. However, I still can't understand why such a bug occurs with other leverage values, as I haven't noticed this variable being changed in the code in any way. |
hi @Va1b0rt , may i ask why you run 3 bot like this, any benefit ? |
Running three bots like this doesn't provide me with any additional benefits. The idea is as follows: I have one bot running in dry-run mode, and I connect my real exchange accounts to it via producer/consumer. As I understand it, this is a less resource-intensive way to run multiple bots on a single machine. If I'm mistaken, please correct me. Moreover, if at any point I'm unsure about the strategy (for example, during certain market conditions), I can disconnect the real accounts but still continue monitoring the strategy's performance in dry-run mode. |
I had some errors like 'Outdated history...'. I thought maybe it was affecting the fact that producers and consumers enter different deals, but after resolving these errors, it didn't affect the situation with the inputs at all. I noticed that consumers enter the same deals and do not enter deals that the producer enters. But sometimes one of the consumers enters the same deal as the producer. Very strange behavior... Perhaps the computer cannot process three accounts simultaneously? |
Hey did you figure out why this is happening? |
Unfortunately, I couldn’t figure out why this mode works for me with a bug. |
Problem Description
I have encountered an interesting situation with a trading bot. One instance of the bot is trading in dry-run mode and entering trades with the leverage specified in the strategy. Two additional bots are connected to it via the producer/consumer mode, and they are trading on real accounts. Despite all bots entering the same trades as the main account, they are using different leverages.
Questions
Reproduction Steps
Expected Behavior
It was expected that all bots, including the one running in dry-run mode, would use the same leverage when entering the same trades.
Environment Information
The text was updated successfully, but these errors were encountered: