Example #1
0
        private void clickEnter(object sender, EventArgs e)
        {
            Riders.AtID(ID).hasAutoOrder = true;
            Riders.AtID(ID).maxPrice     = Utils.String2Double(MaxPriceBox.Text);
            Riders.AtID(ID).minPrice     = Utils.String2Double(MinpriceBox.Text);

            string price = StartpriceBox.Text;
            string size  = SizeBox.Text;

            PlaceInstruction instruction = new PlaceInstruction();

            instruction.OrderType = OrderType.LIMIT;

            LimitOrder order = new LimitOrder();

            instruction.Side        = Side.LAY;
            instruction.SelectionId = ID;

            order.PersistenceType = PersistenceType.PERSIST;

            order.Price = Utils.String2Double(price);
            order.Size  = Convert.ToDouble(size);

            instruction.LimitOrder = order;

            ApiSet.PlaceOrder(instruction);

            BackEnd.clock.Start();
            this.Dispose();
        }
Example #2
0
        private void clickStatusButton(object sender, EventArgs e)
        {
            BackEnd.clock.Stop();
            if (Riders.AtID(selectionID).layorders == null)
            {
                return;
            }

            List <CancelInstruction> cancelInstructions = new List <CancelInstruction>();
            CancelInstruction        cancelInstruction;

            for (int i = 0; i < Riders.AtID(selectionID).layorders.Count; i++)
            {
                cancelInstruction       = new CancelInstruction();
                cancelInstruction.BetId = Riders.AtID(selectionID).layorders[i].BetId;
                cancelInstructions.Add(cancelInstruction);
            }

            for (int i = 0; i < Riders.AtID(selectionID).backorders.Count; i++)
            {
                cancelInstruction       = new CancelInstruction();
                cancelInstruction.BetId = Riders.AtID(selectionID).backorders[i].BetId;
                cancelInstructions.Add(cancelInstruction);
            }

            ApiSet.CancelOrders(cancelInstructions);
            BackEnd.clock.Start();
        }
Example #3
0
 /// <summary>
 /// Updates the app every n seconds that the clock event is raised.
 /// </summary>
 private static void Update()
 {
     frontEnd.Update();
     Riders.get();
     RiderPanels.Update();
     Metrics.Update();
     AutoPrice.Update();
 }
Example #4
0
 private void doubleclickDiscard(object sender, EventArgs e)
 {
     BackEnd.clock.Stop();
     for (int i = controlRank; i < Riders.Count(); i++)
     {
         Riders.discard(Riders.At(i).selectionID);
     }
     BackEnd.clock.Start();
 }
Example #5
0
        static private void updateExpectedProfit()
        {
            double expectedProfit = 0;

            for (int i = 0; i < Riders.Count(); i++)
            {
                expectedProfit += Riders.At(i).pnl / Riders.At(i).latestMarketprice;
            }

            expectedProfit_ = expectedProfit;
        }
Example #6
0
 private void addRiderlabels()
 {
     addRiderlabel("cumulative", Riders.AtID(ID).overround.ToString(), 0);
     addRiderlabel("has_autoorder", Riders.AtID(ID).hasAutoOrder.ToString(), 15);
     addRiderlabel("isinthemoney", Riders.AtID(ID).isInthemoney.ToString(), 30);
     addRiderlabel("isOpen", Riders.AtID(ID).isOpen.ToString(), 45);
     addRiderlabel("latestMarketPrice", Riders.AtID(ID).latestMarketprice.ToString(), 60);
     addRiderlabel("marketAsk", Riders.AtID(ID).marketAsk.ToString(), 90);
     addRiderlabel("marketBid", Riders.AtID(ID).marketBid.ToString(), 105);
     addRiderlabel("maxPrice", Riders.AtID(ID).maxPrice.ToString(), 120);
     addRiderlabel("minPrice", Riders.AtID(ID).minPrice.ToString(), 135);
     addRiderlabel("myAsk", Riders.AtID(ID).myAsk.ToString(), 150);
     addRiderlabel("myBid", Riders.AtID(ID).myBid.ToString(), 165);
     addRiderlabel("name", Riders.AtID(ID).name.ToString(), 180);
     addRiderlabel("pnl", Riders.AtID(ID).pnl.ToString(), 195);
     addRiderlabel("totalMarketAmount", Riders.AtID(ID).totalmarketamount.ToString(), 240);
     addRiderlabel("turnover", Riders.AtID(ID).turnover.ToString(), 270);
 }
Example #7
0
        static public void Update()
        {
            pdf = new Dictionary <double, double>();

            for (int i = 0; i < Riders.Count(); i++)
            {
                if (!pdf.ContainsKey(Riders.At(i).pnl))
                {
                    pdf.Add(Riders.At(i).pnl, 0);
                }
            }

            for (int i = 0; i < Riders.Count(); i++)
            {
                pdf[Riders.At(i).pnl] += 1 / Riders.At(i).latestMarketprice;
            }

            updateExpectedProfit();
            updateStandardDeviation();
            updateKurtosis();
        }
Example #8
0
        public static void Update()
        {
            headerPanel.update();

            for (int i = 0; i < Math.Min(riderPanels.Count, Riders.Count()); i++)
            {
                riderPanels[i].selectionID = Riders.At(i).selectionID;
                riderPanels[i].rider.Text  = Riders.At(i).name.Split(' ')[Riders.At(i).name.Split(' ').Count() - 1];
                riderPanels[i].price.Text  = Riders.At(i).latestMarketprice.ToString();
                riderPanels[i].PNL.Text    = Math.Round(Riders.At(i).pnl).ToString();

                if (Riders.At(i).isOpen)
                {
                    riderPanels[i].StatusButton.BackColor = Color.Green;

                    if (Riders.At(i).isInthemoney)
                    {
                        riderPanels[i].StatusButton.BackColor = Color.Purple;
                    }
                }
                else
                {
                    riderPanels[i].StatusButton.BackColor = Color.Red;
                }

                riderPanels[i].overround.Text = Math.Round(Riders.At(i).overround, 2).ToString();
                riderPanels[i].turnover.Text  = Math.Round(Riders.At(i).Turnover(), 0).ToString();
                riderPanels[i].lay.Text       = Riders.At(i).marketBid.ToString();
                riderPanels[i].back.Text      = Riders.At(i).marketAsk.ToString();
                riderPanels[i].melay.Text     = Riders.At(i).myBid.ToString();
                riderPanels[i].meback.Text    = Riders.At(i).myAsk.ToString();
            }

            for (int i = Riders.Count(); i < riderPanels.Count; i++)
            {
                riderPanels[i].Dispose();
            }
        }
Example #9
0
        /// <summary>
        /// Automatically overbids competitor prices according to manual set price maxima.
        /// </summary>
        public static void Update()
        {
            List <ReplaceInstruction> replaceInstructions = new List <ReplaceInstruction>();

            for (int i = 0; i < Riders.Count(); i++)
            {
                if (Riders.At(i).hasAutoOrder&& Riders.At(i).layorders != null)
                {
                    for (int j = 0; j < Riders.At(i).layorders.Count; j++)
                    {
                        if (Riders.At(i).layorders[j].SizeRemaining >= 2 && Riders.At(i).layorders[j].PriceSize.Price < Riders.At(i).marketBid)
                        {
                            LimitOrder Order = new LimitOrder();
                            Order.Price = Utils.RoundPrice(Riders.At(i).marketBid + Utils.Increment(Riders.At(i).marketBid));
                            Order.Size  = Convert.ToDouble(Riders.At(i).layorders[j].SizeRemaining);
                            ReplaceInstruction replaceInstruction = new ReplaceInstruction();
                            replaceInstruction.BetId    = Riders.At(i).layorders[j].BetId;
                            replaceInstruction.NewPrice = Utils.RoundPrice(Riders.At(i).marketBid + Utils.Increment(Riders.At(i).marketBid));
                            replaceInstructions.Add(replaceInstruction);
                        }

                        if (Riders.At(i).layorders[j].SizeRemaining >= 2 && Riders.At(i).layorders[j].PriceSize.Price > Riders.At(i).marketBid)
                        {
                            LimitOrder Order = new LimitOrder();
                            Order.Price = Utils.RoundPrice(Riders.At(i).marketBid);
                            Order.Size  = Convert.ToDouble(Riders.At(i).layorders[j].SizeRemaining);
                            ReplaceInstruction replaceInstruction = new ReplaceInstruction();
                            replaceInstruction.BetId    = Riders.At(i).layorders[j].BetId;
                            replaceInstruction.NewPrice = Utils.RoundPrice(Riders.At(i).marketBid + Utils.Increment(Riders.At(i).marketBid));
                            replaceInstructions.Add(replaceInstruction);
                        }
                    }
                }
            }

            ApiSet.ReplaceOrder(replaceInstructions);
        }
Example #10
0
 private void clickDiscard(object sender, EventArgs e)
 {
     BackEnd.clock.Stop();
     Riders.discard(selectionID);
     BackEnd.clock.Start();
 }