add history interface

This commit is contained in:
hackerESQ
2024-09-09 20:50:18 -05:00
parent 23047d976e
commit 3284a31bb1
4 changed files with 62 additions and 0 deletions
@@ -72,4 +72,18 @@ class YahooMarketData implements MarketDataInterface
];
});
}
public function history($symbol, $startDate, $endDate): Collection
{
return collect($this->client->getHistoricalQuoteData($symbol, ApiClient::INTERVAL_1_DAY, $startDate, $endDate))
->map(function($history) use ($symbol) {
return [
'symbol' => $symbol,
'date' => $history->getDate()->format('Y-m-d'),
'close' => (float) $history->getClose(),
];
});
}
}