This commit is contained in:
hackerESQ
2024-08-24 22:51:45 -05:00
parent 54cf25aabc
commit 4c767d0001
10 changed files with 81002 additions and 112 deletions
-18
View File
@@ -31,24 +31,6 @@ class Holding extends Model
'dividends_synced_at' => 'datetime',
];
protected $appends = [
'market_gain_percent'
];
/**
* Append the market gain / loss percent attribute
*
* @return int
*
*/
public function getMarketGainPercentAttribute()
{
return (int) !empty($this->market_data?->market_value) && !empty($this->average_cost_basis)
? (($this->market_data->market_value - $this->average_cost_basis) / $this->average_cost_basis) * 100
: 0;
}
/**
* Market data for holding
*