Ejemplo n.º 1
0
        /// <summary>
        /// 新增-行情组合合约
        /// </summary>
        /// <param name="combineInstrument"></param>
        public ArbitrageOrderCreateForm(ArbitrageCombineInstrument combineInstrument, USeProduct product)
        {
            InitializeComponent();

            m_combineInstrument = combineInstrument;
            m_product           = product;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 点击移除。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            int count = this.listBox_ArbitrageIns.Items.Count;

            if (count <= 0)
            {
                USeFuturesSpiritUtility.ShowWarningMessageBox(this, "套利组合合约列表为空");
                return;
            }
            else if (this.listBox_ArbitrageIns.SelectedItems.Count == 0)
            {
                USeFuturesSpiritUtility.ShowWarningMessageBox(this, "请选择需要从套利组合列表中移除的组合合约");
                return;
            }

            ArbitrageCombineInstrument combineIns = this.listBox_ArbitrageIns.SelectedItem as ArbitrageCombineInstrument;

            //控件删除
            this.listBox_ArbitrageIns.Items.Remove(combineIns);

            //内存删除
            Debug.Assert(m_arbitrageInstrumentList.Contains(combineIns));
            m_arbitrageInstrumentList.Remove(combineIns);

            //发布移除事件
            SafeFireOnArbitrageCombineInsRemoveChanged(combineIns);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button_Add_Click(object sender, EventArgs e)
        {
            Debug.Assert(this.listBox_InsOne.Items.Count != 0);
            Debug.Assert(this.listBox_InsTwo.Items.Count != 0);

            USeInstrument firstIns = (USeInstrument)this.listBox_InsOne.SelectedItem;
            USeInstrument SecIns   = (USeInstrument)this.listBox_InsTwo.SelectedItem;


            if (firstIns == null)
            {
                USeFuturesSpiritUtility.ShowWarningMessageBox(this, "请选择近月合约");
                return;
            }
            if (SecIns == null)
            {
                USeFuturesSpiritUtility.ShowWarningMessageBox(this, "请选择远月合约");
                return;
            }
            if (firstIns.InstrumentCode == SecIns.InstrumentCode)
            {
                USeFuturesSpiritUtility.ShowWarningMessageBox(this, "不能选择相同的合约");
                return;
            }

            if (firstIns.InstrumentCode.CompareTo(SecIns.InstrumentCode) > 0)
            {
                USeFuturesSpiritUtility.ShowWarningMessageBox(this, "请选择较近月的远月合约");
                return;
            }
            else
            {
                ArbitrageCombineInstrument arbitrageCombineInstrument = new ArbitrageCombineInstrument();
                arbitrageCombineInstrument.FirstInstrument  = firstIns;
                arbitrageCombineInstrument.SecondInstrument = SecIns;
                arbitrageCombineInstrument.ProductID        = m_product.ProductCode;

                foreach (object o in this.listBox_ArbitrageIns.Items)
                {
                    ArbitrageCombineInstrument combineInstrument = o as ArbitrageCombineInstrument;
                    if (combineInstrument.FirstInstrument.Equals(arbitrageCombineInstrument.FirstInstrument) &&
                        combineInstrument.SecondInstrument.Equals(arbitrageCombineInstrument.SecondInstrument))
                    {
                        USeFuturesSpiritUtility.ShowWarningMessageBox(this, "已经存在该套利组合合约,不能重复添加");
                        return;
                    }
                }

                //添加到界面
                this.listBox_ArbitrageIns.Items.Add(arbitrageCombineInstrument);

                //添加到内存
                m_arbitrageInstrumentList.Add(arbitrageCombineInstrument);

                //发布添加事件通知
                SafeFireOnArbitrageCombineInsAddChanged(arbitrageCombineInstrument);
            }
        }
Ejemplo n.º 4
0
        public static ArbitrageCombineInstrument Clone(ArbitrageCombineInstrument tempIns)
        {
            ArbitrageCombineInstrument ins = new ArbitrageCombineInstrument();

            ins.FirstInstrument  = tempIns.FirstInstrument;
            ins.SecondInstrument = tempIns.SecondInstrument;
            ins.ProductID        = tempIns.ProductID;
            return(ins);
        }
Ejemplo n.º 5
0
        private void ArbitrageQuoteListControl1_OnSelectCombineInstrumentChanged(ArbitrageCombineInstrument combineInstrument)
        {
            USeProduct product = USeManager.Instance.OrderDriver.QueryProduct(combineInstrument.ProductID);

            Debug.Assert(product != null);

            ArbitrageOrderCreateForm form = new ArbitrageOrderCreateForm(combineInstrument, product);

            form.Show(this);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// List更改通知事件。
 /// </summary>
 private void SafeFireOnArbitrageCombineInsRemoveChanged(ArbitrageCombineInstrument arbiInstrumentList)
 {
     if (OnArbitrageCombineInstrumentRemoveChanged != null)
     {
         try
         {
             OnArbitrageCombineInstrumentRemoveChanged(arbiInstrumentList);
         }
         catch (Exception ex)
         {
             Debug.Assert(false, ex.Message);
         }
     }
 }