Пример #1
0
        /*매수전략 생성*/
        private void createStrategy()
        {
            //  if (sender.Equals(createStrategyButton))
            // {
            string account = accountComboBox.Text;

            if (account.Length == 0)
            {
                MessageBox.Show("투자 계좌번호를 선택해주세요");
                return;
            }
            string    conditionName   = buycondition_combo.Text;
            condition buyingCondition = null;       //매수조건식

            if (conditionName.Length > 0)
            {
                buyingCondition = conditionList.Find(o => o.name.Equals(conditionName));
            }
            else     // 매수조건식 선택 x
            {
                MessageBox.Show("매수 조건식을 선택하세요.");
            }

            if (buyingCondition == null)
            {
                return;
            }

            string buyingOrderOption;     // 호가옵션

            if (marketPriceRadio.Checked)
            {
                buyingOrderOption = "시장가";
            }
            else
            {
                buyingOrderOption = buyingOrderComboBox.Text;
            }

            int totablInvestMent;

            if (investmentnumeric1.Value == 0)
            {
                MessageBox.Show("투자금액을 설정해주세요");
                return;
            }
            // totablInvestMent = (int)investmentnumeric1.Value - Convert.ToInt32(lb매입금액.Text); // 총투자금액
            totablInvestMent = int.Parse(lb총금액.Text) - int.Parse(lb매입금액.Text);
            int itemCount = (int)itemcountnumeric2.Value;     // 매수조건수

            tradingStrategy ts = new tradingStrategy(account, buyingCondition, buyingOrderOption, totablInvestMent, itemCount);

            tradingStrategyList.Add(ts);

            //MessageBox.Show("전략이 생성되었습니다.");
            AddStrategyToDataGridView(ts);
        }
Пример #2
0
        //}

        /*매매전략 DataGridView 바인딩*/
        private void AddStrategyToDataGridView(tradingStrategy ts)
        {
            if (ts != null)
            {
                int rowIndex = tradingStrategyGridView.Rows.Add();
                tradingStrategyGridView["매매전략_계좌번호", rowIndex].Value   = ts.account;
                tradingStrategyGridView["매매전략_매수가격", rowIndex].Value   = ts.buyingOrderOption;
                tradingStrategyGridView["매매전략_총투자금", rowIndex].Value   = ts.totalInvestment;
                tradingStrategyGridView["매매전략_매수종목수", rowIndex].Value  = ts.buyingItemCount;
                tradingStrategyGridView["매매전략_종목당투자금", rowIndex].Value = ts.itemInvestment;
            }
        }