@@ -14,27 +14,19 @@ const TXCOUNT = "txcount"
14
14
const ACTIVE_ADDRESSES = "aa_last7d"
15
15
16
16
export const fetchGrowThePie = async ( ) : Promise < GrowThePieData > => {
17
- const url = "https://api.growthepie.xyz/v1/fundamentals .json"
17
+ const url = "https://api.growthepie.xyz/v1/fundamentals_7d .json"
18
18
19
- const response = await fetch ( url , { cache : "no-store" } )
19
+ const response = await fetch ( url )
20
20
if ( ! response . ok ) {
21
21
console . log ( response . status , response . statusText )
22
22
throw new Error ( "Failed to fetch growthepie data" )
23
23
}
24
24
const data : DataItem [ ] = await response . json ( )
25
25
26
- // Get the date 7 days ago
27
- const sevenDaysAgo = new Date ( )
28
- sevenDaysAgo . setDate ( sevenDaysAgo . getDate ( ) - 7 )
29
-
30
- // Filter data to only include the last 7 days and the metrics we need
31
- const filteredData = data . filter ( ( item ) => {
32
- const itemDate = new Date ( item . date )
33
- return (
34
- itemDate >= sevenDaysAgo &&
35
- [ TXCOSTS_MEDIAN_USD , TXCOUNT , ACTIVE_ADDRESSES ] . includes ( item . metric_key )
36
- )
37
- } )
26
+ // Filter data to only include the metrics we need
27
+ const filteredData = data . filter ( ( item ) =>
28
+ [ TXCOSTS_MEDIAN_USD , TXCOUNT , ACTIVE_ADDRESSES ] . includes ( item . metric_key )
29
+ )
38
30
39
31
const mostRecentDate = filteredData . reduce ( ( latest , item ) => {
40
32
const itemDate = new Date ( item . date )
0 commit comments