change transition structure
This commit is contained in:
@@ -105,6 +105,7 @@ class AssetSummaryService
|
||||
* cost_basis_rial: float|null,
|
||||
* unrealized_profit_rial: float|null,
|
||||
* unrealized_profit_percent: float|null,
|
||||
* unrealized_profit_gold: float|null,
|
||||
* live_gold_price: float
|
||||
* }
|
||||
*/
|
||||
@@ -126,6 +127,7 @@ class AssetSummaryService
|
||||
$costBasisRial = null;
|
||||
$unrealizedProfitRial = null;
|
||||
$unrealizedProfitPercent = null;
|
||||
$unrealizedProfitGold = null;
|
||||
|
||||
if ($goldWeight > 0) {
|
||||
$buyOrders = Order::query()
|
||||
@@ -145,6 +147,10 @@ class AssetSummaryService
|
||||
if ($costBasisRial > 0) {
|
||||
$unrealizedProfitPercent = round(($unrealizedProfitRial / $costBasisRial) * 100, 2);
|
||||
}
|
||||
// سود طلایی: همان سود ریالی تبدیلشده به وزن طلا با قیمت زندهٔ امروز
|
||||
if ($liveGoldPrice > 0) {
|
||||
$unrealizedProfitGold = round($unrealizedProfitRial / $liveGoldPrice, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,6 +164,7 @@ class AssetSummaryService
|
||||
'cost_basis_rial' => $costBasisRial,
|
||||
'unrealized_profit_rial' => $unrealizedProfitRial,
|
||||
'unrealized_profit_percent' => $unrealizedProfitPercent,
|
||||
'unrealized_profit_gold' => $unrealizedProfitGold,
|
||||
'live_gold_price' => round($liveGoldPrice, 0),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user