Hi guys,
I'm working on a proof of concept were I trade several pairs on qunatconnect, pair selection happens on my own cloud servers for computing power. To transfer the pairs to be traded I would like to move the selected pairs to my algoritm. I found an example that I thought might be nice at:
https://github.com/QuantConnect/Lean/blob/master/Algorithm.Python/DropboxUniverseSelectionAlgorithm.py
to keep things simple I'm aiming at a proof of concept of moving the tickers via dropbox to the algoritme. I have uploaded a dummy file to dropbox (publically availible). however somewere it goes wroing because i keep getting.
"Runtime Error: symbol must not contain the characters '|' or ' '.
Parameter name: symbol (Open Stacktrace)"
File has no spaces or other weird stuff, and the code should not introduce any of these (because nothing is actually happening). I added a some logging to the algo to see were it breaks and it looks to not be able to download, on the forum I found that the self.Download() is not availible in research so no luck debuggin the issue there :(
I have been looking for quite some time but have no idea were to find the error, anyone got some advice or experience solving this, or this type of issue?
best,
Dirk
Dirk bothof
not the latest version of the algo they cannot be attched because of the runtime error i guess
code is
from System import * from QuantConnect import * from QuantConnect.Algorithm import QCAlgorithm from QuantConnect.Data.UniverseSelection import * import base64 ### modification of https://github.com/QuantConnect/Lean/blob/master/Algorithm.Python/DropboxUniverseSelectionAlgorithm.py class DropboxUniverseSelectionAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2013,1,1) self.SetEndDate(2013,1,10) self.current_universe = [] self.Log(str(self.current_universe) + str(' initialization')) self.UniverseSettings.Resolution = Resolution.Daily self.AddUniverse("my-dropbox-universe", self.selector) def selector(self, date): self.Log(str(self.current_universe) + ' start of selector ') if len(self.current_universe) == 0: file = self.Download("https://www.dropbox.com/s/ua6ff99r75hby2j/poc.csv?dl=0") self.Log(str(file) + ' after download, befor splitting') for line in file.splitlines(): data = line.split(';') self.current_universe.extend(data) self.Log(str(self.current_universe)+ ' just before universe is returned') return self.current_universe def OnData(self, slice): self.Log(str(self.current_universe) +' on data') if slice.Bars.Count == 0: return if self.changes is None: return # start fresh self.Liquidate() percentage = 1 / slice.Bars.Count for tradeBar in slice.Bars.Values: self.SetHoldings(tradeBar.Symbol, percentage) # reset changes self.changes = None self.Log(str(self.current_universe)+ ' end of on data') def OnSecuritiesChanged(self, changes): self.changes = changes
Dirk bothof
Replying to my own post again. I found the error and would like it to be documented somewhere because I have almost torn out my eyeballs trying to fix this. In some old thread it stated that the last bit of the dropbox link must be 'dl=1' by default it's 0...
Two suggestions for this:
- error message in quantconnect is confusing, it just could not download the file
- documentation on this is sparse (hope this post will help others in the future :D
best,
Dirk
Vijay Krishnan
Hi Dirk,
Just wanted to let you know that in research the qb class is very similar to the Algorithm class so you can use qb.Download in research
Petio Petrov
I am using `self.Download` to get files from Dropbox and it works great up to about 30 files. After that, no errors are logged, but the data doesn't seem to be received. My first suspicion is rate-limit on Dropbox' end. Has anyone confirmed this?
Second suspicion is some sort of limit on QuantConnect's end. Is there such a thing?
Thanks,
Petio Petrov
Derek Melchin
Hi Petio,
I recommend checking the Dropbox links that are being provided to the `Download` method. No error is thrown if they are incorrect.
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.
Haakon
I am getting the same error and I believe it is on QuantConnect's end. When self.Download() fails it seems to return an empty string. I have tried waiting a couple of seconds and download the file again, which works sometimes, but at some point the algo is just not able to download the file (I am downloading the same file many times). I don't believe it's an issue with dropbox as I am still able to use the URL to download the file “manually” when the algo fails.
Help on the issue is greatly appreciated.
Louis Szeto
Hi Haakon
Dropbox bulk down is working normally in our testing. We're not sure why your download fails with insufficient details. Could you provide a backtest for debugging your algo?
Best
Louis
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.
Dirk bothof
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!