From Documentation, I find an example, which can get data from a csv file. I copy it and link to dropbox successfully.
The problem is that if I have multiple stocks and multiple csv files, I may need to create links from dropbox one by one. Now I have many stocks and I may need to copy those links one by one, I have too many files and it is not possible for me to manage them.
I would like to ask if there is a way to handle this process ?
Thank you very much.
Alexandre Catarino
Hi Ka Ho Cheung ,
Given that the files have the same structure, we can use the same custom data class. We can use a dictionary, keyed by the ticker, of links to the Dropbox data:
def GetSource(self, config, date, isLiveMode): # Use a Dictionary for each file in Dropbox keyed by the ticker sources = { 'MSFT': "https://www.dropbox.com/s/qjfem6mw5cpozdw/MSFT.csv?dl=1", 'AAPL': "https://www.dropbox.com/s/ok4d5hzrkozt41l/AAPL.csv?dl=1" } return SubscriptionDataSource(sources[config.Symbol.Value], SubscriptionTransportMedium.RemoteFile);
Please find a working example in the attachment.
Ka Ho Cheung
Dear Alexandre,
Thank you for your reply. I can see that you have 2 links
- https://www.dropbox.com/s/qjfem6mw5cpozdw/MSFT.csv?dl=1
- https://www.dropbox.com/s/ok4d5hzrkozt41l/AAPL.csv?dl=1
I would like to ask if there is a way to create a link to the folder first:- https://www.dropbox.com/s/ooooooooo
And then I can have:- https://www.dropbox.com/s/ooooooooo/AAPL.csv?dl=1
- https://www.dropbox.com/s/ooooooooo/MSFT.csv?dl=1
I have do some research and find that there is apis for dropbox, but it is a little bit complicated for me. So I would like to ask for a simpler method. It is okay if there is no way to do it at this moment. Thank you very much.Derek Melchin
Hi Ka Ho Cheung,
This is not currently possible. When sharing Dropbox files that are in the same folder, the parent directory is still different. For example, if we have sheet1.csv and sheet2.csv in the folder, after sharing them, the links will look like:
It's also not possible to add onto the Dropbox folder URL to access the contents of the folder.
I suggest storing the files on GitHub instead. Accessing the files in a folder would then be possible.
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.
Ka Ho Cheung
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!