Team Ai
Apppublic

Deepvest/ProfilingAI

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
data_provider.cpython-310.pyc9 linesDownload Raw Back to __pycache__
1o

2�C~g��@s*ddlZddlZddlZGdd�d�ZdS)�Nc@seZdZdd�Zdd�ZdS)�FinnhubDataProvidercCstjdd�|_dS)NZ(csrq269r01qj3u0os3r0csrq269r01qj3u0os3rg)�api_key)�finnhub�Client�client)�self�r�9/Users/sandrine/Deepvest_system/src/core/data_provider.py�__init__szFinnhubDataProvider.__init__c	3Cs�ttj�|d����}ttj�|d����}z@|j�|d||�}|ddkrMt�tj|ddd�|d|d|d	|d4|dd��}|j	d
dd�|WSt5d|���WdStyp}zt6d|���WYd}~dSd}~ww)Nz%Y-%m-%d�D�s�ok�t)�unit�c�h�l�o�v)�date�close�high�low�open�volumerT)�inplacezError fetching data for zError: )�int�datetime�strptime�	timestampr�
stock_candles�pd�	DataFrame�to_datetime�	set_index�print�	Exception)	r�symbol�7start_date�end_dateZstart_timestampZ
end_timestamp�data�df�errr	�get_stock_data	s,���z"FinnhubDataProvider.get_stock_dataN)�__name__�8__module__�__qualname__r9r-rrrr	rsr)rr�pandasr!rrrrr	�<module>s