Click or drag to resize

IConnector logging

The IConnector objects similar strategies also implement the ILogSource interface. Therefore, from the IConnector object you can receive messages through the LogManager by all means that are available for strategies.

IConnector logging example

  1. As a demonstration selected examples showing work with the Rithmic. All examples log information from the connector to a text file.

  2. First, you need to create a log manager:

    C#
    private readonly LogManager _logManager = new LogManager();
  3. Then you need to create a file logger, and to add it to the LogManagerListeners:

    C#
    _logManager.Listeners.Add(new FileLogListener());
  4. The final step is to add the RithmicTrader в LogManagerSources:

    C#
    _logManager.Sources.Add(_trader);
  5. As a result, the program will display messages as shown below after the start:

    18:43:15 | Info  | RithmicTrader
    18:43:15 | Debug | RithmicTrader     | ReadPortfolios()
    18:43:15 | Debug | RithmicTrader      | OnProcessPortfolios()
    18:43:15 | Debug | RithmicTrader      | 41469|15152,43|15530,8|
    18:43:15 | Debug | RithmicTrader     | ReadSecurities()
    18:43:15 | Debug | RithmicTrader      | OnProcessSecurities
    18:43:15 | Debug | RithmicTrader      | 291|ESU5|