When i try to fetch multiple symbol universe selection return sysmbol data in log like this
Symbol : AAPL close price : 5.92
Symbol : AIG close price :11.8
Symbol : IBM close price :11.67
Symbol : AAPL close price : 5.92
Symbol : AIG close price :11.8
Symbol : IBM close price :11.67
But i want data like this Symbol by Symbol
Symbol : AAPL close price : 100.92
Symbol : AAPL close price : 99.92
Symbol : AIG close price :11.8
Symbol : AIG close price :12.1
Symbol : IBM close price :43.67
Symbol : IBM close price :45.61
Shile Wen
Hi Muhammad,
Why would you want to print all prices? Please note that price logging is forbidden. I suggest instead to try out our Charting to display this data.
Best,
Shile Wen
Muhammad Mudassar
Hi Shile
Thanks for your reply i will use chart to display data, price logging is just an example is it possible to sort data by Symbol when universe selection return data as i have mentioned above, i need all row for first symbol then 2nd and then third 3rd and so on ......
Jared Broad
You can use the object store to build temporary lists but it's only accessible in QC because of restrictions on our data use.
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.
Muhammad Mudassar
Hi Jared
Thank you so much for reply
Do i need to build temporary list in Alpha modal and pass that list to SymbolData calss ? can you please quote any example if someone already build?
Thanks
M.Moudassar
Derek Melchin
Hi Muhammad,
We can access the list inside the SymbolData class by either:
See the attached backtest for an example of all three approaches.
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.
Muhammad Mudassar
Hi Derek
Thnaks for your help yes i am able to access list of symbols in Symbol data but want to know one things, is it possible to order by Symbol when accessing multiple symbol for now i am getting
2020-11-03 00:00:00 : List passed to SymbolData: AAPL 2020-11-03 00:00:00 : List passed to SymbolData: IBM 2020-11-04 00:00:00 : List passed to SymbolData: AAPL 2020-11-04 00:00:00 : List passed to SymbolData: IBM 2020-11-05 00:00:00 : List passed to SymbolData: AAPL 2020-11-05 00:00:00 : List passed to SymbolData: IBM
i want like this2020-11-03 00:00:00 : List passed to SymbolData: AAPL 2020-11-04 00:00:00 : List passed to SymbolData: AAPL 2020-11-05 00:00:00 : List passed to SymbolData: AAPL 2020-11-03 00:00:00 : List passed to SymbolData: IBM 2020-11-04 00:00:00 : List passed to SymbolData: IBM 2020-11-05 00:00:00 : List passed to SymbolData: IBM
Actually in my strategy i am comparing current row data with previous row so i need Symbol by Symbol data when i have multiple symbol
ThanksM.Moudassar
Derek Melchin
Hi Muhammad,
Data is streamed into the algorithm chronologically. To print all of the symbol data for one symbol before proceeding to the next would require multiple runs given the backtest above. Consider reviewing our documentation on time.
To access historical prices for securities, setup a RollingWindow in the SymbolData class. Then, to produce logs like those above, we would just loop through the RollingWindow for each SymbolData object.
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.
Muhammad Mudassar
Hi Derek
I am using RollingWindow in Symbol data to access historical prices for securities, see attcehd backtest all done only finding way to iterate data symbol by symbol to get required output
I am bit consfused here "multiple runs given the backtest above"
M.Mudassar
Derek Melchin
Hi Muhammad,
To get the desired output, we can loop through the previous bars for each SymbolData object. For example,
for bar in symbolData.previous_bars: algorithm.Log(f"Close for {bar.Symbol} at {bar.Time}: {bar.Close}")
See the attached backtest for reference.
Continuing with the development of this algorithm, consider warming up the AverageTrueRange indicator, setting up some consolidators, and converting the `IsTrend` method to a custom python indicator.
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.
Muhammad Mudassar
Hi Derek
Can you please attach sample backtest to execute data Symbol By Symbol as i have mentioned ? I am using RollingWindow in the SymbolData class to fetch previous rows values but i did't get how to produce logs like those above and loop through the RollingWindow for each SymbolData object.
regards,
M.Mudassar
Muhammad Mudassar
Hi Derek,
Thanks for you help i am looking backtest you have attached
regards,
M.Mudassar
Muhammad Mudassar
Hi Derek,
Backtest you attached in which you are using rolling window and only 5 records ate in sort order i want but i need whole data in sort by Symbol like even i have one year of data to so it sorted like this
- 2020-11-03 00:00:00 : List passed to SymbolData: AAPL
- 2020-11-04 00:00:00 : List passed to SymbolData: AAPL
- 2020-11-05 00:00:00 : List passed to SymbolData: AAPL
. . . .- 2020-11-03 00:00:00 : List passed to SymbolData: IBM
- 2020-11-04 00:00:00 : List passed to SymbolData: IBM
- 2020-11-05 00:00:00 : List passed to SymbolData: IBM
. . . . . Please see this simple attached backtest please covert it in sort by smbol as i want i have spent much time i did't desired outputregards,M.Mudassar
Derek Melchin
Hi Muhammad,
It's not possible to produce those logs given the algorithm above since the data is passed to the algorithm in chronological order for all of the symbols. To increase the amount of history in the algorithm I shared previously, increase the size of RollingWindow at the line that reads
self.previous_bars = RollingWindow[TradeBar](10)
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.
Muhammad Mudassar
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!