Esempio n. 1
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (OportunityMonitor.trend == "growing")
     {
         button2.BackgroundImage = Properties.Resources.descend;
         OportunityMonitor.trend = "descending";
         label7.Text             = "продажа";
         label7.ForeColor        = System.Drawing.Color.Salmon;
         label6.Text             = "покупка (take profit)";
         label6.ForeColor        = System.Drawing.Color.SeaGreen;
         label8.Text             = "покупка (stop loss)";
         label8.ForeColor        = System.Drawing.Color.SeaGreen;
     }
     else
     {
         button2.BackgroundImage = Properties.Resources.grow;
         OportunityMonitor.trend = "growing";
         label7.Text             = "покупка";
         label7.ForeColor        = System.Drawing.Color.SeaGreen;
         label6.Text             = "продажа (take profit)";
         label6.ForeColor        = System.Drawing.Color.Salmon;
         label8.Text             = "продажа (stop loss)";
         label8.ForeColor        = System.Drawing.Color.Salmon;
     }
     OportunityMonitor.calculateOportunities();
 }
Esempio n. 2
0
 private void button3_Click(object sender, EventArgs e)
 {
     OportunityMonitor.sendCancelAll2Transaq();
     if (checkBox1.Checked == true)
     {
         MamuschkaRepeater.cancellAll();
     }
 }
Esempio n. 3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (currentPosition != null)
     {
         OportunityMonitor.sendOrder2Transaq(currentPosition);
         if (checkBox1.Checked == true)
         {
             MamuschkaRepeater.forwardPosition(currentPosition);
         }
     }
 }
Esempio n. 4
0
        private void textBox5_TextChanged(object sender, EventArgs e)
        {
            TextBox myTextbox = (TextBox)sender;

            if (Double.TryParse(myTextbox.Text,
                                System.Globalization.NumberStyles.Any,
                                System.Globalization.CultureInfo.GetCultureInfo("en-US"),
                                out double input))
            {
                myTextbox.ForeColor = Color.Black;
                OportunityMonitor.takeProfitCoefficientOnHMI = input;
                OportunityMonitor.calculateOportunities();
            }
            else
            {
                myTextbox.ForeColor = Color.Red;
            }
        }
Esempio n. 5
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            System.Windows.Forms.TextBox myTextbox = (System.Windows.Forms.TextBox)sender;

            if (Double.TryParse(myTextbox.Text,
                                System.Globalization.NumberStyles.Any,
                                System.Globalization.CultureInfo.GetCultureInfo("en-US"),
                                out double delta))
            {
                myTextbox.ForeColor          = System.Drawing.Color.Black;
                OportunityMonitor.deltaOnHMI = delta;
                OportunityMonitor.calculateOportunities();
            }
            else
            {
                myTextbox.ForeColor = System.Drawing.Color.Red;
            }
        }
Esempio n. 6
0
        private void dataGridViewMyInstruments_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView myObject = (DataGridView)sender;

            if (myObject.CurrentRow == null)
            {
                return;
            }
            string seccode  = myObject.CurrentRow.Cells[2].Value.ToString();
            int    decimals = (int)myObject.CurrentRow.Cells[4].Value;
            int    market   = (int)myObject.CurrentRow.Cells[5].Value;
            string board    = myObject.CurrentRow.Cells[6].Value.ToString();

            OportunityMonitor.monitoredSecurityOnHMI = new Security(seccode, board, decimals, market);
            OportunityMonitor.addSecurityForMonitoring(new Security(seccode, board, decimals, market));

            string cmd = "<command id=\"subscribe\">";

            cmd = cmd + "   <quotations><security><board>" + board + "</board><seccode>" + seccode + "</seccode></security></quotations>";
            cmd = cmd + "</command>";

            string res = TXmlConnector.ConnectorSendCommand(cmd);
        }
Esempio n. 7
0
        //================================================================================
        void MainFormLoad(object sender, EventArgs e)
        {
            ctl_Tabs.SelectTab("tab_Param");

            // параметры по умолчанию
            ServerIP   = "tr1.finam.ru";
            ServerPort = "3900";

            loadLogginDetails();

            session_timeout = 25;
            request_timeout = 10;

            comboBox1.Items.Add(new ComboboxItem()
            {
                Text = "FORTS", Value = 4
            });
            comboBox1.Items.Add(new ComboboxItem()
            {
                Text = "ММВБ", Value = 1
            });
            comboBox1.Items.Add(new ComboboxItem()
            {
                Text = "SPBEX", Value = 7
            });
            comboBox1.Items.Add(new ComboboxItem()
            {
                Text = "INF", Value = 8
            });
            comboBox1.Items.Add(new ComboboxItem()
            {
                Text = "MMA", Value = 14
            });
            comboBox1.Items.Add(new ComboboxItem()
            {
                Text = "ETS", Value = 8
            });

            comboBox1.SelectedIndex = 0;


            edt_Login.Text    = sLogin;
            edt_Password.Text = sPassword;
            edt_IP.Text       = ServerIP;
            edt_Port.Text     = ServerPort;

            bConnected  = false;
            bConnecting = false;

            Enable_Password_Controls(false);

            Init_Data();

            // открытие лог-файла
            log.StartLogging(AppDir + "log" + DateTime.Now.ToString("yyMMdd") + ".txt");

            TXmlConnector.statusTimeout = session_timeout * 1000;

            TXmlConnector.ConnectorSetCallback(OnNewFormData, OnNewSecurity, OnNewTimeframe, OnNewStatus);

            this.onNewFormDataEvent  += new NewStringDataHandler(Add_FormData);
            this.onNewSecurityEvent  += new NewStringDataHandler(Add_Security);
            this.onNewTimeframeEvent += new NewStringDataHandler(Add_Timeframe);
            this.onNewStatusEvent    += new NewBoolDataHandler(ConnectionStatusReflect);

            TXmlConnector.Orders4HMISubscribe(OrdersSubscriber);
            this.onOrdersPublished += new NewStringDataHandler(processOrdersDistribution);


            OportunityMonitor.init();

            TXmlConnector.FormReady = true;

            string LogPath = AppDir + "\0";

            if (TXmlConnector.ConnectorInitialize(LogPath, 3))
            {
                TXmlConnector.statusDisconnected.Set();
            }

            OportunityMonitor.subscribeQuotationUpdate(quotationCall);
            this.onQuotation += new quotationDelegate(setQuotationPrice);

            OportunityMonitor.PositionPublisherCallback(PositionPublisherCall);
            onPositionSuscriber += new PositionDelegate(setTakingClosingPosition);

            MamuschkaRepeater.mamushkaStatusSubscribe(mamuschkaStatusCall);
            onMamushkaStatusResponse += new NewStringDataHandler(setMamushkaServerStatus);
            MamuschkaRepeater.monitorMamuschkaServer();
        }