CoolFace
Apppublic

hwdevelops/equitylens

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes
fetcher.cpython-314.pyc42 linesDownload Raw Back to __pycache__
1+
2�_�ib	��B�Rt^RIt^RItRRRlltRRltRRltR#)	u�3fetcher.py — Centralized data layer for EquityLens.4 5All modules should import from here instead of calling yfinance directly.6This ensures consistent data handling and a single point of maintenance.7Nc�P�V^8�dQhR\R\R\P/#)��ticker�period�return)�str�pd�	DataFrame)�formats"�)C:\Users\donov\equitylens\data\fetcher.py�__annotate__rs%����c��3��"�,�,��c�>�\P!V4pVPVR7pVP'd$\	RV24\8P!4#V# \d1p\	RTRT24\9P!4uRp?#Rp?ii;i)aQ10Fetch historical OHLCV price data for a given ticker.11 12Args:13    ticker: Stock symbol as a string, e.g. "AAPL"14    period: How far back to fetch. Options: 1mo, 3mo, 6mo, 1y, 2y, 5y15 16Returns:17    A pandas DataFrame with columns: Open, High, Low, Close, Volume18    Returns an empty DataFrame if the ticker is invalid or data unavailable.19)rz*[Warning] No price data found for ticker: z'[Error] Could not fetch price data for �: N)�yf�Ticker�history�empty�printrr	�	Exception)rr�stock�df�es&&   r�get_price_historyrs�����	�	�&�!��
�]�]�&�]�
)��
�8�8�8��>�v�h�G�H��<�<�>�!��	����
�7��x�r�!��E�F��|�|�~����s(�9A!�"A!�A!�!B�,%B�B�Bc�0�V^8�dQhR\R\/#)rrr)r�dict)r20s"rrr's����3��4�r
c���\P!V4pRVPRVPRVPRVP21/pV# \dp\RTRT24/uRp?#Rp?ii;i)a22Fetch fundamental financial statements for a given ticker.23 24Args:25    ticker: Stock symbol as a string, e.g. "AAPL"26 27Returns:28    A dictionary with keys: 'income_stmt', 'balance_sheet', 'cash_flow'29    Each value is a pandas DataFrame. Returns empty dict on failure.30�income_stmt�
balance_sheet�	cash_flow�infoz'[Error] Could not fetch financials for rN)rrrrrr rr)rr�31financialsrs&   r�get_financialsr"'sy����	�	�&�!��
�U�.�.��U�0�0��U�_�_��U�Z�Z�	32�33������
�7��x�r�!��E�F��	���s�A	A�A4�A/�)A4�/A4c�$�V^8�dQhR\/#)rr)r)r34s"rrrBs����c�r
c��\P!V4pVPpVR,pV# \dp\	RTRT24Rp?R#Rp?ii;i)z�35Fetch the current price for a given ticker.36 37Args:38    ticker: Stock symbol as a string e.g. "AAPL"39 40Returns:41    Current price as a float, or None if unavailable.42�currentPricez*[Error] Could not fetch current price for rN)rrr rr)rrr �pricers&    r�get_current_pricer'BsV����	�	�&�!���z�z���^�$�������
�:�6�(�"�Q�C�H�I����s�,/�A�A�A)�1y)�__doc__�yfinancer�pandasrrr"r'�r
r�<module>r-s!������6�6r