o
    sg                  
   @   s~   d Z ddlmZmZ ddlmZ ddlmZ eddgddidd	id
g dZe	d				dde
de
dedefddZdS )zstock performance endpoints    )	APIRouterHTTPException)StockPerformance)
parsed_urlz/stock_info
stock_infodescriptionz	Not foundzInternal Server Error)  i  )prefixtags	responsesdependenciesz/stock_performance/NF   company_urltickerrebasedurationc              
      s   t  }z.|s| stdddW S |dur|j|||d}|W S | dur0t| j} |j| ||d}|W S  tyM } ztdd| dW  Y d}~S d}~ww )	a  
    Get stock price information of a company
    Company url: str: The company url
    Ticker: str: The ticker of the stock
    Rebase: bool: Rebase the stock prices (default: False)
    Duration: int: The duration of the stock data (default: 5 years)
    i  z5Ticker or company url is required to fetch stock data)status_codedetailN)r   r   r   )r   r   r   r   z7Ticker or company url is required to fetch stock data: )r   r   get_stock_infor   url
ValueError)r   r   r   r   stp
stock_datae r   @/var/www/html/XCapMarket/controllers/stock_performance_router.pyget_stock_performance   s4   	
r   )NNFr   )__doc__fastapir   r   %services.stock_info.stock_performancer   utils.url_parserr   r   poststrboolintr   r   r   r   r   <module>   s4    