Esempio n. 1
0
        public override void SaveInfo()
        {
            if (TargetProject == null)
            {
                return;
            }

            OpenedViewModel.ForEach(v =>
            {
                if (v is IEditableViewModel)
                {
                    if ((v as IEditableViewModel).IsChanged)
                    {
                        (v as IEditableViewModel).Save();
                    }
                }
            });

            TargetProject.ConditionList.Clear();
            foreach (var obj in ConditionList)
            {
                if (obj.TargetObject != null)
                {
                    TargetProject.ConditionList.Add(obj.TargetObject);
                }
            }
            TargetProject.PredicateList.Clear();
            foreach (var obj in PredicateList)
            {
                if (obj.TargetObject != null)
                {
                    TargetProject.PredicateList.Add(obj.TargetObject);
                }
            }
            TargetProject.InstrumentList.Clear();
            foreach (var obj in InstrumentList)
            {
                TargetProject.InstrumentList.Add(obj);
            }
            TargetProject.ResultList.Clear();
            foreach (var obj in ResultList)
            {
                TargetProject.ResultList.Add(obj.TargetObject);
            }
            TargetProject.BlockList.Clear();
            foreach (var v in BlockList)
            {
                TargetProject.BlockList.Add(v.TargetObject.Clone() as IInstrument);
            }
            IsChanged = false;

            TargetSummaryVM.Refresh();
        }
Esempio n. 2
0
        public override void Refresh()
        {
            CheckRunningStatus();
            CommonProc.SynchroniseList <IMarketData>(TargetProject.MarketDataList, MarketDataList);
            //CommonProc.SynchroniseList<IIndicatorValue>(TargetProject.IndicatorDataList, IndicatorDataList);
            CommonProc.SynchroniseList <IOrder>(TargetProject.OrderList, OrderList);
            CommonProc.SynchroniseList <TimeValueObject>(TargetProject.CurrentValueList, CurrentValueList);
            CommonProc.SynchroniseList <TimeValueObject>(TargetProject.StandardValueList, StandardValueList);
            if (CurrentInstrument == null && InstrumentList.Count > 0)
            {
                CurrentInstrument = InstrumentList.FirstOrDefault();
            }
            if (CurrentInstrument != null)
            {
                var l = MarketDataList.Where(v => v.InstrumentTicker == CurrentInstrument.Ticker);
                CommonProc.SynchroniseList <IMarketData>(l, CurrentInstrumentMarketDataList);
                var ol = OrderList.Where(v => v.Ticker == CurrentInstrument.Ticker);
                CommonProc.SynchroniseList <IOrder>(ol, CurrentInstrumentOrderList);
            }

            TestCurrentTime = TargetProject.TestCurrentTime;
            OnPropertyChanged("CurrentValue");
            OnPropertyChanged("Pnl");
            OnPropertyChanged("StatusPnl");
            OnPropertyChanged("Efficiency");
            OnPropertyChanged("MaxLost");
            refreshChartAxis();
            OnPropertyChanged("CanStart");
            OnPropertyChanged("CanPause");
            OnPropertyChanged("CanStop");
            OnPropertyChanged("FinishPercent");
            if (TargetSummaryVM != null)
            {
                TargetSummaryVM.Refresh();
            }
            OnPropertyChanged("CanStart");
            OnPropertyChanged("CanPause");
            OnPropertyChanged("CanStop");
            OnPropertyChanged("TestCurrentTimeInfo");
            base.Refresh();
        }
Esempio n. 3
0
        public override void SaveInfo()
        {
            if (TargetProject == null)
            {
                return;
            }
            OpenedViewModel.ForEach(v =>
            {
                if (v is IEditableViewModel)
                {
                    if ((v as IEditableViewModel).IsChanged)
                    {
                        (v as IEditableViewModel).Save();
                    }
                }
            });

            TargetProject.ConditionList.Clear();
            foreach (var obj in ConditionList)
            {
                if (obj.TargetObject != null && obj.TargetObject is ICondition)
                {
                    var c = obj.TargetObject as ICondition;
                    TargetProject.ConditionList.Add(c);
                    c.SaveToParameterList();
                }
            }

            TargetProject.InstrumentList.Clear();
            foreach (var obj in InstrumentList)
            {
                TargetProject.InstrumentList.Add(obj);
            }

            IsChanged = false;

            TargetSummaryVM.Refresh();
        }
Esempio n. 4
0
        public override void LoadInfo()
        {
            if (TargetProject == null)
            {
                return;
            }

            ConditionList.Clear();
            TargetProject.ConditionList.ForEach(v => ConditionList.Add(new ConditionViewModel()
            {
                TargetObject = v
            }));
            InstrumentList.Clear();
            TargetProject.InstrumentList.ForEach(v => InstrumentList.Add(v));
            CurrentStrategy   = TargetProject.TestStrategy;
            CurrentTradeGate  = TargetProject.CurrentTradeGate;
            CurrentDataSource = TargetProject.CurrentDataSource;
            IsChanged         = false;
            if (TargetSummaryVM != null)
            {
                TargetSummaryVM.Refresh();
            }
        }
Esempio n. 5
0
        public override void LoadInfo()
        {
            if (TargetProject == null)
            {
                return;
            }
            ConditionList.Clear();
            TargetProject.ConditionList.ForEach(v => ConditionList.Add(new ConditionViewModel()
            {
                TargetObject = v
            }));
            PredicateList.Clear();
            TargetProject.PredicateList.ForEach(v => PredicateList.Add(new ConditionViewModel()
            {
                TargetObject = v
            }));

            InstrumentList.Clear();
            TargetProject.InstrumentList.ForEach(v => InstrumentList.Add(v));
            ResultList.Clear();
            TargetProject.ResultList.ForEach(v => ResultList.Add(new InstrumentViewModel()
            {
                TargetObject = v, GetCurrentDataSource = () => { return(CurrentDataSource); }
            }));
            TargetProject.BlockList.ForEach(v => BlockList.Add(new InstrumentViewModel()
            {
                TargetObject = v, GetCurrentDataSource = () => { return(CurrentDataSource); }
            }));
            CurrentDataSource = TargetProject.CurrentDataSource;

            IsChanged = false;
            if (TargetSummaryVM != null)
            {
                TargetSummaryVM.Refresh();
            }
        }