@@ -38,7 +38,7 @@ def get_news(
3838 Query params:
3939 - page: Page number (default: 1)
4040 - limit: Items per page (default: 12, max: 500)
41- - period: Time filter ("24h ", "7d", "30d", "all")
41+ - period: Time filter ("48h ", "7d", "30d", "all")
4242 - sentiment: Filter by sentiment ("positive", "neutral", "negative")
4343 - search: Search query (searches title and content)
4444 """
@@ -67,8 +67,8 @@ def get_news(
6767 # Apply period filter
6868 if period :
6969 now = datetime .now (timezone .utc )
70- if period == "24h " :
71- cutoff = now - timedelta (hours = 24 )
70+ if period == "48h " :
71+ cutoff = now - timedelta (hours = 48 )
7272 query = query .filter (News .published_at >= cutoff )
7373 elif period == "7d" :
7474 cutoff = now - timedelta (days = 7 )
@@ -80,7 +80,7 @@ def get_news(
8080 # No filter for "all"
8181 pass
8282 else :
83- raise HTTPException (400 , "Invalid period. Use: 24h , 7d, 30d, or all" )
83+ raise HTTPException (400 , "Invalid period. Use: 48h , 7d, 30d, or all" )
8484
8585 # Sentiment filter (p/n/neutral)
8686 if sentiment :
@@ -104,8 +104,8 @@ def get_news(
104104
105105 total_query = db .query (News )
106106 if period and period != "all" :
107- if period == "24h " :
108- cutoff = now - timedelta (hours = 24 )
107+ if period == "48h " :
108+ cutoff = now - timedelta (hours = 48 )
109109 elif period == "7d" :
110110 cutoff = now - timedelta (days = 7 )
111111 elif period == "30d" :
@@ -180,15 +180,15 @@ def refresh_news(db: Session = Depends(get_db), redis = Depends(get_redis)):
180180
181181@router .get ("/api/sentiment/aggregate" )
182182def get_market_sentiment (
183- period : str = "24h " , # "24h ", "7d", "30d", "all"
183+ period : str = "48h " , # "48h ", "7d", "30d", "all"
184184 db : Session = Depends (get_db ),
185185 redis = Depends (get_redis )
186186):
187187 """
188188 Get overall market sentiment for specified period.
189189
190190 Query params:
191- - period: "24h " (default), "7d", "30d", "all"
191+ - period: "48h " (default), "7d", "30d", "all"
192192
193193 Returns:
194194 - Distribution: % positive/neutral/negative
@@ -211,16 +211,16 @@ def get_market_sentiment(
211211 # Calculate cutoff based on period
212212 now = datetime .now (timezone .utc )
213213
214- if period == "24h " :
215- cutoff = now - timedelta (hours = 24 )
214+ if period == "48h " :
215+ cutoff = now - timedelta (hours = 48 )
216216 elif period == "7d" :
217217 cutoff = now - timedelta (days = 7 )
218218 elif period == "30d" :
219219 cutoff = now - timedelta (days = 30 )
220220 elif period == "all" :
221221 cutoff = None
222222 else :
223- raise HTTPException (400 , "Invalid period. Use: 24h , 7d, 30d, or all" )
223+ raise HTTPException (400 , "Invalid period. Use: 48h , 7d, 30d, or all" )
224224
225225 # Query with optional date filter
226226 query = db .query (
@@ -294,12 +294,12 @@ def get_market_sentiment(
294294
295295
296296@router .get ('/api/coins/sentiment' )
297- def get_coins_sentiment (period :str = "24h " ,
297+ def get_coins_sentiment (period :str = "48h " ,
298298 db : Session = Depends (get_db ),
299299 redis = Depends (get_redis ),
300300 ):
301301 '''API buat ngereturn top 5 bullish dan bearish coins
302- Params: period (24h and 7d)
302+ Params: period (48h and 7d)
303303
304304 Response:
305305 - ticker
@@ -323,16 +323,16 @@ def get_coins_sentiment(period:str = "24h",
323323 # Calculate cutoff based on period
324324 now = datetime .now (timezone .utc )
325325
326- if period == "24h " :
327- cutoff = now - timedelta (hours = 24 )
326+ if period == "48h " :
327+ cutoff = now - timedelta (hours = 48 )
328328 elif period == "7d" :
329329 cutoff = now - timedelta (days = 7 )
330330 elif period == "30d" :
331331 cutoff = now - timedelta (days = 30 )
332332 elif period == "all" :
333333 cutoff = None
334334 else :
335- raise HTTPException (400 , "Invalid period. Use: 24h , 7d, 30d, or all" )
335+ raise HTTPException (400 , "Invalid period. Use: 48h , 7d, 30d, or all" )
336336
337337 query = db .query (
338338 Coin .symbol ,
@@ -420,16 +420,16 @@ def get_coins_bubble(period: str = "all",
420420 # Calculate cutoff based on period
421421 now = datetime .now (timezone .utc )
422422
423- if period == "24h " :
424- cutoff = now - timedelta (hours = 24 )
423+ if period == "48h " :
424+ cutoff = now - timedelta (hours = 48 )
425425 elif period == "7d" :
426426 cutoff = now - timedelta (days = 7 )
427427 elif period == "30d" :
428428 cutoff = now - timedelta (days = 30 )
429429 elif period == "all" :
430430 cutoff = None
431431 else :
432- raise HTTPException (400 , "Invalid period. Use: 24h , 7d, 30d, or all" )
432+ raise HTTPException (400 , "Invalid period. Use: 48h , 7d, 30d, or all" )
433433
434434 query = db .query (
435435 Coin .symbol ,
0 commit comments