Hello everyone,
I am a new user coming from the recent Quantopian shutdown. I would often use the Quantopian Notebooks for backtesting purposes. they had a QGrid implementation that would format the results from a pipeline in an easy to read grid. It would keep everything neatly organized and would allow you to scroll through the results. It would look something like this:
| Date | Symbol | (NameOfFundamental) | (NameOfFundamental) | etc...
| Date | Symbol | (FundamentalValue) | (FundamentalValue) | etc...
| Date | Symbol | (FundamentalValue) | (FundamentalValue) | etc...
Does Quantconnect have a similar feature? I have come across the standard dataframe, but I am not familiar with how to edit the columns and rows to show something similar to what is shown above. I am going to include the code from my notebook so you can see what I have come up with.
I really appreciate any help and guidance!
from clr import AddReference
AddReference("System")
AddReference('System.Memory')
AddReference("QuantConnect.Common")
AddReference("QuantConnect.Research")
AddReference("QuantConnect.Indicators")
from System import *
from QuantConnect import *
from QuantConnect.Data.Market import TradeBar, QuoteBar
from QuantConnect.Research import *
from QuantConnect.Indicators import *
from datetime import datetime, timedelta
import matplotlib.pyplot as plt
import pandas as pd
# Create an instance
qb = QuantBook()
tickers = [
"MSFT",
"AAPL",
"NVDA",
"INTC"
]
symbols = [qb.AddEquity(ticker, Resolution.Daily).Symbol for ticker in tickers]
start_date = datetime(2010, 1, 4)
end_date = datetime(2010, 1, 5)
data = qb.GetFundamental(symbols, "ValuationRatios.PERatio", start_date, end_date)
print(data)
*Also, the symbols across the top have what looks like some form of ID (Ex: R735QTJ8XC9X) How do you get rid of this? Thank you guys so much!
Derek Melchin
Hi Connor,
`print(data)` prints the DataFrame in string format. Change this line to just `data`.
The columns are the security identifiers for each stock. To change these to just the ticker, we could use
data.columns = map(lambda x : x.Value, symbols)
Note that the resulting list contains the first ticker each security used, not the current ticker.
See the attached research notebook for reference.
Best,
Derek Melchin
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.
Connor Kelly
Hey Derek,
Thank you for your response! It has definitely proven helpful. I did a lot of work with Quantopian Notebooks and had a screener established that filtered through historical fundamental data. The shut down definitely threw me for a loop and I have had some troubles getting everything set up on here, so I definitely appreciate the help!
Connor Kelly
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!