mirror of
https://github.com/seigler/cryptohistory.org
synced 2025-07-27 01:36:11 +00:00
🐛 Fix chart data timespan bug
This commit is contained in:
parent
385f6496b5
commit
e6bf4b8e03
1 changed files with 5 additions and 6 deletions
|
@ -116,7 +116,7 @@ function renderChart(
|
||||||
/* day, hour, minute */
|
/* day, hour, minute */
|
||||||
'1y'=> [
|
'1y'=> [
|
||||||
'resolution' => 'day',
|
'resolution' => 'day',
|
||||||
'limit' => 365,
|
'limit' => 52,
|
||||||
'aggregate' => 7,
|
'aggregate' => 7,
|
||||||
'cacheTimeSeconds' => 7 * 24 * 60 * 60
|
'cacheTimeSeconds' => 7 * 24 * 60 * 60
|
||||||
],
|
],
|
||||||
|
@ -128,13 +128,13 @@ function renderChart(
|
||||||
],
|
],
|
||||||
'7d'=> [
|
'7d'=> [
|
||||||
'resolution' => 'hour',
|
'resolution' => 'hour',
|
||||||
'limit' => 7 * 24,
|
'limit' => 7 * 24 / 4,
|
||||||
'aggregate' => 4,
|
'aggregate' => 4,
|
||||||
'cacheTimeSeconds' => 4 * 24 * 60 * 60
|
'cacheTimeSeconds' => 4 * 60 * 60
|
||||||
],
|
],
|
||||||
'24h' => [
|
'24h' => [
|
||||||
'resolution' => 'minute',
|
'resolution' => 'minute',
|
||||||
'limit' => 24 * 60,
|
'limit' => 24 * 60 / 15,
|
||||||
'aggregate' => 15,
|
'aggregate' => 15,
|
||||||
'cacheTimeSeconds' => 15 * 60
|
'cacheTimeSeconds' => 15 * 60
|
||||||
]
|
]
|
||||||
|
@ -181,8 +181,7 @@ function renderChart(
|
||||||
$cryptocompareJson = CacheManager::get($dataCacheKey);
|
$cryptocompareJson = CacheManager::get($dataCacheKey);
|
||||||
|
|
||||||
if(is_null($cryptocompareJson)) {
|
if(is_null($cryptocompareJson)) {
|
||||||
$cryptocompareJson = getJson('https://min-api.cryptocompare.com/data/histo'.
|
$cryptocompareJson = getJson("https://min-api.cryptocompare.com/data/histo$resolution?fsym=$currencyA&tsym=$currencyB&limit=$limit&aggregate=$aggregate");
|
||||||
"$resolution?fsym=$currencyA&tsym=$currencyB&limit=$limit&aggregate=$aggregate");
|
|
||||||
|
|
||||||
if ($cryptocompareJson->Response == 'Error') {
|
if ($cryptocompareJson->Response == 'Error') {
|
||||||
CacheManager::set($dataCacheKey, $cryptocompareJson, 60);
|
CacheManager::set($dataCacheKey, $cryptocompareJson, 60);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue