wip
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user