public static List <FormulaItem> BuildArgs(string text, StrategyModel model) { var words = Tokens.Parse(text).ToList(); var argBuilder = new FormulaItemBuilder(model); var args = new List <FormulaItem>(); foreach (var token in words) { switch (token.TokenType) { case Token.Type.Operator: args.Add(argBuilder.Build()); args.Add(FormulaItem.BuildeOperand(token.Data)); argBuilder = new FormulaItemBuilder(model); break; case Token.Type.Number: case Token.Type.Word: if (!argBuilder.TryAddWord(token)) { throw new InvalidSemanticItemException(null, text, message: $"Unknown or unsupported value {token.Data}"); } break; } } args.Add(argBuilder.Build()); return(args); }
public void EditStrategy(StrategyModel request) { ValidateRequest(request); var strategy = _dbContext.Strategies.Single(x => x.Id == request.Id); _mapper.Map(request, strategy); }
public JsonResult UpdateStrategy(int id, string name) { if (string.IsNullOrEmpty(name)) { return(Json(new ResultModel(false, "策略名称不能为空"))); } var mode = new StrategyModel { Id = id, Name = name.Trim() }; var result = iStrategyProvider.HasExistsStrategy(mode); if (result.Result) { if (result.Data) { return(Json(new ResultModel(false, "策略名称已经存在"))); } } else { return(Json(new ResultModel(false, "服务器异常"))); } var res = iStrategyProvider.UpdateStrategyName(mode); return(Json(res.Result ? new ResultModel(true, "成功") : new ResultModel(false, "服务器异常"))); }
public async Task <StrategyModel> SaveStrategyAsync(StrategyModel model) { using (var scope = _container.BeginLifetimeScope()) { Strategy record; var repository = scope.Resolve <IStrategyRepository>(); if (model.StrategyId == 0) { record = repository.Add(new Strategy()); } else { record = await repository.GetAsync(model.StrategyId); } if (record != null) { record.Name = model.Title; record.Url = model.Url; record.Deleted = model.Deleted; record.Description = model.Summary; record.Active = model.Active; record.JsonArticleBlocks = JsonConvert.SerializeObject(model.Blocks); await repository.CommitAsync(); model.StrategyId = record.StrategyId; } return(model); } }
public void ValidateRequest(StrategyModel request) { if (string.IsNullOrEmpty(request.Type)) { throw new Exception("type is empty."); } var percentStrategy = request.Type.EqualsIgnoreCase(AppConstants.StrategyTypePercent); var rangeStrategy = request.Type.EqualsIgnoreCase(AppConstants.StrategyTypeRange); if (percentStrategy && request.Percent <= 0) { throw new Exception( $"Strategy is of type {AppConstants.StrategyTypePercent} and the {nameof(request.Percent)} is {request.Percent}"); } if (rangeStrategy && request.Minimum < 0) { throw new Exception( $"Strategy is of type {AppConstants.StrategyTypeRange} and the {nameof(request.Minimum)} is {request.Minimum}"); } if (rangeStrategy && request.Maximum < 0) { throw new Exception( $"Strategy is of type {AppConstants.StrategyTypeRange} and the {nameof(request.Maximum)} is {request.Maximum}"); } var strategiesExists = _dbContext.Strategies.Where(x => x.Id != request.Id && x.Stock.ToUpper() == request.Stock.ToUpper()); if (strategiesExists.Any()) { throw new Exception("Strategy already exists for stock"); } }
public StrategyViewModel(StrategiesViewModel parent, StrategyModel model, MarketService markets, AccountService accounts, SettingService settings) { _parent = parent; Model = model ?? throw new ArgumentNullException(nameof(model)); _markets = markets; _accounts = accounts; _settings = settings; StartCommand = new RelayCommand(() => DoRunStrategy(), () => true); StopCommand = new RelayCommand(() => { }, () => false); CloneCommand = new RelayCommand(() => DoCloneStrategy(), () => true); CloneAlgorithmCommand = new RelayCommand(() => DoCloneAlgorithm(), () => !string.IsNullOrEmpty(Model.AlgorithmName)); ExportCommand = new RelayCommand(() => DoExportStrategy(), () => true); DeleteCommand = new RelayCommand(() => _parent?.DoDeleteStrategy(this), () => true); DeleteAllTracksCommand = new RelayCommand(() => DoDeleteTracks(null), () => true); DeleteSelectedTracksCommand = new RelayCommand <IList>(m => DoDeleteTracks(m), m => true); UseParametersCommand = new RelayCommand <IList>(m => DoUseParameters(m), m => true); AddSymbolCommand = new RelayCommand(() => DoAddSymbol(), () => true); DeleteSymbolsCommand = new RelayCommand <IList>(m => DoDeleteSymbols(m), m => SelectedSymbol != null); ImportSymbolsCommand = new RelayCommand(() => DoImportSymbols(), () => true); ExportSymbolsCommand = new RelayCommand <IList>(m => DoExportSymbols(m), trm => SelectedSymbol != null); TrackDoubleClickCommand = new RelayCommand <TrackViewModel>(m => DoSelectItem(m)); MoveUpSymbolsCommand = new RelayCommand <IList>(m => OnMoveUpSymbols(m), m => SelectedSymbol != null); MoveDownSymbolsCommand = new RelayCommand <IList>(m => OnMoveDownSymbols(m), m => SelectedSymbol != null); SortSymbolsCommand = new RelayCommand(() => Symbols.Sort(), () => true); Model.NameChanged += StrategyNameChanged; Model.MarketChanged += MarketChanged; Model.AlgorithmNameChanged += AlgorithmNameChanged; DataFromModel(); Model.EndDate = DateTime.Now; }
public JsonResult AddStrategy(string name, string strategyid) { if (string.IsNullOrEmpty(name)) { return(Json(new ResultModel(false, "策略名称不能为空"))); } var mode = new StrategyModel { Name = name.Trim(), StrategyId = Convert.ToInt32(strategyid) }; var result = iStrategyProvider.HasExistsStrategy(mode); if (result.Result) { if (result.Data) { return(Json(new ResultModel(false, "策略名称已经存在"))); } } else { return(Json(new ResultModel(false, "服务器异常"))); } var res = iStrategyProvider.AddStrategy(mode); return(Json(res.Result ? new ResultModel(true, "成功") : new ResultModel(false, "服务器异常"))); }
public void TestStreamValueMinusParamValuePips() { var model = new StrategyModel() { Parameters = new List <StrategyParameter>() { new StrategyParameter() { Id = "param_1", ParameterType = StrategyParameter.INTEGER, DefaultValue = "5" } } }; var parser = new StopLimitParser(model); var order = parser.Parse("low - param_1"); Assert.IsNotNull(order); Assert.AreEqual(3, order.ValueStack.Count()); Assert.AreEqual(null, order.ValueStack[0].Value); Assert.AreEqual("low", order.ValueStack[0].Substream); Assert.AreEqual(FormulaItem.STREAM, order.ValueStack[0].ValueType); Assert.AreEqual("-", order.ValueStack[1].Value); Assert.AreEqual(FormulaItem.OPERAND, order.ValueStack[1].ValueType); Assert.AreEqual("param_1", order.ValueStack[2].Value); Assert.AreEqual(FormulaItem.PARAM, order.ValueStack[2].ValueType); Assert.AreEqual("low - param_1", order.UserInput); }
public void ModelParser_IndicatorLessThanNumber() { var model = new StrategyModel() { Sources = new System.Collections.Generic.List <Source>() { new Source() { Id = "rsi", Name = "RSI", SourceType = Source.INDICATOR } } }; var parser = new ConditionParser(model); var condition = parser.Parse("rsi < 20"); Assert.IsNotNull(condition); Assert.AreEqual(Condition.LT, condition.ConditionType); Assert.AreEqual("rsi", condition.Arg1.Value); Assert.AreEqual(FormulaItem.STREAM, condition.Arg1.ValueType); Assert.AreEqual(FormulaItem.VALUE, condition.Arg2.ValueType); Assert.AreEqual("20.0", condition.Arg2.Value); Assert.AreEqual("rsi < 20", condition.UserInput); }
public StrategyViewModel(ITreeViewModel parent, StrategyModel model, MarketsModel markets, SettingModel settings) { _parent = parent; Model = model ?? throw new ArgumentNullException(nameof(model)); _markets = markets; _settings = settings; StartCommand = new RelayCommand(() => DoStartCommand(), () => !IsBusy && !Active); StopCommand = new RelayCommand(() => DoStopCommand(), () => !IsBusy && Active); CloneCommand = new RelayCommand(() => DoCloneStrategy(), () => !IsBusy); CloneAlgorithmCommand = new RelayCommand(() => DoCloneAlgorithm(), () => !IsBusy && !string.IsNullOrEmpty(Model.AlgorithmLocation)); ExportCommand = new RelayCommand(() => DoExportStrategy(), () => !IsBusy); DeleteCommand = new RelayCommand(() => DoDeleteStrategy(), () => !IsBusy); DeleteAllTracksCommand = new RelayCommand(() => DoDeleteTracks(null), () => !IsBusy); DeleteSelectedTracksCommand = new RelayCommand <IList>(m => DoDeleteTracks(m), m => !IsBusy); UseParametersCommand = new RelayCommand <IList>(m => DoUseParameters(m), m => !IsBusy); AddSymbolCommand = new RelayCommand(() => DoAddSymbol(), () => !IsBusy); DeleteSymbolsCommand = new RelayCommand <IList>(m => DoDeleteSymbols(m), m => !IsBusy && SelectedSymbol != null); ImportSymbolsCommand = new RelayCommand(() => DoImportSymbols(), () => !IsBusy); ExportSymbolsCommand = new RelayCommand <IList>(m => DoExportSymbols(m), trm => !IsBusy && SelectedSymbol != null); TrackDoubleClickCommand = new RelayCommand <TrackViewModel>(m => DoSelectItem(m), m => !IsBusy); MoveUpSymbolsCommand = new RelayCommand <IList>(m => OnMoveUpSymbols(m), m => !IsBusy && SelectedSymbol != null); MoveDownSymbolsCommand = new RelayCommand <IList>(m => OnMoveDownSymbols(m), m => !IsBusy && SelectedSymbol != null); SortSymbolsCommand = new RelayCommand(() => Symbols.Sort(), () => !IsBusy); MoveStrategyCommand = new RelayCommand <ITreeViewModel>(m => OnMoveStrategy(m), m => !IsBusy); DropDownOpenedCommand = new RelayCommand(() => DoDropDownOpenedCommand(), () => !IsBusy); Model.NameChanged += StrategyNameChanged; Model.AlgorithmNameChanged += AlgorithmNameChanged; DataFromModel(); Model.EndDate = DateTime.Now; Debug.Assert(IsUiThread(), "Not UI thread!"); }
public void ModelParser_IndicatorSubstream() { var model = new StrategyModel() { Sources = new System.Collections.Generic.List <Source>() { new Source() { Id = "stoch", Name = "STOCHASTIC", SourceType = Source.INDICATOR } } }; var parser = new ConditionParser(model); var condition = parser.Parse("stoch.K <= 30"); Assert.IsNotNull(condition); Assert.AreEqual(Condition.LTE, condition.ConditionType); Assert.AreEqual("stoch", condition.Arg1.Value); Assert.AreEqual("K", condition.Arg1.Substream); Assert.AreEqual(FormulaItem.STREAM, condition.Arg1.ValueType); Assert.AreEqual(FormulaItem.VALUE, condition.Arg2.ValueType); Assert.AreEqual("30.0", condition.Arg2.Value); Assert.AreEqual("stoch.K <= 30", condition.UserInput); }
public void ModelParser_CloseCrossMVAWithShift() { var model = new StrategyModel() { Sources = new System.Collections.Generic.List <Source>() { new Source() { Id = "mva", Name = "MVA", SourceType = Source.INDICATOR } } }; var parser = new ConditionParser(model); var condition = parser.Parse("close cross mva 2 period back"); Assert.IsNotNull(condition); Assert.AreEqual(Condition.CROSSES, condition.ConditionType); Assert.AreEqual(null, condition.Arg1.Value); Assert.AreEqual(FormulaItem.STREAM, condition.Arg1.ValueType); Assert.AreEqual(2, condition.Arg1.PeriodShift); Assert.AreEqual("close", condition.Arg1.Substream); Assert.AreEqual(FormulaItem.STREAM, condition.Arg2.ValueType); Assert.AreEqual(2, condition.Arg2.PeriodShift); Assert.AreEqual("mva", condition.Arg2.Value); Assert.IsNotNull(condition.Conditions); Assert.AreEqual("close cross mva 2 period back", condition.UserInput); }
public static StrategyModel ToModel(this StrategyEntity SE) { if (SE != null) { BossesPerZoneRepository repoBZ = new BossesPerZoneRepository(); CharactersConfigurationRepository repoCC = new CharactersConfigurationRepository(); UserRepository repoU = new UserRepository(); StrategyModel SM = new StrategyModel(); SM.User = repoU.GetOne(SE.UserId).MapTo <UserModel>(); SM.CharactersConfiguration = repoCC.GetOne(SE.CharactersConfigurationId).ToModel(); SM.BossZone = repoBZ.GetOne(SE.BossZoneId).ToModel(); SM.ImagePath1 = SE.ImagePath1; SM.ImagePath2 = SE.ImagePath2; SM.ImagePath3 = SE.ImagePath3; SM.ImagePath4 = SE.ImagePath4; SM.Description = SE.Description; SM.Note = SE.Note; SM.Id = SE.Id; SM.Active = SE.Active; return(SM); } else { return(null); } }
/// <summary> /// 初始化的时候,需要设置具体策略(参数就是策略类型) /// </summary> /// <param name="type"></param> public StrategyContext(string strategyName) : this() { //if (type == "正常收费") // settlement= new NormalSettlement(); //else if (type == "每满300减100") // settlement = new RebateSettlement(300, 100); //else if (type == "打8折") // settlement = new DiscountSettlement(0.8); //找到当前的策略模型 StrategyModel mode = (from m in modelList where m.StrategyName.Equals(strategyName) select m).First(); //找到策略参数 object[] param = null; if (mode.Param != null && mode.Param.Length != 0) { param = mode.Param.Split(','); } //基于反射创建策略对象 settlement = (SettlementAbstract)Assembly.Load("StrategyDesignPattern4"). CreateInstance("StrategyDesignPattern4." + mode.ClassName, false, BindingFlags.Default, null, param, null, null); }
public void AddStrategy(ApplicationUser user, StrategyModel request) { ValidateRequest(request); var strategy = MapRequest(request); strategy.UserId = user.Id; _dbContext.Strategies.Add(strategy); }
public WorkItem(string code) { _code = code; _source = new DataService(code); _target = new LogService(code); _method = StrategyFactory.Create("Inertance", _source); _source.Start(this.handler); }
/// <summary> /// 视频综合概览 /// </summary> private void AlarmTypeCountData() { DataTable table = new DataTable(); table.TableName = "视综_视频综合概览"; table.Columns.Add("Id", typeof(Int32)); table.Columns.Add("Face", typeof(Int32)); table.Columns.Add("Car", typeof(Int32)); table.Columns.Add("Strategy", typeof(Int32)); table.Columns.Add("Time", typeof(DateTime)); DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); //DateTime startTime = new DateTime(2019, 9, 25); //DateTime endTime = new DateTime(2019, 9, 26); DateTime startTime = DateTime.Now.AddDays(-1); DateTime endTime = DateTime.Now; TimeSpan toStart = startTime.Subtract(dtStart); TimeSpan toEnd = endTime.Subtract(dtStart); string time = "{\"startTime\":" + toStart.Ticks.ToString().Substring(0, toStart.Ticks.ToString().Length - 4) + ",\"endTime\":" + toEnd.Ticks.ToString().Substring(0, toEnd.Ticks.ToString().Length - 4) + "}\""; AlarmTypeCountModel alarmTypeCountModel = HttpHelper.HttpWangLiPost <AlarmTypeCountModel>("http://14.29.73.5/gateway/statistics_service/alarm/statistics/alarmTypeCount", LoginWangLi(), time); int face = 0; int car = 0; int strategy = 0; for (int i = 0; i < alarmTypeCountModel.data.Count; i++) { if (alarmTypeCountModel.data[i].name == "人脸告警") { face = alarmTypeCountModel.data[i].value; } else if (alarmTypeCountModel.data[i].name == "车辆告警") { car = alarmTypeCountModel.data[i].value; } } StrategyModel strategyModel = HttpHelper.HttpWangLiGet <StrategyModel>("http://14.29.73.5/gateway/logservice/nplog/logs/projects/logs/logstores/appLog/querySettingList?currentPage=1&pageSize=10&beginTime=" + toStart.Ticks.ToString().Substring(0, toStart.Ticks.ToString().Length - 4) + "&endTime=" + toEnd.Ticks.ToString().Substring(0, toEnd.Ticks.ToString().Length - 4) + "", LoginWangLi()); strategy = strategyModel.data.count; DataRow row = table.NewRow(); row["Id"] = 1; row["Face"] = face; row["Car"] = car; row["Strategy"] = strategy; row["Time"] = DateTime.Now; table.Rows.Add(row); DataHelper.SaveCsv(table); }
void init(string code, Painter painter, DateTime day) { _code = code; _painter = painter; _source = new DataService(_code); _target = new LogService(_code); _method = StrategyFactory.Create("Inertance", _source); _painter.Init(_source.GetPreClose(day), _source.GetRecentAvgVol(day)); }
public ConditionBuilder(StrategyModel model) { _model = model; _firstArgumentBuilder = new FormulaItemBuilder(model); _secondArgumentBuilder = new FormulaItemBuilder(model); _operationBuilder = new CompareOperationBuilder(); _builders = new BuilderSequence() .Add(_firstArgumentBuilder) .Add(_operationBuilder) .Add(_secondArgumentBuilder); }
public static Strategy ToEntity(this StrategyModel model) { Strategy entity = new Strategy(); entity.Name = model.Name; entity.OptimalTimeframe = model.OptimalPeriodCode; entity.NumberOfCandles = model.NumberOfCandles; entity.Id = model.Id; entity.IsEnabled = model.IsEnabled; return(entity); }
public static StrategyModel ToModel(this Strategy entity) { StrategyModel model = new StrategyModel(); model.Id = entity.Id; model.Name = entity.Name; model.OptimalPeriodCode = PeriodCode.Create(entity.OptimalTimeframe).Code; model.OptimalPeriodName = PeriodCode.Create(entity.OptimalTimeframe).Description; model.NumberOfCandles = entity.NumberOfCandles; model.IsEnabled = entity.IsEnabled; return(model); }
public void TestStreamValue() { var model = new StrategyModel(); var parser = new StopLimitParser(model); var order = parser.Parse("low"); Assert.IsNotNull(order); Assert.AreEqual(1, order.ValueStack.Count()); Assert.AreEqual(null, order.ValueStack.First().Value); Assert.AreEqual("low", order.ValueStack.First().Substream); Assert.AreEqual(FormulaItem.STREAM, order.ValueStack.First().ValueType); Assert.AreEqual("low", order.UserInput); }
/// <summary> /// 判断策略是否已经创建过 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool HasExistsStrategy(StrategyModel model) { string sql = @" select 1 from [Strategy] with(nolock) where Name=@Name"; IDbParameters dbParameters = DbHelper.CreateDbParameters(); dbParameters.AddWithValue("Name", model.Name); object i = DbHelper.ExecuteScalar(SuperMan_Read, sql, dbParameters); if (i != null) { return(int.Parse(i.ToString()) > 0); } return(false); }
public async Task <IActionResult> EditStrategy([FromBody] StrategyModel request) { try { var service = new StrategyService(_dbContext, _mapper); service.EditStrategy(request); await _dbContext.SaveChangesAsync(); return(Ok()); } catch (Exception e) { return(BadRequest(e.Message)); } }
/// <summary> /// 修改策略名称信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdateStrategyName(StrategyModel model) { string sql = " update [Strategy] set Name=@Name where id=@id"; IDbParameters dbParameters = DbHelper.CreateDbParameters(); dbParameters.AddWithValue("@id", model.Id); dbParameters.AddWithValue("@Name", model.Name); int i = DbHelper.ExecuteNonQuery(SuperMan_Write, sql, dbParameters); if (i > 0) { return(true); } return(false); }
public FormulaItemBuilder(StrategyModel model) { _parsers.Add(new DefaultStreamItemParser()); _parsers.Add(new NumberItemParser()); if (model.Parameters != null) { var parameters = model.Parameters; if (parameters.Count() > 0) { _parsers.Add(new ParameterItemParser(parameters)); } } this.model = model; }
public void ModelParser_BoolParmeterInCondition() { var model = new StrategyModel() { Sources = new System.Collections.Generic.List <Source>() { new Source() { Id = "stoch", Name = "STOCHASTIC", SourceType = Source.INDICATOR } }, Parameters = new System.Collections.Generic.List <StrategyParameter>() { new StrategyParameter() { Id = "allow_buy", ParameterType = StrategyParameter.BOOLEAN, DefaultValue = "true" } } }; var parser = new ConditionParser(model); var condition = parser.Parse("stoch.K > 30 and allow_buy"); Assert.IsNotNull(condition); Assert.AreEqual(Condition.AND, condition.ConditionType); Assert.AreEqual(2, condition.Conditions.Count); Assert.AreEqual(Condition.GT, condition.Conditions[0].ConditionType); Assert.AreEqual("stoch", condition.Conditions[0].Arg1.Value); Assert.AreEqual("K", condition.Conditions[0].Arg1.Substream); Assert.AreEqual(FormulaItem.STREAM, condition.Conditions[0].Arg1.ValueType); Assert.AreEqual(FormulaItem.VALUE, condition.Conditions[0].Arg2.ValueType); Assert.AreEqual("30.0", condition.Conditions[0].Arg2.Value); Assert.AreEqual(Condition.EQ, condition.Conditions[1].ConditionType); Assert.AreEqual("allow_buy", condition.Conditions[1].Arg1.Value); Assert.AreEqual(FormulaItem.PARAM, condition.Conditions[1].Arg1.ValueType); Assert.AreEqual(FormulaItem.VALUE, condition.Conditions[1].Arg2.ValueType); Assert.AreEqual("true", condition.Conditions[1].Arg2.Value); Assert.AreEqual("stoch.K > 30 and allow_buy", condition.UserInput); }
private void Sumbit_Click(object sender, System.Windows.RoutedEventArgs e) { BGroup group = (BGroup)GroupCombox.SelectedItem; IApi api = (IApi)LibCombox.SelectedItem; StrategyModel strategyModel = (StrategyModel)StrategyCombobox.SelectedItem; if (group == null || api == null || strategyModel == null) { return; } var active = ServerKeeper.Instance.DBLocalKeeper.DBObject <B_Active>().Add(new Active { Gid = group.Gid, Name = addVM.ActiveName, Describe = addVM.ActiveDescribe }); List <string> paramsFormat = new List <string>(); foreach (var item in addVM.Params) { if (item.Checked) { paramsFormat.Add(item.BParam.Pid); } } string @params = string.Empty; for (int pCount = 0; pCount < paramsFormat.Count; pCount++) { @params += paramsFormat[pCount]; if (pCount < paramsFormat.Count - 1) { @params += ","; } } ServerKeeper.Instance.DBLocalKeeper.DBObject <D_MsSQL>().Add(new MsSQL { Aid = active.Aid, ApiId = api.Apiid, Paramskey = @params, Strategy = strategyModel.Name, Sql = addVM.Sql }); }
public void TestStreamValueMinusValuePips() { var model = new StrategyModel(); var parser = new StopLimitParser(model); var order = parser.Parse("low - 5"); Assert.IsNotNull(order); Assert.AreEqual(3, order.ValueStack.Count()); Assert.AreEqual(null, order.ValueStack[0].Value); Assert.AreEqual("low", order.ValueStack[0].Substream); Assert.AreEqual(FormulaItem.STREAM, order.ValueStack[0].ValueType); Assert.AreEqual("-", order.ValueStack[1].Value); Assert.AreEqual(FormulaItem.OPERAND, order.ValueStack[1].ValueType); Assert.AreEqual("5.0", order.ValueStack[2].Value); Assert.AreEqual(FormulaItem.VALUE, order.ValueStack[2].ValueType); Assert.AreEqual("low - 5", order.UserInput); }
public void ModelParser_AndCondition() { var model = new StrategyModel() { Sources = new System.Collections.Generic.List <Source>() { new Source() { Id = "stoch", Name = "STOCHASTIC", SourceType = Source.INDICATOR }, new Source() { Id = "rsi", Name = "RSI", SourceType = Source.INDICATOR } } }; var parser = new ConditionParser(model); var condition = parser.Parse("stoch.K == 30 and rsi != 20"); Assert.IsNotNull(condition); Assert.AreEqual(Condition.AND, condition.ConditionType); Assert.AreEqual(2, condition.Conditions.Count); Assert.AreEqual(Condition.EQ, condition.Conditions[0].ConditionType); Assert.AreEqual("stoch", condition.Conditions[0].Arg1.Value); Assert.AreEqual("K", condition.Conditions[0].Arg1.Substream); Assert.AreEqual(FormulaItem.STREAM, condition.Conditions[0].Arg1.ValueType); Assert.AreEqual(FormulaItem.VALUE, condition.Conditions[0].Arg2.ValueType); Assert.AreEqual("30.0", condition.Conditions[0].Arg2.Value); Assert.AreEqual(Condition.NEQ, condition.Conditions[1].ConditionType); Assert.AreEqual("rsi", condition.Conditions[1].Arg1.Value); Assert.AreEqual(FormulaItem.STREAM, condition.Conditions[1].Arg1.ValueType); Assert.AreEqual(FormulaItem.VALUE, condition.Conditions[1].Arg2.ValueType); Assert.AreEqual("20.0", condition.Conditions[1].Arg2.Value); Assert.AreEqual("stoch.K == 30 and rsi != 20", condition.UserInput); }