Ejemplo n.º 1
0
        private void btnSubQuote_Click(object sender, EventArgs e)
        {
            if (DialogResult.OK == m_QuoteSelectForm.ShowDialog())
            {
                List <string> subList = DataManager.Quote.ContractMgr.GetSubscribedContractList();
                foreach (string sub in subList)
                {
                    if (!DataManager.Quote.QuoteWholeMgr.IsQuoteSubscribed(sub))
                    {
                        TapQuoteAPI.TapAPIContract con = DataManager.Quote.ContractMgr.ContractDict[sub].Contract.Contract;
                        m_QuoteCtrl.SubQuote(con);
                    }
                }
                //TODO:退订
                m_InsertOrderPanel.UpdateContractIDList(subList.ToArray());


                if (!IsQuoteSubed && subList.Count > 0)
                {
                    IsQuoteSubed = true;
                }
                else
                {
                    if (subList.Count == 0)
                    {
                        IsQuoteSubed = false;
                    }
                }
            }
        }
Ejemplo n.º 2
0
            public void RemoveQuote(TapQuoteAPI.TapAPIContract cont)
            {
                string key = MakeContractID(cont);

                if (QuoteDict.ContainsKey(key))
                {
                    QuoteDict.Remove(key);
                }
            }
Ejemplo n.º 3
0
        public static string MakeContractID(TapQuoteAPI.TapAPIContract contract)
        {
            string strContractID = contract.Commodity.ExchangeNo;

            strContractID += "_" + contract.Commodity.CommodityType;
            strContractID += "_" + contract.Commodity.CommodityNo;
            strContractID += "_" + contract.ContractNo1;
            strContractID += "_" + contract.CallOrPutFlag1;
            strContractID += "_" + contract.StrikePrice1;
            strContractID += "_" + contract.ContractNo2;
            strContractID += "_" + contract.CallOrPutFlag2;
            strContractID += "_" + contract.StrikePrice2;
            return(strContractID);
        }
Ejemplo n.º 4
0
        //UI触发事件
        void m_InsertOrderPanel_InsertOrderClicked(InsertOrderPanel.InsertOrderParams order)
        {
            TapAPINewOrder newOrder = new TapAPINewOrder();

            newOrder.AccountNo = order.AccountNo;
            TapQuoteAPI.TapAPIContract con = DataManager.Quote.ContractMgr.GetContractByID(order.ContractID);
            if (null == con)
            {
                MessageBox.Show("ContractID Error!");
                return;
            }

            newOrder.ExchangeNo     = con.Commodity.ExchangeNo;
            newOrder.CommodityType  = con.Commodity.CommodityType;
            newOrder.CommodityNo    = con.Commodity.CommodityNo;
            newOrder.ContractNo     = con.ContractNo1;
            newOrder.CallOrPutFlag  = con.CallOrPutFlag1;
            newOrder.StrikePrice    = con.StrikePrice1;
            newOrder.ContractNo2    = con.ContractNo2;
            newOrder.CallOrPutFlag2 = con.CallOrPutFlag2;
            newOrder.StrikePrice2   = con.StrikePrice2;


            newOrder.OrderQty       = order.OrderQty;
            newOrder.OrderPrice     = order.OrderPrice;
            newOrder.OrderType      = order.OrderType;
            newOrder.OrderSide      = order.OrderSide;
            newOrder.PositionEffect = order.OpenCloseMode;

            char YNFLAG_NO = 'N';

            newOrder.AddOneIsValid    = YNFLAG_NO;
            newOrder.IsRiskOrder      = YNFLAG_NO;
            newOrder.TriggerCondition = YNFLAG_NO;
            newOrder.TriggerPriceType = YNFLAG_NO;
            newOrder.TacticsType      = YNFLAG_NO;
            newOrder.PositionEffect2  = YNFLAG_NO;
            newOrder.OrderSource      = TapTrade.TAPI_ORDER_SOURCE_ESUNNY_API;
            newOrder.TimeInForce      = TapTrade.TAPI_ORDER_TIMEINFORCE_GFD;
            newOrder.HedgeFlag        = TapTrade.TAPI_HEDGEFLAG_T;
            newOrder.HedgeFlag2       = TapTrade.TAPI_HEDGEFLAG_NONE;


            if (!m_TradeCtrl.InsertOrder(newOrder))
            {
                MessageBox.Show("InsertFailed");
            }
        }