Beispiel #1
0
            public void Execute(DataSet dataSet)
            {
                // create route instruction for the order based only on data from the dataset
                System.Console.WriteLine("Created route to broker '" + this.brokerCode + "' for DataSet: " + dataSet.getName());

                // Get the order
                Orders          os    = this.ruleMSXTest.emsx.orders;
                DataPoint       dp    = dataSet.getDataPoint("OrderNo");
                DataPointSource dps   = dp.GetSource();
                string          ordno = dps.GetValue().ToString();
                Order           o     = os.getBySequenceNo(Convert.ToInt32(ordno));

                if (o != null)
                {
                    Request req = this.ruleMSXTest.emsx.createRequest("RouteEx");
                    req.Set("EMSX_SEQUENCE", o.field("EMSX_SEQUENCE").value());
                    req.Set("EMSX_AMOUNT", o.field("EMSX_AMOUNT").value());
                    req.Set("EMSX_BROKER", brokerCode);
                    req.Set("EMSX_HAND_INSTRUCTION", "ANY");
                    req.Set("EMSX_ORDER_TYPE", o.field("EMSX_ORDER_TYPE").value());
                    req.Set("EMSX_TICKER", o.field("EMSX_TICKER").value());
                    req.Set("EMSX_TIF", o.field("EMSX_TIF").value());
                    System.Console.WriteLine("Sending request: " + req.ToString());

                    this.ruleMSXTest.emsx.sendRequest(req, this);
                }
            }
Beispiel #2
0
            public override bool Evaluate(DataSet dataSet)
            {
                DataPoint       dp  = dataSet.getDataPoint(this.dataPointName);
                DataPointSource dps = dp.GetSource();
                string          val = dps.GetValue().ToString();

                return(val.Equals(this.match));
            }
Beispiel #3
0
            public override bool Evaluate(DataSet dataSet)
            {
                DataPointSource source = dataSet.GetDataPoint(this.sourceName).GetSource();

                String currentValue = Convert.ToString(source.GetValue());

                bool res = (currentValue == this.targetValue);

                log("Evaluating GenericStringMatch for " + sourceName + " - target value=" + this.targetValue + " : actual value=" + currentValue + " : result=" + res.ToString());

                return(res);
            }
        public void SetDataPointSourceAtDataPointCreateCheckSource()
        {
            RuleMSX         rmsx               = new RuleMSX();
            string          newDataSetName     = "NewDataSet";
            string          newDataPointName   = "NewDataPointName";
            string          testDataPointValue = "TestDataPointValue";
            DataSet         ds   = rmsx.createDataSet(newDataSetName);
            DataPointSource srci = new TestDataPointSource(testDataPointValue);
            DataPoint       dpo  = ds.addDataPoint(newDataPointName, srci);
            DataPointSource srco = dpo.GetSource();

            Assert.That(srco.GetValue().ToString(), Is.EqualTo(testDataPointValue));
        }
Beispiel #5
0
            public override bool Evaluate(DataSet dataSet)
            {
                DataPointSource source = dataSet.GetDataPoint("ioigooduntil").GetSource();

                DateTime currentValue = Convert.ToDateTime(source.GetValue());

                DateTime now = DateTime.Now;

                bool res = (currentValue > now);

                log("Evaluating IsIOINotExpired for DataSet: " + dataSet.GetName() + " - values: current=" + currentValue + " / now=" + now + "  - result=" + res.ToString());

                return(res);
            }
Beispiel #6
0
        public void SetDataPointSourceGetSourceReturnCorrect()
        {
            RuleMSX         rmsx               = new RuleMSX();
            string          newDataSetName     = "NewDataSet";
            string          newDataPointName   = "NewDataPointName";
            string          testDataPointValue = "TestDataPointValue";
            DataSet         ds   = rmsx.CreateDataSet(newDataSetName);
            DataPoint       dpo  = ds.AddDataPoint(newDataPointName);
            DataPointSource srci = new TestDataPointSource(testDataPointValue);

            dpo.SetDataPointSource(srci);
            DataPointSource srco = dpo.GetSource();

            Assert.That(srco.GetValue().ToString(), Is.EqualTo(testDataPointValue));
        }
Beispiel #7
0
            public override bool Evaluate(DataSet dataSet)
            {
                int filledAmount = Convert.ToInt32(dataSet.getDataPoint("Filled").GetSource().GetValue().ToString());

                if (filledAmount >= 500)
                {
                    DataPointSource dps = dataSet.getDataPoint("Notified").GetSource();
                    lock (dps)
                    {
                        bool v = Convert.ToBoolean(dps.GetValue());
                        System.Console.WriteLine("Testing DataSet: " + dataSet.getName() + ":Notified current value (bool): " + dps.GetValue().ToString() + "(" + v.ToString() + ")");
                        if (!v)
                        {
                            DynamicBoolDataPoint p = (DynamicBoolDataPoint)dps;
                            p.setValue(true);
                            return(true);
                        }
                    }
                }
                return(false);
            }