コード例 #1
0
        internal void InitializeGrids()
        {
            double LastUpperEstimatedPricing = 0;
            double LastUnderEstimatedPricing = 0;

            if (c == null)
            {
                return;
            }
            double lotSize = (double)c.GridParameters.LotSize;

            OriginalAsk = robot.Symbol.Ask;
            OriginalBid = robot.Symbol.Bid;

            Grids.Clear();
            ActiveSince = robot.Time;

            UpperGroundStartingPoint = robot.ShiftPrice(OriginalAsk, (int)c.GridParameters.Intervals.Starting);
            UnderGroundStartingPoint = robot.ShiftPrice(OriginalBid, -Math.Abs((int)c.GridParameters.Intervals.Starting));

            GridSize = Math.Abs((int)c.GridParameters.Size);

            for (int i = 0; i < GridSize; i++)
            {
                LastUpperEstimatedPricing = i == 0 ? UpperGroundStartingPoint : robot.ShiftPrice(LastUpperEstimatedPricing, Math.Abs((int)c.GridParameters.Intervals.Grid));
                //robot.Print("EstimatedPricing-Upper: {0} at {1}", LastUpperEstimatedPricing.ToString(), i.ToString());
                var UpperGrid = new Grid()
                {
                    Side             = GridSide.UpperGround,
                    OrderType        = c.GridParameters.OrderType,
                    LotSize          = lotSize,
                    EstimatedPricing = LastUpperEstimatedPricing,
                    SideIndex        = i
                };
                Grids.Add(UpperGrid);

                LastUnderEstimatedPricing = i == 0 ? UnderGroundStartingPoint : robot.ShiftPrice(LastUnderEstimatedPricing, -Math.Abs((int)c.GridParameters.Intervals.Grid));
                //robot.Print("EstimatedPricing-Under: {0} at {1}", LastUnderEstimatedPricing.ToString(), i.ToString());
                var UnderGrid = new Grid()
                {
                    Side             = GridSide.UnderGround,
                    OrderType        = c.GridParameters.OrderType,
                    LotSize          = lotSize,
                    EstimatedPricing = LastUnderEstimatedPricing,
                    SideIndex        = i
                };
                Grids.Add(UnderGrid);
            }
        }
コード例 #2
0
ファイル: LayoutObject.cs プロジェクト: NerdDev/Hackmobile
 public override void Clear()
 {
     Grids.Clear();
 }
コード例 #3
0
 public void Reset()
 {
     Grids.Clear();
     OriginalAsk = OriginalBid = UpperGroundStartingPoint = UnderGroundStartingPoint = TotalNetProfit = GridSize = RunningCycle = 0;
     Active      = false;
 }