LEAN is the open source
algorithmic trading engine powering QuantConnect. Founded in 2013 LEAN has been built by a
global community of 80+ engineers and powers more than a dozen hedge funds today.
Alpha League Competition: $1,000 Weekly Prize Pool
Qualifying Alpha Streams Reentered Weekly Learn
more
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:
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.
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.
Jack Simonson
49.4k Pro
,
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
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
Mathew Blonc
478 Pro
,
when i update the code I get the following error, could this error be related to pythonnet?
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
Jack Simonson
49.4k Pro
,
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
Mathew Blonc
478 Pro
,
Yes I have downloaded and place only the daily data files in the correct location.
0
Jack Simonson
49.4k Pro
,
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
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
Alexandre Catarino
100.6k Pro
,
Hi Mathew,
Are you using QuantConnect's fork/version of pythonnet?
0
Mathew Blonc
478 Pro
,
without issues, I can run python and c# in VS. Only when I try to run jupyter do I have problems. I do have python quantconnect installed. I looked at nugets and it does have quantconnects version of pythonnet. should bye "composer-dll-directory": ".", in config.json be set to anything other than "." could this be an issue?
the error i always have gotten and still am getting is "TypeError: No method matches given arguments" relating to qb.History() method.
0
Mathew Blonc
478 Pro
,
I may have found a partial step forward in this post:
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__381.MoveNext() in C:\Lean\Algorithm\QCAlgorithm.Python.cs:line 804
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:\Lean\Algorithm\QCAlgorithm.History.cs:line 545
at QuantConnect.Algorithm.QCAlgorithm.History(IEnumerable`1 requests) in C:\Lean\Algorithm\QCAlgorithm.History.cs:line 473
at QuantConnect.Algorithm.QCAlgorithm.History(IEnumerable`1 symbols, Int32 periods, Nullable`1 resolution) in C:\Lean\Algorithm\QCAlgorithm.History.cs:line 438
at QuantConnect.Algorithm.QCAlgorithm.History(PyObject tickers, Int32 periods, Nullable`1 resolution) in C:\Lean\Algorithm\QCAlgorithm.Python.cs:line 542
0
Link Liang
6.1k Pro
,
Hi Mathew,
qb.History(20) returns a list of Slice object. You might see a different output from some old posts because we have a slightly different QuantBook object now, which is closer to QCAlgorithm and easier for the convertion between research environment and algorithm backtesting. More information about Slice object is here.
I cannot reproduce the “Method not found” error you have. Here is an example of accessing historical data in two different ways. In [1] outputs some data from Slice list, and In [2] prints a DataFrame. If you still encounter that error, please attach your notebook or full code so that we could address the issue in details.
Me too is facing the same problem mentioned in this post where the algorithm could be easily ran on the cloud but on local jupyter i get the same error where self.History gives me No metthod matches given arguments for History i dont know what is wrong in setting my local environment
0
Mathew Blonc
478 Pro
,
the best way I found to get this functioning locally is to follow the steps with in the docer files, just use them as a guide. A key step is to make sure you compile your code with python settings as well as make sure to move the DLL. Just use docker files as step by step instructions and it has always worked for me.
0
Jared Broad
STAFF Pro
,
Matthew's suggestion is good if you want to install it locally. But the beauty of docker is it allows you to easily keep up with updates.
We're almost done releasing a new update to research which works better locally. Hopefully it'll be out this week.
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.
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...
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!