Back

Fetching files dropbox

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

Update Backtest








0

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.


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

 

0

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

0

Update Backtest





0

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.


Loading...

This discussion is closed