forked from EvergreenCrypto/docker-finance
container: fetch: prices: crypto: mobula: isolate given year
- Will now only parse given year (or 'all', if given).
* No longer parses all subsequent years after given year
(unless 'all' is given).
- Now prints most recent daily average for given year instead of most
recent daily average for current year.
This commit is contained in:
@@ -200,8 +200,15 @@ namespace docker_finance\prices\internal\prices\crypto
|
||||
|
||||
$timestamp = $prices[$i][0] / 1000;
|
||||
$date = date('Y/m/d', $timestamp);
|
||||
$price = $prices[$i][1];
|
||||
|
||||
// Isolate given year
|
||||
$given_year = $this->get_env()->get_env('API_FETCH_YEAR');
|
||||
if ($given_year != 'all' && !preg_match('/^'.$given_year.'\//', $date)) {
|
||||
utils\CLI::print_debug("skipping $date");
|
||||
continue;
|
||||
}
|
||||
|
||||
$price = $prices[$i][1];
|
||||
$stack += [$date => $price];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user