chore:clean up ai helper methods

This commit is contained in:
hackerESQ
2024-10-31 17:04:59 -05:00
parent 12cedd9e40
commit 8007e644d6
4 changed files with 30 additions and 32 deletions
+15
View File
@@ -238,4 +238,19 @@ class Portfolio extends Model
return $close;
}
public function getFormattedHoldings()
{
$formattedHoldings = '';
foreach($this->holdings as $holding) {
$formattedHoldings .= " * Holding of ".$holding->market_data->name." (".$holding->symbol.")"
."; with ". ($holding->quantity > 0 ? $holding->quantity : 'ZERO') . " shares"
."; avg cost basis ". $holding->average_cost_basis
."; curr market value ". $holding->market_data->market_value
."; unrealized gains ". $holding->market_gain_dollars
."; realized gains ". $holding->realized_gain_dollars
."; dividends earned ". $holding->dividends_earned
."\n\n";
}
return $formattedHoldings;
}
}