Can please advise if there is any alternative method to upload file other than from dropbox for more privacy reason as it must be make public in dropbox?
QUANTCONNECT COMMUNITY
Can please advise if there is any alternative method to upload file other than from dropbox for more privacy reason as it must be make public in dropbox?
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.
Shile Wen
Dear Yc Zong,
Unfortunately, in order for QuantConnect to read a file, it must be public. However, QuantConnect does have a file storing mechanism up to 5 MB through ObjectStore, which you can about read here. This means, after reading a public DropBox file once, that file can then be set again to private. Please note that the stored object will stay only in this algorithm. The following code combines file storing through ObjectStore and reading files with QuantConnect’s Custom Data Download.
import pandas as pd from io import StringIO class QuantumNadionFlange(QCAlgorithm): DATA_OSK = "data_key" FILE_URL = "https://www.dropbox.com/s/8v6z949n25hyk9o/custom_weather_data.csv?dl=1" def Initialize(self): self.SetStartDate(2019, 12, 11) self.SetCash(100000) if self.ObjectStore.ContainsKey(self.DATA_OSK): json_data = self.ObjectStore.Read(self.DATA_OSK) df = pd.read_json(json_data) self.Debug(df.head()) # once ran once, set Dropbox file to private else: file = self.Download(self.FILE_URL) df = pd.read_csv(StringIO(file)) self.ObjectStore.Save(self.DATA_OSK, df.to_json()) self.Quit(f'Object saved at {DATA_OSK}')
I have also attached a backtest for reference.
Best,
Shile Wen
Zc Yong
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!