Lean Implementation of IQFeed

Back

Hey guys, I'm currently trying to backtest on Lean using Python and IQFeed.  I've pieced together parts of how to do this through the GitHub and forum pages but I'm kind of stuck now.  I've put below the implementation details from the config file.  I modified the backtesting handlers to add IQFeed similar to the other examples in the config file.

// iqfeed configuration
"iqfeed-host": "127.0.0.1",
"iqfeed-username": "PRIVATE",
"iqfeed-password": "PRIVATE",
"iqfeed-productName": "PRIVATE",
"iqfeed-version": "6.1.0.20",

"backtesting-iqfeed": {
"live-mode": false,

"setup-handler": "QuantConnect.Lean.Engine.Setup.ConsoleSetupHandler",
"result-handler": "QuantConnect.Lean.Engine.Results.BacktestingResultHandler",
"data-feed-handler": "QuantConnect.Lean.Engine.DataFeeds.FileSystemDataFeed",
"real-time-handler": "QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler",
"history-provider": "QuantConnect.ToolBox.IQFeed.IQFeedDataQueueHandler",
"transaction-handler": "QuantConnect.Lean.Engine.TransactionHandlers.BacktestingTransactionHandler"
},

I set up IQFeed's connections through a Docker implementation for Linux that uses Wine and Lean successfully connects to the feed.  I'm now receiving errors on the requests themselves.

HistoryPort.ProcessHistoryJob(): Submitting request: Equity-: Minute 08/30/2019 15:59:00->09/01/2019 00:00:00

LookupIntervalEventArgs.ctor(): REQ_HST_INT0000000,E,Invalid symbol format.,

In addition, the Data folder is not being updated and creating these errors:

SubscriptionDataSourceReader.CreateStreamReaderError(): File not found: ../../../Data/equity/usa/minute/spy/20190903_quote.zip
ubscriptionDataSourceReader.CreateStreamReaderError(): File not found: ../../../Data/equity/usa/minute/spy/20190903_trade.zip

I've tried replacing the data feed handler with the same IQFeed entry as I've seen in other posts but it returns an exception when I do.  I've also tried to use the IQFeed downloader in the Toolbox to manually get the data in the folder but it doesn't look like it can see the login details from the config file when it tries to pull the data, uses default values, and returns an error since it can't login.

Obviously I'm not doing something right, whether with implemenation or just my use of Lean within its limitations. 

I've seen somewhere that IQFeed isn't meant to be used for backtesting, is this correct?  If so, is there a way to get the downloader working so that the data folder can be populated beforehand? 

Is there a way to get IQFeed running correctly with the symbol formatting so that it properly populates the folders?

Any help is appreciated.  Thanks guys!

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.


As an update, copying the config file from the Launcher folder into the ToolBox (and possibly bin/Debug since I put it in both) folder removes the Config.Get() reverting to default error with the ToolBox data downloader for IQFeed.  It seems it was looking for the config in the local folder instead of the Launcher folder.

The IQFeed downloader still will not download data, however.  Here's the request line that I'm giving it: 

mono ./QuantConnect.ToolBox.exe --app=IQFeedDownloader --tickers=SPY --resolution=Minute --from-date=20180101-00:00:00

It sees that it's looking for IQFeed correctly but the following error pops up:

20201102 14:33:51.635 ERROR:: IQFeedDownloaderProgram.IQFeedDownloader():  System.ComponentModel.Win32Exception (0x80004005): Cannot find the specified file
  at System.Diagnostics.Process.StartWithShellExecuteEx (System.Diagnostics.ProcessStartInfo startInfo) [0x00102] in <3d97dda773a54430b892e1d794e5d921>:0
  at System.Diagnostics.Process.Start () [0x00032] in <3d97dda773a54430b892e1d794e5d921>:0
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
  at System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo) [0x0001b] in <3d97dda773a54430b892e1d794e5d921>:0
  at System.Diagnostics.Process.Start (System.String fileName, System.String arguments) [0x00007] in <3d97dda773a54430b892e1d794e5d921>:0
  at IQFeed.CSharpApiClient.IQFeedLauncher.Start (System.String login, System.String password, System.String productId, System.String productVersion, System.Int32 connectionTimeoutMs, System.Int32 retry) [0x00115] in <eb6eb778cdc849db821f652002796569>:0
  at QuantConnect.ToolBox.IQFeedDownloader.IQFeedDownloaderProgram.IQFeedDownloader (System.Collections.Generic.IList`1[T] tickers, System.String resolution, System.DateTime fromDate, System.DateTime toDate) [0x00131] in <6d0a6c54b7bc42c1b06cd89c70b2adbe>:0 

 

0

Brad Hearne do you still have the issue? Sorry for this late response.

0

No problem! I forgot to revisit this.  After a bunch of digging and trials, it looks like the data downloader in the toolbox is only built for Windows implementation (was able to get it to download on Windows and all the references are to the Windows file locations).  So, since I'm mainly using Linux for development at the moment, I ended up writing my own to pull data and convert it to the format that Lean wants using pyiqfeed as a backbone.

https://github.com/akapur/pyiqfeed

Thanks for following up!

1

Hi Brad. Maybe we can revisit that together... it should be very easy to setup and make it run. Where did you install IQFeed client?

0

Sure, I don't mind revisiting it but I think it's more of an issue in differences between OSes for the Downloader not anything to do with IQFeed that I was having.

Linux Setup:
-IQFeed run through a Docker container (Wine was not playing nice so this took care of the issues I was having)
-Lean algortihms were able to see the IQFeed data when I had the IQFeed login details in the configuration file
-Downloader wouldn't launch after feeding it the configuration data due to the error above. After digging, into the scripts, it was looking for WIndows file paths to the IQFeed ".exe" file. While this may just be a default path that could be pointed elsewhere, I'm not familiar with the language the Downloader and associated launch scripts are written in so I decided to code my own with use of the above repo.

Windows Setup:
-Installed IQFeed to default path
-Lean algorithms saw data
-Downloader downloaded data as expected when launched with configuration

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