Ejemplo n.º 1
0
        public void ShowRangeBarInForm()
        {
            var rangeBar = new RangeBar();

            lb = new ListBox();
            var form = new Form();

            lb.Location = new Point(40, 40);
            form.Controls.Add(rangeBar);
            form.Controls.Add(lb);
            var histogram    = new[] { 11, 21, 31, 35 };
            var handleValues = new double[] { 10, 20, 30, 40, 50 };

            doubleValues = new BindingList <double>();
            foreach (double d in handleValues)
            {
                doubleValues.Add(d);
            }
            doubleValues.AllowEdit = true;
            lb.DataSource          = doubleValues;
            var colors = new[] { Color.Red, Color.Green, Color.Yellow, Color.Blue };

            rangeBar.SetHandles(handleValues, colors);
            rangeBar.Histogram           = histogram;
            rangeBar.UserDraggingHandle += rangeBar_UserDraggingHandle;

            WindowsFormsTestHelper.ShowModal(form);
        }
Ejemplo n.º 2
0
        public void HistogramMaxPerBinTest()
        {
            RangeBar target = new RangeBar(); // TODO: Initialize to an appropriate value
            int      actual;

            actual = target.HistogramMaxPerBin;
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Ejemplo n.º 3
0
        public void HandleValueTest()
        {
            RangeBar target = new RangeBar(); // TODO: Initialize to an appropriate value
            int      aIndex = 0;              // TODO: Initialize to an appropriate value
            double   actual;

            actual = target.get_HandleValue(aIndex);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Ejemplo n.º 4
0
        public void SetHandlesTest()
        {
            RangeBar target = new RangeBar(); // TODO: Initialize to an appropriate value

            double[] aValues = null;          // TODO: Initialize to an appropriate value
            Color[]  aColors = null;          // TODO: Initialize to an appropriate value
            target.SetHandles(aValues, aColors);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
Ejemplo n.º 5
0
        public void HistogramTest()
        {
            RangeBar target = new RangeBar(); // TODO: Initialize to an appropriate value

            int[] expected = null;            // TODO: Initialize to an appropriate value
            int[] actual;
            target.Histogram = expected;
            actual           = target.Histogram;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Ejemplo n.º 6
0
        public void HistogramFromValuesTest()
        {
            RangeBar target = new RangeBar(); // TODO: Initialize to an appropriate value

            double[] aValues   = null;        // TODO: Initialize to an appropriate value
            double   aMinValue = 0F;          // TODO: Initialize to an appropriate value
            double   aMaxValue = 0F;          // TODO: Initialize to an appropriate value

            target.HistogramFromValues(aValues, aMinValue, aMaxValue);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
Ejemplo n.º 7
0
        private int getRemoved(RangeBar bar, int current, bool isMin)
        {
            if (bar.Value < bar.RangeMinimum || bar.Value > bar.RangeMaximum)
            {
                return(current);
            }

            if (bar.RangeMaximum - bar.Value > bar.Value - bar.RangeMinimum)
            {
                return((int)(isMin ? bar.Value : bar.RangeMaximum));
            }
            else
            {
                return((int)(isMin ? bar.RangeMinimum : bar.Value));
            }
        }
Ejemplo n.º 8
0
        public Action Decide(RangeBarModel bar, double inventoryAbsolute)
        {
            if (bar.TimestampDiffMs < (1000 * 60 * 1))
            {
                // to fast bar, not executable
                return(Action.Nothing);
            }

            var convertedBar = new RangeBar();

            convertedBar.VolumeRate   = ComputeRate(bar.BuyVolume, bar.SellVolume);
            convertedBar.CountRate    = ComputeRate(bar.BuyCount, bar.SellCount);
            convertedBar.ChangeRate   = ComputeRate(bar.PriceChangedUpCount, bar.PriceChangedDownCount);
            convertedBar.InsertedRate = ComputeRate(bar.ObInsertedCountBid, bar.ObInsertedCountAsk);
            convertedBar.UpdatedRate  = ComputeRate(bar.ObUpdatedCountBid, bar.ObUpdatedCountAsk);
            convertedBar.DeletedRate  = ComputeRate(bar.ObDeletedCountBid, bar.ObDeletedCountAsk);

            if (_prevBar != null)
            {
                convertedBar.MidPrev       = (float)_prevBar.CurrentPrice;
                convertedBar.MidChangePrev = (float)(bar.CurrentPrice - _prevBar.CurrentPrice);
            }

            var prediction = _predictionEngine.Predict(convertedBar);

            //if (Math.Abs(prediction.Score) < 0.5)
            //    return Action.Nothing;

            _prevBar = bar;

            if (!string.IsNullOrWhiteSpace(prediction.Prediction))
            {
                if (prediction.Prediction == "1")
                {
                    return(Action.Sell);
                }
                return(Action.Buy);
            }

            if (prediction.Direction)
            {
                return(Action.Buy);
            }
            return(Action.Sell);
        }
Ejemplo n.º 9
0
 public void ShowRangeBarInForm()
 {
     var rangeBar = new RangeBar();
     lb = new ListBox();
     var form = new Form();
     lb.Location = new Point(40, 40);
     form.Controls.Add(rangeBar);
     form.Controls.Add(lb);
     var histogram = new[] {11, 21, 31, 35};
     var handleValues = new double[] {10, 20, 30, 40, 50};
     doubleValues = new BindingList<double>();
     foreach (double d in handleValues)
     {
         doubleValues.Add(d);
     }
     doubleValues.AllowEdit = true;
     lb.DataSource = doubleValues;
     var colors = new[] {Color.Red, Color.Green, Color.Yellow, Color.Blue};
     rangeBar.SetHandles(handleValues, colors);
     rangeBar.Histogram = histogram;
     rangeBar.UserDraggingHandle += rangeBar_UserDraggingHandle;
     
     WindowsFormsTestHelper.ShowModal(form);
 }
Ejemplo n.º 10
0
 public void OnThumbMovingStop(RangeBar rangeBar, bool isLeftThumb, string pinValue)
 {
     Toast.MakeText(this, (isLeftThumb ? "Left" : "Right") + $" stopped moving: {pinValue}", ToastLength.Short).Show();
 }
Ejemplo n.º 11
0
 public void OnRangeChangeListener(RangeBar rangeBar, int leftPinIndex, int rightPinIndex, string leftPinValue,
                                   string rightPinValue)
 {
 }
Ejemplo n.º 12
0
        public void RangeBarConstructorTest()
        {
            RangeBar target = new RangeBar();

            Assert.Inconclusive("TODO: Implement code to verify target");
        }