fix: strongly type symbol for market data and quote

This commit is contained in:
hackerESQ
2025-01-28 19:35:15 -06:00
parent d23d28afd8
commit 399858d09b
6 changed files with 38 additions and 16 deletions
@@ -28,17 +28,21 @@ class FinnhubMarketData implements MarketDataInterface
public function exists(string $symbol): bool
{
return $this->quote($symbol)->isNotEmpty();
try {
$this->quote($symbol);
return true;
} catch (\Throwable $e) {
return false;
}
}
public function quote(string $symbol): Quote
{
$quote = $this->client->quote($symbol);
if (empty($quote)) {
return new Quote;
}
$fundamental = cache()->remember(
'fh-symbol-'.$symbol,
1440,