qewqwe
This commit is contained in:
@@ -1188,6 +1188,23 @@ final class AnalyticsService
|
||||
}
|
||||
$referencePriceAmount = $basePriceAmount;
|
||||
$referencePriceCurrency = $basePriceCurrency !== '' ? $basePriceCurrency : null;
|
||||
$cryptoDisplayAmount = null;
|
||||
$cryptoDisplayCurrency = null;
|
||||
$usdDisplayAmount = null;
|
||||
$usdDisplayCurrency = null;
|
||||
|
||||
if ($paymentType === 'crypto') {
|
||||
$cryptoDisplayCurrency = strtoupper(trim((string) ($settings['crypto_currency'] ?? 'DOGE')));
|
||||
$cryptoDisplayAmount = $this->convertAmount($basePriceAmount, $basePriceCurrency, $cryptoDisplayCurrency, $latest);
|
||||
if ($cryptoDisplayAmount === null && strtoupper($basePriceCurrency) === $cryptoDisplayCurrency) {
|
||||
$cryptoDisplayAmount = $basePriceAmount;
|
||||
}
|
||||
$usdDisplayCurrency = 'USD';
|
||||
$usdDisplayAmount = $this->convertAmount($basePriceAmount, $basePriceCurrency, 'USD', $latest);
|
||||
if ($usdDisplayAmount === null && strtoupper($basePriceCurrency) === 'USD') {
|
||||
$usdDisplayAmount = $basePriceAmount;
|
||||
}
|
||||
}
|
||||
|
||||
$expectedDogePerDay = null;
|
||||
if ($currentHashrateMh > 0 && $offerHashrateMh > 0 && is_numeric($latest['doge_per_day_interval'] ?? null)) {
|
||||
@@ -1202,16 +1219,11 @@ final class AnalyticsService
|
||||
? $effectivePriceAmount / $expectedDailyRevenue
|
||||
: null;
|
||||
|
||||
$recommendation = 'keine Basis';
|
||||
if ($breakEvenDays !== null) {
|
||||
if ($breakEvenDays <= 180) {
|
||||
$recommendation = 'lohnt eher';
|
||||
} elseif ($breakEvenDays <= 365) {
|
||||
$recommendation = 'abwaegen';
|
||||
} else {
|
||||
$recommendation = 'eher warten';
|
||||
}
|
||||
}
|
||||
$recommendation = $this->offerRecommendation(
|
||||
$breakEvenDays,
|
||||
(int) ($offer['runtime_months'] ?? 0),
|
||||
!empty($offer['auto_renew'])
|
||||
);
|
||||
|
||||
return array_merge($offer, [
|
||||
'payment_type' => $paymentType,
|
||||
@@ -1222,6 +1234,10 @@ final class AnalyticsService
|
||||
'effective_price_currency' => $effectivePriceCurrency,
|
||||
'reference_price_amount' => $this->roundOrNull($referencePriceAmount, 8),
|
||||
'reference_price_currency' => $referencePriceCurrency !== '' ? $referencePriceCurrency : null,
|
||||
'crypto_display_price_amount' => $this->roundOrNull($cryptoDisplayAmount, 8),
|
||||
'crypto_display_price_currency' => $cryptoDisplayCurrency,
|
||||
'usd_display_price_amount' => $this->roundOrNull($usdDisplayAmount, 8),
|
||||
'usd_display_price_currency' => $usdDisplayCurrency,
|
||||
'expected_doge_per_day' => $this->roundOrNull($expectedDogePerDay, 6),
|
||||
'expected_daily_revenue' => $this->roundOrNull($expectedDailyRevenue, 8),
|
||||
'break_even_days' => $this->roundOrNull($breakEvenDays, 2),
|
||||
@@ -1229,6 +1245,34 @@ final class AnalyticsService
|
||||
]);
|
||||
}
|
||||
|
||||
private function offerRecommendation(?float $breakEvenDays, int $runtimeMonths, bool $autoRenew): string
|
||||
{
|
||||
if ($breakEvenDays === null) {
|
||||
return 'keine Basis';
|
||||
}
|
||||
|
||||
if (!$autoRenew && $runtimeMonths > 0) {
|
||||
$runtimeDays = $runtimeMonths * 30.0;
|
||||
if ($breakEvenDays <= ($runtimeDays * 0.85)) {
|
||||
return 'lohnt eher';
|
||||
}
|
||||
if ($breakEvenDays <= $runtimeDays) {
|
||||
return 'abwaegen';
|
||||
}
|
||||
|
||||
return 'eher warten';
|
||||
}
|
||||
|
||||
if ($breakEvenDays <= 180) {
|
||||
return 'lohnt eher';
|
||||
}
|
||||
if ($breakEvenDays <= 365) {
|
||||
return 'abwaegen';
|
||||
}
|
||||
|
||||
return 'eher warten';
|
||||
}
|
||||
|
||||
private function enrichOfferScenario(array $offer, array $latest, float $currentHashrateMh, array $costPlans, array $purchasedMiners): array
|
||||
{
|
||||
$latestCurrency = (string) ($latest['effective_price_currency'] ?? $latest['price_currency'] ?? '');
|
||||
|
||||
Reference in New Issue
Block a user