Ejemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (comboBox3.SelectedIndex < 0)
            {
                MessageBox.Show("You have to select pool for this order!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                comboBox3.Focus();
                return;
            }

            double Limit       = decimal.ToDouble(numericUpDown1.Value);
            double MaxPrice    = decimal.ToDouble(numericUpDown2.Value);
            int    OrderID     = decimal.ToInt32(numericUpDown3.Value);
            double StartPrice  = decimal.ToDouble(numericUpDown4.Value);
            double StartAmount = decimal.ToDouble(numericUpDown5.Value);

            if (AdvancedOptionsShown)
            {
                if (!OrderContainer.Add(comboBox1.SelectedIndex, comboBox2.SelectedIndex, MaxPrice, Limit, Pools[comboBox3.SelectedIndex], OrderID, StartPrice, StartAmount, textBox1.Text))
                {
                    MessageBox.Show("Order already in list!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    numericUpDown3.Focus();
                    return;
                }
            }
            else
            {
                OrderContainer.Add(comboBox1.SelectedIndex, comboBox2.SelectedIndex, MaxPrice, Limit, Pools[comboBox3.SelectedIndex]);
            }

            Close();
        }
Ejemplo n.º 2
0
        private void EUConfirmButton_Click(object sender, EventArgs e)
        {
            if (PoolComboBox.SelectedIndex < 0)
            {
                MessageBox.Show("You have to select pool for this order!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                PoolComboBox.Focus();
                return;
            }

            LimitBuffer    = decimal.ToDouble(Convert.ToDecimal(EUSpeedTextBox.Text));
            MaxPriceBuffer = decimal.ToDouble(Convert.ToDecimal(EUPriceTextBox.Text));

            if (OrderContainer.Add(0, AlgorithmComboBox.SelectedIndex, MaxPriceBuffer, LimitBuffer, Pools[PoolComboBox.SelectedIndex], OrderID, StartPrice, StartAmount, ""))
            {
                OrderID++;
            }
            else
            {
                MessageBox.Show("Error creating order", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            if (linked)
            {
                if (OrderContainer.Add(1, AlgorithmComboBox.SelectedIndex, MaxPriceBuffer, LimitBuffer, Pools[PoolComboBox.SelectedIndex], OrderID, StartPrice, StartAmount, ""))
                {
                    OrderID++;
                }
                else
                {
                    MessageBox.Show("Error creating order", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            Refresh();
        }
Ejemplo n.º 3
0
        private void FindOrdersButton_Click(object sender, EventArgs e)
        {
            DesyncController.Delete();

            List <Order> orders = new List <Order>();

            foreach (Order order in APIWrapper.GetMyOrders(0, AlgorithmComboBox.SelectedIndex))
            {
                orders.Add(order);
            }
            foreach (Order order in APIWrapper.GetMyOrders(1, AlgorithmComboBox.SelectedIndex))
            {
                orders.Add(order);
            }

            OrderContainer[] localOrders = OrderContainer.GetAll();
            foreach (Order order in orders)
            {
                bool exists = false;
                foreach (OrderContainer orderContainer in localOrders)
                {
                    if (orderContainer.ID == order.ID)
                    {
                        exists = true;
                    }
                }
                if (!exists)
                {
                    OrderContainer.Add(order.ServiceLocation, order.Algorithm, order.Price, order.SpeedLimit, new Pool(), order.ID, 0.001, 0.005, "");
                }
            }

            Refresh();
        }
Ejemplo n.º 4
0
        private void TimerRefresh_Tick(object sender, EventArgs e)
        {
            if (!APIWrapper.ValidAuthorization)
            {
                return;
            }

            int tempTick = ++Tick;

            OrderContainer[] Orders = OrderContainer.GetAll();
            int Selected            = -1;

            if (listView1.SelectedIndices.Count > 0)
            {
                Selected = listView1.SelectedIndices[0];
            }
            listView1.Items.Clear();
            for (int i = 0; i < Orders.Length; i++)
            {
                int          Algorithm = Orders[i].Algorithm;
                ListViewItem LVI       = new ListViewItem(APIWrapper.SERVICE_NAME[Orders[i].ServiceLocation]);
                LVI.SubItems.Add(APIWrapper.ALGORITHM_NAME[Algorithm]);
                if (Orders[i].OrderStats != null)
                {
                    if (tempTick % 120 == 0)
                    {
                        if ((Orders[i].OrderStats.Price > 1.025 * Orders[i].MaxPrice) && (Orders[i].OrderStats.Speed > 0))
                        {
                            OrderContainer copy = new OrderContainer(Orders[i]);
                            OrderContainer.Remove(i);
                            OrderContainer.Add(copy.ServiceLocation, copy.Algorithm, copy.MaxPrice, copy.Limit, copy.PoolData, copy.ID, copy.StartingPrice, copy.StartingAmount, copy.HandlerDLL);
                            Console.WriteLine("Order recreated");
                        }
                    }
                    else
                    {
                        LVI.SubItems.Add("#" + Orders[i].OrderStats.ID.ToString());
                        string PriceText = Orders[i].OrderStats.Price.ToString("F4") + " (" + Orders[i].MaxPrice.ToString("F4") + ")";
                        PriceText += " BTC/" + APIWrapper.SPEED_TEXT[Algorithm] + "/Day";
                        LVI.SubItems.Add(PriceText);
                        LVI.SubItems.Add(Orders[i].OrderStats.BTCAvailable.ToString("F8"));
                        LVI.SubItems.Add(Orders[i].OrderStats.Workers.ToString());
                        string SpeedText = (Orders[i].OrderStats.Speed * APIWrapper.ALGORITHM_MULTIPLIER[Algorithm]).ToString("F4") + " (" + Orders[i].Limit.ToString("F2") + ") " + APIWrapper.SPEED_TEXT[Algorithm] + "/s";
                        LVI.SubItems.Add(SpeedText);
                        if (!Orders[i].OrderStats.Alive)
                        {
                            LVI.BackColor = Color.PaleVioletRed;
                        }
                        else
                        {
                            LVI.BackColor = Color.LightGreen;
                        }
                        LVI.SubItems.Add("View competing orders");
                    }
                }

                if (Selected >= 0 && Selected == i)
                {
                    LVI.Selected = true;
                }

                listView1.Items.Add(LVI);
            }
        }