File size: 642 Bytes
eb606e1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from fastapi import APIRouter, Depends, HTTPException
from app.services.data_fetcher import MutualFundDataFetcher
from app.models.fund_models import MarketIndicesResponse

router = APIRouter()

@router.get("/indices", response_model=MarketIndicesResponse)
async def get_market_indices():
    """

    Get current market indices data including Nifty 50, Sensex, etc.

    """
    try:
        fetcher = MutualFundDataFetcher()
        indices_data = fetcher.get_market_indices()
        return indices_data
    except Exception as e:
        raise HTTPException(status_code=500, detail=f"Error fetching market indices: {str(e)}")