Skip to content

Commit

Permalink
Even more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Feb 13, 2025
1 parent e863efa commit 982591e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tradeexecutor/strategy/pandas_trader/position_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2723,7 +2723,7 @@ def check_enough_cash(
total_equity = self.state.portfolio.get_total_equity()
cash_in_hand = self.get_current_cash()
cash_available = cash_in_hand + cash_released + credit_released
cash_needed_total = cash_needed_for_buy + credit_supplied
cash_needed_total = cash_needed_for_buy + credit_supplied

msg = f"check_enough_cash(): cash needed: {cash_needed_total} cash will be available: {cash_available}\n" \
f"trades: cash needed: {cash_needed_for_buy}, cash released: {cash_released}\n" \
Expand All @@ -2735,6 +2735,8 @@ def check_enough_cash(
logger.info(msg)

if cash_needed_for_buy > cash_available:
for t in trades:
logger.info("Trade %s, value %s, planned reserve: %s", t, t.get_value(), t.planned_reserve)
raise NotEnoughCasForBuys(f"Release cash will not cover for buys. Likely a problem with strategy logic.\n{msg}")


Expand Down

0 comments on commit 982591e

Please sign in to comment.