예제 #1
0
        public override void RecoverySerialObject()
        {
            var r = new BacktestingResource();

            if (TestStrategySerial != null)
            {
                var s = TestStrategySerial.CreateInstance(BacktestingResource.CommonResource.StrategyPrototypeList.Cast <ISerialSupport>().ToList());
                if (s != null)
                {
                    TestStrategy = s as IStrategy;
                }
            }
            if (DataSourceSerial != null)
            {
                var s = DataSourceSerial.CreateInstance(BacktestingResource.CommonResource.DataSourcePrototypeList.Cast <ISerialSupport>().ToList());
                if (s != null)
                {
                    CurrentDataSource = s as IDataSource;
                }
            }
            if (TradeGateSerial != null)
            {
                var s = TradeGateSerial.CreateInstance(BacktestingResource.CommonResource.TradeGatePrototypeList.Cast <ISerialSupport>().ToList());
                if (s != null)
                {
                    CurrentTradeGate = s as ITradeGate;
                }
            }
            if (RiskPolicySerial != null)
            {
                var s = RiskPolicySerial.CreateInstance(BacktestingResource.CommonResource.RiskControlPrototypeList.Cast <ISerialSupport>().ToList());
                if (s != null)
                {
                    RiskPolicy = s as IRiskControl;
                }
            }
            ConditionList.Clear();
            ConditionSerialList.ForEach(v =>
            {
                var i = v.CreateInstance(BacktestingResource.CommonResource.ConditionPrototypeList.Cast <ISerialSupport>().ToList());
                if (i != null)
                {
                    ConditionList.Add(i as ICondition);
                }
            });
        }