Back

Lean Research Environment Problems pulling data

I am attemping to setup a research env.  Pythong/C# are working with out issues with the Visual Studios.  The issue I am having is what should be in cell 6 a pandas dataframe, I am getting a different type of object.  I have seen in other examples that this type of set up have the correct output:

https://www.quantconnect.com/forum/discussion/2641/history-method-not-returning-a-dataframe-in-python/p1/comment-8071

55265_1551572249.jpg

this is the notebook output

55265_1551572262.jpg

my config.json is as followed:

55265_1551572414.jpg

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.


Hi Mathew,

Making a history requestion in the Research Environment requires passing the history call the securities that you want data for. In your example, you would want to call 

history_plain_form = qb.History(qb.Securities.Keys, 4)

The qb.Securities.Keys argument will request history for all of the Securities in the Universe that you've added thus far, and so it would only be IBM in your example. (Note that the default resolution for historical data is minute, so add the resolution argument after the number of periods requested if you want data of a different resolution.)

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.


when i update the code I get the following error, could this error be related to pythonnet?  

---------------------------------------------------------------------------
MissingMethodException Traceback (most recent call last)
<ipython-input-3-0d1ab0d7de80> in <module>()
1 qb.AddForex("eurgbp")
2 qb.SetStartDate(2017,10,16)
----> 3 history_plain_form = qb.History(qb.Securities.Keys, 4)

MissingMethodException: Method not found: 'System.__Canon Python.Runtime.PyObject.As()'.
at QuantConnect.Extensions.TryConvert[T](PyObject pyObject, T& result)
at QuantConnect.Algorithm.QCAlgorithm.<GetSymbolsFromPyObject>d__330.MoveNext() in C:\Users\blonc\Documents\Lean-master\Algorithm\QCAlgorithm.Python.cs:line 802
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at QuantConnect.Algorithm.QCAlgorithm.History(IEnumerable`1 requests, DateTimeZone timeZone) in C:\Users\blonc\Documents\Lean-master\Algorithm\QCAlgorithm.History.cs:line 545
at QuantConnect.Algorithm.QCAlgorithm.History(IEnumerable`1 requests) in C:\Users\blonc\Documents\Lean-master\Algorithm\QCAlgorithm.History.cs:line 473
at QuantConnect.Algorithm.QCAlgorithm.History(IEnumerable`1 symbols, Int32 periods, Nullable`1 resolution) in C:\Users\blonc\Documents\Lean-master\Algorithm\QCAlgorithm.History.cs:line 438
at QuantConnect.Algorithm.QCAlgorithm.History(PyObject tickers, Int32 periods, Nullable`1 resolution) in C:\Users\blonc\Documents\Lean-master\Algorithm\QCAlgorithm.Python.cs:line 540

 

0

Mathew,

Just to confirm, you do have EURUSD forex data in the data directory specified in the config.json file? If you haven't bought and downloaded this data to the necessary location, then making a history request would fail since you're asking for data from your local directory rather than the data available in the cloud.

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.


Yes I have downloaded and place only the daily data files in the correct location.

0

The default resolution for a history request is minute data, so try requesting daily data in the History request or specify daily resolution in the AddForex call, such as

qb.AddForex("eurgbp", Resolution.Daily)
qb.SetStartDate(2017,10,16)
history_plain_form = qb.History(qb.Securities.Keys, 4)

or

qb.AddForex("eurgbp")
qb.SetStartDate(2017,10,16)
history_plain_form = qb.History(qb.Securities.Keys, 4, Resolution.Daily)

This should solve the issue.

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.


For both of those you get which leads me to think it’s a pythonnet error?

TypeError Traceback (most recent call last)
<ipython-input-3-9bb8c2795ff8> in <module>()
1 qb.AddForex("eurgbp")
2 qb.SetStartDate(2017,10,16)
----> 3 history_plain_form = qb.History(qb.Securities.Keys, 4, Resolution.Daily)

TypeError: No method matches given arguments

 

0

It's possible that qb.Securities.Keys isn't a Python list and this is causing an issue. Can you try these lines and see if that works?

symbols = [x for x in qb.Securities.Keys]
history_plain_form = qb.History(symbols, 4, Resolution.Daily)

 

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.


Hi Mathew,

Are you using QuantConnect's fork/version of pythonnet?

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.


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