bt
bt copied to clipboard
Question about dividends
I would like to include dividends in my backtest for 2 tickers: ABCP11.SA and AIEC11.SA. They have paid dividends in every month (kind of REIT). Please see my implementation for data fetching below:
data = bt.get('ABCP11.SA,AIEC11.SA', start='2022-01-01')
print(data.head())
This yields:
abcp11sa aiec11sa
Date
2022-03-15 69.217567 72.002869
2022-03-16 69.330429 72.050095
2022-03-17 69.264595 73.088821
2022-03-18 69.038857 73.372116
2022-03-21 69.057655 72.408920
However, dividend data is missing. Therefore 2 questions:
- Is there a way to directly retrieve dividend data using bt (maybe extra params on the bt.get function)?
- Is there a way to reinvest dividends automatically as part of a strategy? I am aware of other questions that went in this direction, mainly this one, but still am looking for guidance. Many thanks!