use cash not Buying power

This commit is contained in:
zastian-dev
2026-02-10 20:20:49 +00:00
parent b75e93d2fa
commit c53fb1f7b5

View File

@@ -238,10 +238,10 @@ impl TradingBot {
}; };
let portfolio_value: f64 = account.portfolio_value.parse().unwrap_or(0.0); let portfolio_value: f64 = account.portfolio_value.parse().unwrap_or(0.0);
let buying_power: f64 = account.buying_power.parse().unwrap_or(0.0); let cash: f64 = account.cash.parse().unwrap_or(0.0);
let max_allocation = portfolio_value * MAX_POSITION_SIZE; let max_allocation = portfolio_value * MAX_POSITION_SIZE;
let available_funds = buying_power - (portfolio_value * MIN_CASH_RESERVE); let available_funds = cash - (portfolio_value * MIN_CASH_RESERVE);
if available_funds <= 0.0 { if available_funds <= 0.0 {
return 0; return 0;