Skip to content

IBAutomater IOException trying to delete IBAutomater.log #86

@omidkrad

Description

@omidkrad

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions