Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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")));
 }
Exemplo n.º 4
0
        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();
            }
        }
Exemplo n.º 5
0
 internal static void WriteHorizontalBreak(BaseStrategy strategy)
 {
     WriteHorizontalBreak(strategy, 0);
 }
Exemplo n.º 6
0
 internal static void WriteErrorFormat(BaseStrategy strategy, Exception ex, string formattedString, params object[] args)
 {
     WriteError(strategy, ex, string.Format(formattedString, args));
 }
Exemplo n.º 7
0
 internal static void WriteDebugFormat(BaseStrategy strategy, string formattedString, params object[] args)
 {
     WriteDebug(strategy, string.Format(formattedString, args));
 }
Exemplo n.º 8
0
 private static string GetLogMessagePrefix(BaseStrategy strategy)
 {
     string prefix = string.Format("[{0} | {1}]", strategy.IbAccountNumber, strategy.Instrument.Symbol);
     return prefix;
 }
Exemplo n.º 9
0
 private static string GetLogMessageDatePart(BaseStrategy strategy)
 {
     string datePart = string.Format("[{0:dd-MMM-yyyy hh:mm:ss.fff tt}]", strategy.GetCurrentDateTime());
     return datePart;
 }
Exemplo n.º 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);
 }