private void BuildRules() { log("Building rules..."); log("Creating RuleCondition condRouteFillOccurred"); RuleCondition condRouteFillOccurred = new RuleCondition("RouteFillOccurred", new RouteFillOccurred(this)); log("RuleCondition condRouteFillOccurred created."); log("Creating Action actShowRouteFill"); Action actShowRouteFill = this.rmsx.CreateAction("ShowRouteFill", new ShowRouteFill(this)); log("Action actShowRouteFill created"); log("Creating RuleSet demoRouteRuleSet"); RuleSet demoRouteRuleSet = this.rmsx.CreateRuleSet("DemoRouteRuleSet"); log("RuleSet demoRouteRuleSet created"); log("Creating Rule ruleRouteFilled"); Rule ruleRouteFilled = demoRouteRuleSet.AddRule("RouteFilled"); log("Rule ruleRouteFilled created"); log("Assign RuleCondition condRouteFillOccurred to Rule ruleRouteFilled"); ruleRouteFilled.AddRuleCondition(condRouteFillOccurred); log("Assign Action actShowRouteFill to Rule ruleRouteFilled"); ruleRouteFilled.AddAction(actShowRouteFill); log("Rules built."); }
private void BuildRules() { log("Building rules..."); log("Creating RuleSet rsAutoRouteFromIOI"); RuleSet rsAutoRouteFromIOI = this.rmsx.CreateRuleSet("AutoRouteFromIOI"); log("Creating rule for ValidIOI"); Rule ruleValidIOI = rsAutoRouteFromIOI.AddRule("ValidIOI"); /* ioi must be instrument type 'stock' * ioi must not be expired */ ruleValidIOI.AddRuleCondition(new RuleCondition("IsStockInstrumentType", new GenericStringMatch("ioitype", "stock"))); ruleValidIOI.AddRuleCondition(new RuleCondition("IsNotExpired", new IsIOINotExpired())); ruleValidIOI.AddAction(this.rmsx.CreateAction("MarkIOIValid", ActionType.ON_TRUE, new MarkIOIValid())); Action purgeDataSet = this.rmsx.CreateAction("PurgeDataSet", ActionType.ON_FALSE, new PurgeDataSet(rsAutoRouteFromIOI)); ruleValidIOI.AddAction(purgeDataSet); log("Creating rule for ValidOrder"); Rule ruleValidOrder = rsAutoRouteFromIOI.AddRule("ValidOrder"); /* Order must be for Equity */ ruleValidOrder.AddRuleCondition(new RuleCondition("IsEquity", new GenericStringMatch("orderAssetClass", "Equity"))); ruleValidOrder.AddAction(this.rmsx.CreateAction("MarkOrderValid", ActionType.ON_TRUE, new MarkOrderValid())); ruleValidOrder.AddAction(purgeDataSet); log("Creating rule for ValidPair"); Rule ruleValidPair = rsAutoRouteFromIOI.AddRule("ValidPair"); /* both order and ioi must be valid * matching side */ ruleValidPair.AddRuleCondition(new RuleCondition("IOIAndOrderReady", new IOIAndOrderReady())); ruleValidPair.AddRuleCondition(new RuleCondition("MatchingTicker", new MatchingTicker())); ruleValidPair.AddRuleCondition(new RuleCondition("MatchingSide", new MatchingSideAndAmount())); /* Create new route */ ruleValidPair.AddAction(this.rmsx.CreateAction("CreateRoute", ActionType.ON_TRUE, new CreateRoute(this))); ruleValidOrder.AddAction(purgeDataSet); }