use cash not Buying power
This commit is contained in:
@@ -238,10 +238,10 @@ impl TradingBot {
|
||||
};
|
||||
|
||||
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 available_funds = buying_power - (portfolio_value * MIN_CASH_RESERVE);
|
||||
let available_funds = cash - (portfolio_value * MIN_CASH_RESERVE);
|
||||
|
||||
if available_funds <= 0.0 {
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user