I encountered a runtime error I did not have before. I ran backtest of my algo that worked just fine, and this error is what I got. I can't figure out where it comes from.
Trying to retrieve an element from a collection using a key that does not exist in that collection throws a KeyError exception. To prevent the exception, ensure that the key exist in the collection and/or that collection is not empty. at wrapped_function raise KeyError(f"No key found for either mapped or original key. Mapped Key: {mKey}; Original Key: {oKey}") File "./cache/algorithm/project/main.py" in PandasMapper.py: line 75
Anyone having the same issue?
Vladimir
Juhwan Kim
Try inserting this line at the beginning of your code:
from AlgorithmImports import *
Juhwan Kim
Vladimir,
That line was already added.
Juhwan Kim
Just for following up… i also am having runtime error from getting market data. My algo cant fetch market data after the update. Please let me know if anyone having a same issue.
Fred Painchaud
Hi Juhwan,
The error you get is when you access a dictionary with a key that does not exist in that dictionary.
Since you also get error with market data, then, you are most likely trying to access a DF from History that is empty.
It can be a temporary error on the QC side (market data is not available) or you are fetching data that does not exist, for instance, trying to call self.History(symbol, timedelta(1), Resolution.Minute) on a Sunday for a US stock.
Fred
Alexander Klochenok
Hi Juhwan,
I am also getting a new error this morning that I've never gotten before (been running the algo every day for months). Could it be something on QC side?
Runtime Error: Trying to dynamically access a method that does not exist throws a TypeError exception. To prevent the exception, ensure each parameter type matches those required by the 'pandas.core.frame.DataFrame'>) method. Please checkout the API documentation.
Yuri Lopukhov
Hi, @Juhvan Kim, without the code that you use hardly somebody can help you. I myself encountered this error, because this line
that used to return some enumerable object that I was later converting to Pandas dataframe with
now returns DataFrame (like other History calls with different signature, which is actually an improvement), which causes second line to fail with this error. Perhaps you have something like this.
Jared Broad
Hi Juhwan Kim Alexander Klochenok – please submit code examples so the community or QC team can quickly assist you. Unspecific reports are misleading and, 99% of the time related purely to the code running.
Closing this thread as it's not constructive. Feel free to open new ones with support@quantconnect.com with code to reproduce the issues you're having, and Alex or I can assist.
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.
Juhwan Kim
For following up again, I found an error. There was an error in my previous code and in the previous environment, no error message was shown up, and the algo worked fine as I intended (that's weird).
What happened to me was that the new environment caught the error and it did not let the algo start. Hope this will help people who have been having the same issue.
Juhwan Kim
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!