tudorelu / pyjuque

⚡ Open Source Algorithmic Trading Bot for Python.
MIT License
456 stars 90 forks source link

InsufficientFunds error placing Sell order despite enough Binance balance #31

Open cantami opened 1 year ago

cantami commented 1 year ago

Describe the bug Even though my Binance balance is 1000 EUR, InsufficientFunds error is raised when bot_config has starting_balance = 500 and initial_entry_allocation = 20. However, when I try with starting_balance = 100 and initial_entry_allocation = 20 no error appears.

It is important to mention that the error shows up when the bot is trying to place the Sell order.

To Reproduce Set bot_config to the following, ensure you have more than 500 EUR in your Binance balance. Then run defineBot() and executeBot().

bot_config = {
    'name': 'bot0',
        'test_run': False,
    'exchange': exchange_binance,
    'symbols': ['BTC/EUR', 'ETH/EUR', 'ADA/EUR'],
    'starting_balance': 500.00,
    'strategy': {
        'class': BBRSIStrategy,
        'params': {
            'bb_len': 20,
            'n_std': 2.0,
            'rsi_len': 14,
            'rsi_overbought': 60,
            'rsi_oversold': 40,
        }
    },
    'timeframe': '5m',
    'entry_settings': {
        'initial_entry_allocation': 20,
        'signal_distance': 0.1
    },
    'exit_settings': {
        'take_profit': 2,
        'stop_loss_value': 1
    },
    'display_status': True
}

Expected behavior InsufficientFunds error should not be raised when the Binance balance is greater than the starting_balance.

Screenshots image

Desktop (please complete the following information):

Additional context Typically it happens placing the second Sell order, but occasionally it happened during the first Sell order.

tudorelu commented 1 year ago

For what amount are the orders placed? Perhaps there's a bug with the trade amount allocation and it each trade places is worth 500 euro.

cantami commented 1 year ago

I have tried with 100, 200 and 300 and it seems it is working. I will try with higher amounts to see where is the problem. Nevertheless, I have more than 500 EUR in my account, so I think I should have not received the error with 500.


De : tudor @.> Envoyé : Tuesday, August 2, 2022 12:02:13 PM À : tudorelu/pyjuque @.> Cc : cantami @.>; Author @.> Objet : Re: [tudorelu/pyjuque] InsufficientFunds error placing Sell order despite enough Binance balance (Issue #31)

For what amount are the orders placed? Perhaps there's a bug with the trade amount allocation and it each trade places is worth 500 euro.

— Reply to this email directly, view it on GitHubhttps://github.com/tudorelu/pyjuque/issues/31#issuecomment-1202096909, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AY7AZMUVC7UYNUCERROZWO3VXDBXLANCNFSM54S7F6TQ. You are receiving this because you authored the thread.Message ID: @.***>