clean up scheduled tasks

This commit is contained in:
hackerESQ
2024-09-01 21:18:09 -05:00
parent 3ed1d8ffa2
commit fda20faf29
6 changed files with 27 additions and 8229 deletions
+9 -3
View File
@@ -2,6 +2,7 @@
namespace App\Console\Commands;
use App\Models\Holding;
use App\Models\MarketData;
use Illuminate\Console\Command;
@@ -40,11 +41,16 @@ class RefreshMarketData extends Command
public function handle()
{
// get all symbols from market data
$symbols = MarketData::get(['symbol']);
$symbols = Holding::where('quantity', '>', 0)
->select(['symbol'])
->distinct()
->get()
->pluck('symbol');
foreach ($symbols as $symbol) {
$this->line('Refreshing ' . $symbol->symbol);
$symbol->refreshMarketData();
$this->line('Refreshing ' . $symbol);
MarketData::getMarketData($symbol);
}
}
}