Esempio n. 1
0
        public void ResetUI()
        {
            if (InvokeRequired)
            {
                ResetUICallback d = new ResetUICallback(ResetUI);
                Invoke(d, new object[] { });
            }
            else
            {
                groupBox.Text = View.ToUpper() + " " + Exchange.CurrentTicker.symbol;

                ExchangeManager.ExchangeBalance marketBalance = ExchangeManager.Balances.FirstOrDefault(balance =>
                                                                                                        balance.Exchange == Exchange.Name &&
                                                                                                        balance.Symbol == Exchange.CurrentTicker.market);

                ExchangeManager.ExchangeBalance symbolBalance = ExchangeManager.Balances.FirstOrDefault(balance =>
                                                                                                        balance.Exchange == Exchange.Name &&
                                                                                                        balance.Symbol == Exchange.CurrentTicker.symbol);
                int   iconSize   = toolStripButton_balance.Height;
                Image symbolIcon = ContentManager.ResizeImage(ContentManager.GetSymbolIcon(Exchange.CurrentTicker.symbol), iconSize, iconSize);
                Image marketIcon = ContentManager.ResizeImage(ContentManager.GetSymbolIcon(Exchange.CurrentTicker.market), iconSize, iconSize);

                pictureBox_price.Image  = marketIcon;
                pictureBox_amount.Image = symbolIcon;
                pictureBox_total.Image  = marketIcon;

                numericUpDown_price.Value  = 0;
                numericUpDown_stop.Value   = 0;
                numericUpDown_amount.Value = 0;
                numericUpDown_total.Value  = 0;
                UpdateUI();
            }
        }
Esempio n. 2
0
        private object aspect_Icon(object rowObject)
        {
            //Machine m = (Machine)rowObject;
            ExchangeManager.ExchangeBalance balance = (ExchangeManager.ExchangeBalance)rowObject;
            int rowheight = listView.RowHeightEffective;

            return(ContentManager.ResizeImage(ContentManager.GetSymbolIcon(balance.Symbol), rowheight, rowheight));
            //return ContentManager.GetExchangeIcon(exchange.Name);
        }
Esempio n. 3
0
        private void toolStripButton_buy_Click(object sender, EventArgs e)
        {
            ExchangeManager.ExchangeBalance marketBalance = ExchangeManager.Balances.FirstOrDefault(balance =>
                                                                                                    balance.Exchange == Exchange.Name &&
                                                                                                    balance.Symbol == Exchange.CurrentTicker.market);

            if (numericUpDown_total.Value == 0 || numericUpDown_amount.Value == 0)
            {
                MessageBox.Show("No Amount Or Total To Process", "EMPTY ORDER");
            }
            else
            {
                if (numericUpDown_total.Value > marketBalance.Balance)
                {
                    MessageBox.Show("Not Enough Funds For This Buy", "INSUFFICIENT FUNDS");
                }
                else
                {
                    if (View != "stop-limit")
                    {
                        string       message      = "Buy : " + numericUpDown_amount.Value.ToString("N8") + " " + Exchange.CurrentTicker.symbol + " @ Price : " + numericUpDown_price.Value.ToString("N8") + " " + Exchange.CurrentTicker.market;
                        string       title        = "TOTAL : " + numericUpDown_total.Value.ToString("N8") + " " + Exchange.CurrentTicker.market;
                        DialogResult dialogResult = MessageBox.Show(message, title, MessageBoxButtons.YesNo);
                        if (dialogResult == DialogResult.Yes)
                        {
                            //do something
                            LogManager.AddLogMessage(Name, "toolStripButton_buy_Click", "THIS BUY FUNCTION NEEDS TO BE ENABLED", LogManager.LogMessageType.DEBUG);
                            ExchangeManager.CreateNewOrder(Exchange.Name, ExchangeManager.ExchangeOrderType.buy, Exchange.CurrentTicker.symbol, Exchange.CurrentTicker.market, numericUpDown_price.Value, numericUpDown_amount.Value);

                            numericUpDown_amount.Value = 0;
                            numericUpDown_total.Value  = 0;
                        }
                    }
                    else
                    {
                        //string message = "STOP-LIMIT Buy : " + numericUpDown_amount.Value.ToString("N8") + " " + Exchange.CurrentTicker.symbol +
                        //" @ Price : " + numericUpDown_price.Value.ToString("N8") + " " + Exchange.CurrentTicker.market +
                        //" With STOP LIMIT OF " + numericUpDown_stop.Value;
                        string message = "If the lowest ask rises to or above " + numericUpDown_stop.Value + " " + Exchange.CurrentTicker.market +
                                         ", An order to buy " + numericUpDown_amount.Value + " " + Exchange.CurrentTicker.symbol +
                                         " at a price of " + numericUpDown_price.Value + " " + Exchange.CurrentTicker.market + " will be placed.";

                        string       title        = "STOP-LIMIT BUY for " + numericUpDown_amount.Value + " " + Exchange.CurrentTicker.symbol + " @ " + numericUpDown_total.Value.ToString("N8") + " " + Exchange.CurrentTicker.market;
                        DialogResult dialogResult = MessageBox.Show(message, title, MessageBoxButtons.YesNo);
                        if (dialogResult == DialogResult.Yes)
                        {
                            //do something
                            LogManager.AddLogMessage(Name, "toolStripButton_buy_Click", "THIS STOP-LIMIT BUY FUNCTION NEEDS TO BE ENABLED", LogManager.LogMessageType.DEBUG);
                            numericUpDown_amount.Value = 0;
                            numericUpDown_total.Value  = 0;
                        }
                    }
                }
            }
        }
Esempio n. 4
0
        private void toolStripButton_sell_Click(object sender, EventArgs e)
        {
            /*
             * ExchangeManager.ExchangeBalance marketBalance = ExchangeManager.Balances.FirstOrDefault(balance =>
             *                                                                                          balance.Exchange == Exchange.Name &&
             *                                                                                          balance.Symbol == Exchange.CurrentTicker.market);
             */
            ExchangeManager.ExchangeBalance symbolBalance = ExchangeManager.Balances.FirstOrDefault(balance =>
                                                                                                    balance.Exchange == Exchange.Name &&
                                                                                                    balance.Symbol == Exchange.CurrentTicker.symbol);

            if (numericUpDown_total.Value == 0 || numericUpDown_amount.Value == 0)
            {
                MessageBox.Show("No Amount Or Total To Process", "EMPTY ORDER");
            }
            else
            {
                if (numericUpDown_total.Value > symbolBalance.Balance)
                {
                    MessageBox.Show("Not Enough Funds For This Sell", "INSUFFICIENT FUNDS");
                }
                else
                {
                    if (View != "stop-limit")
                    {
                        string       message      = "Sell : " + numericUpDown_amount.Value.ToString("N8") + " " + Exchange.CurrentTicker.symbol + " @ Price : " + numericUpDown_price.Value.ToString("N8") + " " + Exchange.CurrentTicker.market;
                        string       title        = "TOTAL : " + numericUpDown_total.Value.ToString("N8") + " " + Exchange.CurrentTicker.market;
                        DialogResult dialogResult = MessageBox.Show(message, title, MessageBoxButtons.YesNo);
                        if (dialogResult == DialogResult.Yes)
                        {
                            //do something
                            LogManager.AddLogMessage(Name, "toolStripButton_sell_Click", "THIS SELL FUNCTION NEEDS TO BE ENABLED", LogManager.LogMessageType.DEBUG);
                            numericUpDown_amount.Value = 0;
                            numericUpDown_total.Value  = 0;
                        }
                    }
                    else
                    {
                        //string message = "STOP-LIMIT Buy : " + numericUpDown_amount.Value.ToString("N8") + " " + Exchange.CurrentTicker.symbol +
                        //" @ Price : " + numericUpDown_price.Value.ToString("N8") + " " + Exchange.CurrentTicker.market +
                        //" With STOP LIMIT OF " + numericUpDown_stop.Value;
                        string message = "If the highest bid drops to or below " + numericUpDown_stop.Value + " " + Exchange.CurrentTicker.market +
                                         ", An order to sell " + numericUpDown_amount.Value + " " + Exchange.CurrentTicker.symbol +
                                         " at a price of " + numericUpDown_price.Value + " " + Exchange.CurrentTicker.market + " will be placed.";

                        string       title        = "STOP-LIMIT SELL for " + numericUpDown_amount.Value + " " + Exchange.CurrentTicker.symbol + " @ " + numericUpDown_total.Value.ToString("N8") + " " + Exchange.CurrentTicker.market;
                        DialogResult dialogResult = MessageBox.Show(message, title, MessageBoxButtons.YesNo);
                        if (dialogResult == DialogResult.Yes)
                        {
                            //do something
                            LogManager.AddLogMessage(Name, "toolStripButton_sell_Click", "THIS STOP-LIMIT SELL FUNCTION NEEDS TO BE ENABLED", LogManager.LogMessageType.DEBUG);
                            numericUpDown_amount.Value = 0;
                            numericUpDown_total.Value  = 0;
                        }
                    }
                }
            }

            /*
             * string title = "Sell " + numericUpDown_amount.Value.ToString("N8") + " " + Exchange.CurrentTicker.symbol + " @ " + numericUpDown_price.Value.ToString("N8");
             * string message = "TOTAL : " + numericUpDown_total.Value.ToString("N8") + " " + Exchange.CurrentTicker.market;
             * DialogResult dialogResult = MessageBox.Show(message, title, MessageBoxButtons.YesNo);
             * if (dialogResult == DialogResult.Yes)
             * {
             *  //do something
             * }
             * else if (dialogResult == DialogResult.No)
             * {
             *  //do something else
             * }
             *
             *
             *
             * //MessageBox.Show(message, title);
             */
        }
Esempio n. 5
0
        public bool UpdateUI(bool resize = false)
        {
            if (InvokeRequired)
            {
                UpdateUICallback d = new UpdateUICallback(UpdateUI);
                Invoke(d, new object[] { resize });
            }
            else
            {
                groupBox.Text = View.ToUpper() + " " + Exchange.CurrentTicker.symbol;

                ExchangeManager.ExchangeBalance marketBalance = ExchangeManager.Balances.FirstOrDefault(balance =>
                                                                                                        balance.Exchange == Exchange.Name &&
                                                                                                        balance.Symbol == Exchange.CurrentTicker.market);

                ExchangeManager.ExchangeBalance symbolBalance = ExchangeManager.Balances.FirstOrDefault(balance =>
                                                                                                        balance.Exchange == Exchange.Name &&
                                                                                                        balance.Symbol == Exchange.CurrentTicker.symbol);
                int   iconSize   = toolStripButton_balance.Height;
                Image symbolIcon = ContentManager.ResizeImage(ContentManager.GetSymbolIcon(Exchange.CurrentTicker.symbol), iconSize, iconSize);
                Image marketIcon = ContentManager.ResizeImage(ContentManager.GetSymbolIcon(Exchange.CurrentTicker.market), iconSize, iconSize);

                pictureBox_price.Image  = marketIcon;
                pictureBox_amount.Image = symbolIcon;
                pictureBox_total.Image  = marketIcon;

                if (marketBalance != null && symbolBalance != null)
                {
                    switch (View)
                    {
                    case "buy":
                        toolStripButton_balance.Text  = marketBalance.Balance.ToString("N8");
                        toolStripButton_balance.Image = marketIcon;

                        toolStripButton_last.Text  = Exchange.CurrentTicker.last.ToString("N8");
                        toolStripButton_last.Image = marketIcon;

                        /*
                         * if (numericUpDown_price.Value == 0)
                         * {
                         *  numericUpDown_price.Value = Exchange.CurrentTicker.last;
                         * }
                         */
                        break;

                    case "sell":
                        toolStripButton_balance.Text  = symbolBalance.Balance.ToString("N8");
                        toolStripButton_balance.Image = symbolIcon;

                        toolStripButton_last.Text  = Exchange.CurrentTicker.last.ToString("N8");
                        toolStripButton_last.Image = marketIcon;

                        /*
                         * if (numericUpDown_price.Value == 0)
                         * {
                         *  numericUpDown_price.Value = Exchange.CurrentTicker.last;
                         * }
                         */
                        break;

                    case "stop-limit":
                        toolStripButton_balance.Text  = marketBalance.Balance.ToString("N8");
                        toolStripButton_balance.Image = marketIcon;

                        //toolStripLabel_last.Text
                        toolStripButton_last.Text  = symbolBalance.Balance.ToString("N8");
                        toolStripButton_last.Image = symbolIcon;
                        break;

                    default:
                        //AddLogMessage(Name, "OpenForm", "FORM NOT DEFINED!!! : " + name, LogMessageType.DEBUG);
                        break;
                    }

                    if (numericUpDown_price.Value == 0)
                    {
                        numericUpDown_price.Value = Exchange.CurrentTicker.last;
                    }
                }

                /*
                 * //toolStripButton_balance.Text = Exchange.CurrentTicker.m;
                 * //toolStripButton_balance.Image = ContentManager.GetSymbolIcon(Exchange.CurrentTicker.symbol);
                 *
                 * if (View != "stop-limit")
                 * {
                 *  toolStripButton_last.Text =
                 * }
                 */

                if (resize)
                {
                    ResizeUI();
                }
            }
            return(true);
        }
Esempio n. 6
0
 public object aspect_TotalInUSD(object rowObject)
 {
     ExchangeManager.ExchangeBalance balance = (ExchangeManager.ExchangeBalance)rowObject;
     return(balance.TotalInUSD.ToString("C"));
 }
Esempio n. 7
0
 public object aspect_TotalInBTCOrders(object rowObject)
 {
     ExchangeManager.ExchangeBalance balance = (ExchangeManager.ExchangeBalance)rowObject;
     return(balance.TotalInBTCOrders.ToString("N8"));
 }