Exemplo n.º 1
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            this.initOrderButton.Visible = true;
            this.loginButton.Visible     = false;
            this.logoutButton.Visible    = true;

            middlePrice = middlePriceTextBox.Text;
            sell_nums   = initialShortOrderCountTextBox.Text;
            buy_nums    = initialLongOrderCountTextBox.Text;

            quote_url = textBox1.Text;
            trade_url = textBox2.Text;

            username = textBox3.Text;
            password = textBox4.Text;

            broker = textBox9.Text;
            sub1   = symbolTextBox.Text;

            this.fileLog.log("程序启动............. ");
            Console.WriteLine("程序启动............. ");
            this.fileLog.log("quote_url: " + quote_url + "\n trade_url" + trade_url + "\n username" + username + "\n password" + password + "\n investorpass" + broker + "\n price_first" + middlePrice + "\n sub1" + sub1);
            Console.WriteLine("quote_url: " + quote_url + "\n trade_url" + trade_url + "\n username" + username + "\n password" + password + "\n investorpass" + broker + "\n price_first" + middlePrice + "\n sub1" + sub1);


            ctpQuote = new CtpQuote(quote_url, trade_url, username, password, broker, middlePrice, sub1);
            ctpTrade = new CtpTrade(root_dir, quote_url, trade_url, username, password, broker, middlePrice, sub1);


            int i = 1;

            if (i == 1)
            {
                ctpQuote.Run();
                ctpTrade.Run();
            }

            IList <OrderField> openOrderList     = this.fileAction.ReadOpenOrders(root_dir);
            String             Title1            = "隔夜定单\n";
            String             List_submit_order = "";

            if (openOrderList != null && openOrderList.Count > 0)
            {
                int ordinal = 1;
                foreach (OrderField openOrder in openOrderList)
                {
                    List_submit_order += ordinal.ToString("D3") + " " + openOrder.ToShortString() + "\n";
                    ordinal++;
                }//foreach
            }
            else
            {
                List_submit_order += "无";
            }
            this.richTextBox1.Text = Title1 + List_submit_order;
            this.timer2.Start();
        }