Skip to content

Commit e94a3da

Browse files
committed
[TradingMode] add skip_portfolio_available_check_before_creating_orders
1 parent 07c04a6 commit e94a3da

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

octobot_trading/modes/channel/abstract_mode_consumer.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ def on_reload_config(self):
4343
Implement if necessary
4444
"""
4545

46+
def skip_portfolio_available_check_before_creating_orders(self) -> bool:
47+
"""
48+
When returning true, will skip portfolio available funds check
49+
before calling self.create_new_orders().
50+
Override if necessary
51+
"""
52+
return False
53+
4654
def flush(self):
4755
self.trading_mode = None
4856
self.exchange_manager = None
@@ -149,8 +157,8 @@ async def create_order_if_possible(self, symbol, final_note, state, **kwargs) ->
149157

150158
# Can be overwritten
151159
async def can_create_order(self, symbol, state):
152-
if symbol is None:
153-
# can't check
160+
if symbol is None or self.skip_portfolio_available_check_before_creating_orders():
161+
# should not check
154162
return True
155163
currency, market = symbol_util.parse_symbol(symbol).base_and_quote()
156164
portfolio = self.exchange_manager.exchange_personal_data.portfolio_manager.portfolio

0 commit comments

Comments
 (0)