コード例 #1
0
        private PortfolioNode ReloadPortfolio(ModelProperties properties)
        {
            PortfolioNode portfolio = new PortfolioNode(properties.Type, properties);

            portfolio.Name = properties.Name;
            string[] keys = properties.GetModelKeys();
            for (int i = 0; i < keys.Length; i++)
            {
                ModelProperties modelProperties = properties.GetModel(keys[i]);
                if (modelProperties.ModelType == ModelType.Indicator)
                {
                }
                else
                {
                    // type null for performance, positionsize, exitstrategy, etc.
                    if (modelProperties.Type == null)
                    {
//						HandlePropertySet( model, modelProperties);
                    }
                    else
                    {
                        PortfolioNode node = ReloadPortfolio(modelProperties);
                        portfolio.Nodes.Add(node);
                    }
                }
            }
            return(portfolio);
        }
コード例 #2
0
        private object GetModel(string name, ModelProperties properties)
        {
            ModelInterface model         = Plugins.Instance.GetModel(name);
            PropertyTable  propertyTable = new PropertyTable(model);
            Starter        starter       = Factory.Starter.DesignStarter();

            starter.Run(model);
            starter.Wait();
            propertyTable.UpdateAfterInitialize();
            if (properties != null)
            {
                model.OnProperties(properties);
                propertyTable.UpdateAfterProjectFile();
                string[] keys = properties.GetModelKeys();
                for (int i = 0; i < keys.Length; i++)
                {
                    ModelProperties nestedProperties = properties.GetModel(keys[i]);
                    if (nestedProperties.ModelType == ModelType.Indicator)
                    {
                        Add(nestedProperties);
                    }
                }
            }
            else
            {
                LoadIndicators(model);
            }
            return(propertyTable);
        }
コード例 #3
0
 private void FindVariables(ModelProperties properties)
 {
     string[] propertyKeys = properties.GetPropertyKeys();
     for (int i = 0; i < propertyKeys.Length; i++)
     {
         ModelProperty property = properties.GetProperty(propertyKeys[i]);
         AddVariable(property);
     }
     string[] keys = properties.GetModelKeys();
     for (int i = 0; i < keys.Length; i++)
     {
         ModelProperties nestedProperties = properties.GetModel(keys[i]);
         FindVariables(nestedProperties);
     }
 }
コード例 #4
0
        private void LoadModel(ModelProperties properties)
        {
            if (!QuietMode)
            {
                log.Debug(properties.ModelType + " " + properties.Name + ", type = " + properties.Type);
            }
            ModelInterface model = CreateModel(properties.Type, properties.Name);

            model.OnProperties(properties);
            if (!QuietMode)
            {
                log.Indent();
            }
            string[] keys = properties.GetModelKeys();
            for (int i = 0; i < keys.Length; i++)
            {
                ModelProperties nestedProperties = properties.GetModel(keys[i]);
                if (nestedProperties.ModelType == ModelType.Indicator)
                {
                }
                else
                {
                    // type null for performance, positionsize, exitstrategy, etc.
                    if (nestedProperties.Type == null)
                    {
                        HandlePropertySet(model, nestedProperties);
                    }
                    else
                    {
                        LoadModel(nestedProperties);
                        Strategy nestedModel = TopModel as Strategy;
                        nestedModel.OnProperties(nestedProperties);
                        AddDependency(model, nestedModel);
                    }
                }
            }
            if (!QuietMode)
            {
                log.Outdent();
            }
            TopModel = model;
        }