internal static void WriteInfo(BaseStrategy strategy, string message)
 {
     string prefix = string.Format("[{0} | {1}]", strategy.IbAccountNumber, strategy.Instrument.Symbol);
     string datePart = string.Format("[{0:dd-MMM-yyyy hh:mm:ss.fff tt}]", strategy.GetCurrentDateTime());
     const string formattedString = "{0} -- {1} -- {2}";
     Console.WriteLine(string.Format(formattedString, prefix, datePart, message));
 }
        internal static void SetAndValidateValue(BaseStrategy strategy)
        {
            strategy.CurrentValidityDateTime = new DateTime(strategy.ValidityTriggerDate.Year,
                strategy.ValidityTriggerDate.Month, strategy.ValidityTriggerDate.Day)
                .AddHours(strategy.ValidityTriggerHour)
                .AddMinutes(strategy.ValidityTriggerMinute);

            strategy.CurrentStartOfSessionTime = new DateTime(strategy.ValidityTriggerDate.Year,
                strategy.ValidityTriggerDate.Month,
                strategy.ValidityTriggerDate.Day)
                .AddSeconds(PstSessionTimeConstants.StockExchangeStartTimeSeconds);

            strategy.CurrentEndOfSessionTime = new DateTime(strategy.ValidityTriggerDate.Year,
                strategy.ValidityTriggerDate.Month,
                strategy.ValidityTriggerDate.Day)
                .AddSeconds(PstSessionTimeConstants.StockExchangeEndTimeSeconds);

            if (strategy is BaseOpeningStrategy)
            {
                BaseOpeningStrategy opS = strategy as BaseOpeningStrategy;
                LoggingUtility.WriteInfo(opS,
                    string.Format(
                        "Queued order to {0} {1} after {2} for a portfolio of {3:c} with {4} positions",
                        opS.OpeningOrderSide,
                        strategy.Instrument.Symbol,
                        strategy.CurrentValidityDateTime,
                        opS.TotalPortfolioAmount,
                        opS.NumberOfPortfolioPositions));
            }
            else
            {
                LoggingUtility.WriteInfo(strategy,
                    string.Format(
                        "Queued order to {0} {1} after {2}",
                        strategy.GetOrderSide(),
                        strategy.Instrument.Symbol,
                        strategy.CurrentValidityDateTime));

                LoggingUtility.WriteInfo(strategy,
                                         string.Format("Queued order to close {0} after {1}",
                                                       strategy.Instrument.Symbol,
                                                       strategy.CurrentValidityDateTime));
            }
        }
 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 WriteInfoFormat(BaseStrategy strategy, string formattedString, params object[] args)
 {
     WriteInfo(strategy, string.Format(formattedString, args));
 }
 internal static void WriteHorizontalBreak(BaseStrategy strategy)
 {
     WriteInfo(strategy, "----------------------------");
 }