I want to fetch the revenue of different companies from their income statements.
qb = QuantBook()
aapl = qb.AddEquity("AAPL")
qb.GetFundamental(qb.Securities.Keys, "FinancialStatements.IncomeStatement.TotalRevenue.OneMonth", start_time, end_time)
QUANTCONNECT COMMUNITY
I want to fetch the revenue of different companies from their income statements.
qb = QuantBook()
aapl = qb.AddEquity("AAPL")
qb.GetFundamental(qb.Securities.Keys, "FinancialStatements.IncomeStatement.TotalRevenue.OneMonth", start_time, end_time)
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Varad Kabade
Hi Rushi Chaudhari
The total revenue data are available at least 3 mths apart therefore we cannot get the data for one month. We recommend using
Refer to the attached research notebook.
Best
Varad Kabade
Big mak
Rushi,
I've worked pretty heavily on this subject. If you want TTM revenue, you'll need to try something similar to this. If you read through this thread of mine you'll see that the docs say GetFundamental isn't usable in backtesting (even though right now it is), and that getting historical fundamental data is difficult in general. But, you can do some pretty neat things if you can get it to work properly.
In the attached algorithm the most recent revenue figure (threemonths) is obtained by using GetFundamental for all stocks in very crude manner, although you can probably make this more efficient (and you can change the dates to get historical values).
However, if you don't need historical fundamental data and you just need the most recent quarter's fundamental data, it might be better to not use GetFundamental at all since it's pretty slow. In the attached algorithm I get market cap and shares outstanding without GetFundamental.
Rushi Chaudhari
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!