I am reading in data via dropbox, it works with out any issue using the following “GetSource”
def GetSource(self, config, date, isLiveMode):
symbol = config.Symbol.Value
file = CSV_FILES.get(symbol)
#dropbox method return
return SubscriptionDataSource(file, SubscriptionTransportMedium.RemoteFile)
I moved those exact CSV files locally and changed my function to:
def GetSource(self, config, date, isLiveMode):
symbol = config.Symbol.Value
file = CSV_FILES.get(symbol)
source = os.path.join(Globals.DataFolder, file)
#Local method return
return SubscriptionDataSource(source, SubscriptionTransportMedium.LocalFile)
I am using “Lean CLI” so am aware that the files need to be in the data folder. I know for certain the files are going into the container because I used python write to read and write the file based on the file path that comes from “Source” So I know the files are there in the container. They are identical to the files on dropbox. Yet when I the “RemoteFile” version the strategy works totally as functioned. When I run the “LocalFile” version I get all zeros and the data not even loaded.
any suggestion on best path to determine why one works with out issue and the local does not even with the CSV files being identical
Louis Szeto
Hi Mathew
Please make sure you put the CSV file in the \data file under the directory where you do lean init.
Then the source line needs to be changed into (for example, the custom_weather_data.csv file in the image):
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.
Mathew Blonc
I thought a very similar thing, so I tried the following to confirm that the location path was correct:
this does indeed save a text file inside the container which is then intern saved into my data folder for Lean:
the content of that file , is as you would expect:
to further investigate I went one step further… as I wanted to know if the data was actually moving over to the container. So I took the above function, used the file location given by the path and then copied the file. the file indeed is in the data folder.
so I can for certain say that the file is there with in the container. What other steps can I take to debug this? literally the only thing that has changed is the file is local vs remote. it is the exact same file from dropbox.
Mathew Blonc
to maybe add more context. I did a similar write line in the
when I run the “get source” with the remote file the Reader is called. and my generic text file is wrote to. However, if I use the local file the “Reader” is never even called…. so it seems it is not even making it to Reader with the local files. however, I am certain the local files are there
Louis Szeto
Hi Matthew
We are unable to reproduce your problem. Could you please attach the whole PythonData class (including both GetSource and Reader methods) and the full path of your .csv/.txt file for further assistance?
Please also check if the data is saved on Launcher\bin\Debug\cache\data with a hash-like name like Launcher\bin\Debug\cache\data\3e9e7604efe3499e0b452ca237261087.csv
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.
Mathew Blonc
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!