22 lines
516 B
PHP
22 lines
516 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Services\PriceSnapshotService;
|
|
use Illuminate\Console\Command;
|
|
|
|
class PrunePriceSnapshotsCommand extends Command
|
|
{
|
|
protected $signature = 'prices:prune';
|
|
|
|
protected $description = 'Downsample and prune price history (daily at midnight)';
|
|
|
|
public function handle(PriceSnapshotService $snapshots): int
|
|
{
|
|
$stats = $snapshots->pruneHistory();
|
|
$this->info(json_encode($stats, JSON_UNESCAPED_UNICODE));
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
}
|