PyTorch implementation for [WWW'2024] "FinReport: Explainable Stock Earnings Forecasting via News Factor Analyzing Model"
There are two ways to get the factors:
The first way relies on the stockstats
library, which is a wrapper for pandas dataframes.
pip install stockstats
Commonly you can input a pandas dataframe with the following columns: ['date', 'open', 'close', 'high', 'low', 'volume']
to use the wrap
function to get the factors.
import pandas as pd
from stockstats import wrap
data = pd.read_csv('stock.csv')
df = wrap(data)
Check the documentation for stockstats for more details.
More details and examples can also be found in src/Tech_Indicators.py
.
The second way to obtain the factors is to API from platforms like IFind, which provides a variety of factors. We recommend using this method to obtain more factors more esaily.
Codes are available in src/IFind_Indicators.py
. You can run it after filling the access_token
in Line 10, customizing necessary parameters of form_data
in Line 14.