private void Run() { log("IOIEMSXRMSXDemo - Auto-routing IOI orders"); log("Initializing RuleMSX..."); this.rmsx = new RuleMSX(); LogRmsx.logLevel = LogRmsx.LogLevels.DETAILED; LogRmsx.logPrefix = "(RuleMSX...)"; log("RuleMSX initialized."); log("Initializing EasyIOI..."); this.eioi = new EasyIOI(); log("EasyIOI initialized."); LogIOI.logPrefix = "(EasyIOI...)"; LogIOI.logLevel = com.bloomberg.ioiapi.samples.Log.LogLevels.DETAILED; log("Initializing EasyMSX..."); this.emsx = new EasyMSX(); log("EasyMSX initialized."); LogEMSX.logPrefix = "(EasyMSX...)"; LogEMSX.logLevel = com.bloomberg.emsx.samples.Log.LogLevels.NONE; log("Create ruleset..."); BuildRules(); log("Ruleset ready."); this.emsx.orders.addNotificationHandler(this); this.emsx.routes.addNotificationHandler(this); log("Starting EasyMSX"); this.emsx.start(); log("EasyMSX started"); this.eioi.iois.addNotificationHandler(this); log("Starting EasyIOI"); this.eioi.start(); log("EasyIOI started"); }
private void Run() { log("Initializing RuleMSX..."); this.rmsx = new RuleMSX(); LogRmsx.logLevel = LogRmsx.LogLevels.DETAILED; LogRmsx.logPrefix = "(RuleMSX..........)"; log("RuleMSX initialized."); log("Initializing EasyMSX..."); this.emsx = new EasyMSX(); log("EasyMSX initialized."); log("Create ruleset..."); BuildRules(); log("Ruleset ready."); this.emsx.routes.addNotificationHandler(this); log("Starting EasyMSX"); this.emsx.start(); log("EasyMSX started"); }
public RuleMSXTest() { System.Console.WriteLine("RuleMSXTest starting..."); System.Console.WriteLine("Instantiating RuleMSX..."); LogRmsx.logLevel = LogRmsx.LogLevels.NONE; this.rmsx = new RuleMSX(); // Create new RuleSet this.ruleSet = rmsx.createRuleSet("TestRules"); Rule ruleIsNotExpired = new Rule("IsNotExpired", new StringInequalityRule("OrderStatus", "EXPIRED")); Rule ruleIsExpired = new Rule("IsExpired", new StringEqualityRule("OrderStatus", "EXPIRED"), rmsx.createAction("SendIgnoringSignal", new SendAdditionalSignal("Ignoring Order - EXPIRED"))); Rule ruleNeedsRouting = new Rule("NeedsRouting", new NeedsRoutingRule()); Rule ruleIsLNExchange = new Rule("IsLNExchange", new StringEqualityRule("Exchange", "LN"), rmsx.createAction("RouteToBrokerBB", new RouteToBroker(this, "BB"))); Rule ruleIsUSExchange = new Rule("IsUSExchange", new StringEqualityRule("Exchange", "US")); Rule ruleIsIBM = new Rule("IsIBM", new StringEqualityRule("Ticker", "IBM US Equity"), rmsx.createAction("RouteToBrokerEFIX", new RouteToBroker(this, "EFIX"))); ruleIsIBM.AddAction(rmsx.createAction("SendIBMSignal", new SendAdditionalSignal("This is IBM!!"))); Rule ruleIsMSFT = new Rule("IsMSFT", new StringEqualityRule("Ticker", "MSFT US Equity"), rmsx.createAction("RejectedSignal", new SendAdditionalSignal("Not Routing as would be rejected"))); Rule ruleIsFilled500 = new Rule("IsFilled500", new IsFilled500Rule(), rmsx.createAction("Signal500filled", new SendAdditionalSignal("Order is filled to 500 or more."))); // Maybe add code so that rather than RouteToBroker("BB") we create a new datapoint "TargetBroker", set it's value to BB. // Then add a new rule that checks if there are available shares. if true, then action is route to targetbroker which depends on target broker //Add new rules for working/filled amount checks this.ruleSet.AddRule(ruleIsNotExpired); this.ruleSet.AddRule(ruleIsExpired); //this.ruleSet.AddRule(ruleIsFilled500); ruleIsNotExpired.AddRule(ruleNeedsRouting); ruleNeedsRouting.AddRule(ruleIsLNExchange); ruleNeedsRouting.AddRule(ruleIsUSExchange); ruleIsUSExchange.AddRule(ruleIsIBM); ruleIsUSExchange.AddRule(ruleIsMSFT); System.Console.WriteLine("...done."); System.Console.WriteLine(ruleSet.report()); System.Console.WriteLine("Instantiating EasyMKT..."); this.emkt = new EasyMKT(); System.Console.WriteLine("...done."); // Adding subscription fields to EasyMKT emkt.AddField("BID"); emkt.AddField("ASK"); emkt.AddField("MID"); emkt.AddField("LAST_PRICE"); System.Console.WriteLine("Starting EasyMKT..."); emkt.start(); System.Console.WriteLine("EasyMKT started."); System.Console.WriteLine("Instantiating EasyMSX..."); LogEmsx.logLevel = LogEmsx.LogLevels.NONE; try { this.emsx = new EasyMSX(EasyMSX.Environment.BETA); System.Console.WriteLine("EasyMSX instantiated. Adding notification handler."); this.emsx.orders.addNotificationHandler(this); System.Console.WriteLine("Starting EasyMSX"); this.emsx.start(); } catch (Exception ex) { System.Console.WriteLine(ex); } System.Console.WriteLine("EasyMSX started."); System.Console.WriteLine("RuleMSXTest running..."); }