Exemple #1
0
        public static TradingStrategyComponentSettings GenerateExampleSettings(
            ITradingStrategyComponent component)
        {
            if (component == null)
            {
                throw new ArgumentNullException();
            }

            var settings = new TradingStrategyComponentSettings
            {
                Enabled     = false,
                ClassType   = component.GetType().AssemblyQualifiedName,
                Name        = component.Name,
                Description = component.Description
            };

            var interfaces = component.GetType().GetInterfaces()
                             .Where(i => typeof(ITradingStrategyComponent).IsAssignableFrom(i))
                             .Select(i => i.Name);

            settings.ImplementedInterfaces = string.Join(";", interfaces);

            settings.ComponentParameterSettings = ParameterHelper.GetParameterAttributes(component)
                                                  .Select(ParameterSettings.GenerateExampleSettings)
                                                  .ToArray();

            return(settings);
        }