internal static void WriteError(BaseStrategy strategy, Exception ex, string message)
        {
            var logger = strategy.GetLogger();
            if (!logger.IsErrorEnabled)
                return;

            var prefix = GetLogMessagePrefix(strategy);
            var datePart = GetLogMessageDatePart(strategy);

            logger.Error(ex, FormattedMessageString, prefix, datePart, message);
        }
        internal static void WriteDebug(BaseStrategy strategy, string message)
        {
            var logger = strategy.GetLogger();
            if (!logger.IsDebugEnabled)
                return;

            var prefix = GetLogMessagePrefix(strategy);
            var datePart = GetLogMessageDatePart(strategy);

            logger.Debug(FormattedMessageString, prefix, datePart, message);
        }
 internal static void SetAndValidateValue(BaseStrategy strategy)
 {
     LoggingUtility.WriteInfo(strategy,
         string.Format("Order will be retried at minimum 01m and maximum of {0}m intervals.",
             strategy.MaximumIntervalInMinutesBetweenOrderRetries.ToString("00")));
 }
        internal static void WriteHorizontalBreak(BaseStrategy strategy, int numberOfLineBreaks)
        {
            var prefix = GetLogMessagePrefix(strategy);
            var datePart = GetLogMessageDatePart(strategy);

            Console.WriteLine(FormattedMessageString, prefix, datePart, "----------------------------");
            for (int i = 0; i < numberOfLineBreaks; i++)
            {
                Console.WriteLine();
            }
        }
 internal static void WriteHorizontalBreak(BaseStrategy strategy)
 {
     WriteHorizontalBreak(strategy, 0);
 }
 internal static void WriteErrorFormat(BaseStrategy strategy, Exception ex, string formattedString, params object[] args)
 {
     WriteError(strategy, ex, string.Format(formattedString, args));
 }
 internal static void WriteDebugFormat(BaseStrategy strategy, string formattedString, params object[] args)
 {
     WriteDebug(strategy, string.Format(formattedString, args));
 }
 private static string GetLogMessagePrefix(BaseStrategy strategy)
 {
     string prefix = string.Format("[{0} | {1}]", strategy.IbAccountNumber, strategy.Instrument.Symbol);
     return prefix;
 }
 private static string GetLogMessageDatePart(BaseStrategy strategy)
 {
     string datePart = string.Format("[{0:dd-MMM-yyyy hh:mm:ss.fff tt}]", strategy.GetCurrentDateTime());
     return datePart;
 }
Example #10
0
 public virtual string GetEntrySignalName(BaseStrategy strategy)
 {
     return string.Format("{0}{1}.{2}.{3}.{4}.{5}", GetLegNamePrefix(),
         Index,
         strategy.ProjectName,
         strategy.GetCurrentDateTime().ToString("ddMMM.HHmmss"),
         this.OrderSide.ToString().ToUpper(),
         this.Instrument.Symbol);
 }