Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBAutomater IOException trying to delete IBAutomater.log #86

Open
omidkrad opened this issue Jul 25, 2024 · 1 comment
Open

IBAutomater IOException trying to delete IBAutomater.log #86

omidkrad opened this issue Jul 25, 2024 · 1 comment

Comments

@omidkrad
Copy link

omidkrad commented Jul 25, 2024

This always happens when running the project locally.

20240725 21:54:22.571 ERROR:: Engine.Run():  System.IO.IOException: The process cannot access the file 'C:\Jts\ibgateway\1019\IBAutomater.log' because it is being used by another process.
   at System.IO.FileSystem.DeleteFile(String fullPath)
   at System.IO.File.Delete(String path)
   at QuantConnect.IBAutomater.IBAutomater.Start(Boolean waitForExit)
   at QuantConnect.Brokerages.InteractiveBrokers.InteractiveBrokersBrokerage.a(IAlgorithm A_0, IOrderProvider A_1, ISecurityProvider A_2, String A_3, String A_4, Int32 A_5, String A_6, String A_7, String A_8, String A_9, String A_10, String A_11, Boolean A_12, Nullable`1 A_13)
   at QuantConnect.Brokerages.InteractiveBrokers.InteractiveBrokersBrokerage..ctor(IAlgorithm algorithm, IOrderProvider orderProvider, ISecurityProvider securityProvider, String account, String host, Int32 port, String ibDirectory, String ibVersion, String userName, String password, String tradingMode, String agentDescription, Boolean loadExistingHoldings, Nullable`1 weeklyRestartUtcTime)
   at QuantConnect.Brokerages.InteractiveBrokers.InteractiveBrokersBrokerageFactory.CreateBrokerage(LiveNodePacket job, IAlgorithm algorithm)
   at QuantConnect.Lean.Engine.Setup.BrokerageSetupHandler.CreateBrokerage(AlgorithmNodePacket algorithmNodePacket, IAlgorithm uninitializedAlgorithm, IBrokerageFactory& factory)
   at QuantConnect.Lean.Engine.Engine.Run(AlgorithmNodePacket job, AlgorithmManager manager, String assemblyPath, WorkerThread workerThread)

---- REPRO STEPS ----
ibgateway version: 1019
In Launcher project reference the following nuget packages:

  • QuantConnect.Brokerages.InteractiveBrokers
  • QuantConnect.Brokerages.InteractiveBrokers.ToolBox
    (latest version is 2.5.16517 for both)

In config.json set the following settings:

  "environment": "live-interactive",
  "data-provider": "QuantConnect.Lean.Engine.DataFeeds.DownloaderDataProvider",
  "data-downloader": "QuantConnect.ToolBox.IBDownloader.IBDataDownloader",

  // QC access token
  "job-user-id": "...",
  "api-access-token": "...",
  "job-organization-id": "...",

  // interactive brokers configuration
  "ib-account": "...",
  "ib-user-name": "...",
  "ib-password": "...",
  "ib-host": "127.0.0.1",
  "ib-port": "4002",
  "ib-agent-description": "Individual",
  "ib-tws-dir": "C:\\Jts",
  "ib-version": "1019",
  "ib-trading-mode": "live",
  "ib-enable-delayed-streaming-data": false,
  "ib-weekly-restart-utc-time": "22:00:00",

Run the Launcher

@omidkrad
Copy link
Author

I tried to link QuantConnect.Brokerages.InteractiveBrokers by project reference instead of package. The project QuantConnect.Brokerages.InteractiveBrokers references QuantConnect.IBAutomater by project.
In QuantConnect.IBAutomater project I tried to put the line that tries to delete IBAutomater.log in try/catch, but for some reason after doing this and running the project only once, IB Gateway stops working altogether. Even trying to run IB Gateway manually won't work and ibgateway process won't load at all. When reverting changes and linking QuantConnect.Brokerages.InteractiveBrokers by package instead of by project, and running the Launcher, then IB Gateway starts again, with the exception happening again:

System.IO.IOException: The process cannot access the file 'C:\Jts\ibgateway\1019\IBAutomater.log' because it is being used by another process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant