Esempio n. 1
0
        private void btnQhHold_Click(object sender, EventArgs e)
        {
            TraderFindService.TraderFindClient traderFindClient = new TraderFindClient();

            FuturesHoldConditionFindEntity findEntity = new FuturesHoldConditionFindEntity();

            //findEntity.CurrencyType = TraderFindService.;
            findEntity.ContractCode = "IF0909";
            string a = "0";
            int    n = 0;
            List <FuturesHoldFindResultEntity> list = new List <FuturesHoldFindResultEntity>();

            list[0] = traderFindClient.FuturesHoldFind(out n, "010000002306", "888888", findEntity, 0, 0, ref a)[0];
        }
Esempio n. 2
0
        public bool Initialize(string _channelID)
        {
            bool result = false;

            try
            {
                doOrderClient = new DoOrderClient();
                ICommunicationObject co1 = doOrderClient;
                co1.Faulted += CO_Faulted;

                traderFindClient = new TraderFindClient();
                ICommunicationObject co2 = traderFindClient;
                co2.Faulted += CO2_Faulted;

                OrderCallBack callBack = new OrderCallBack();
                rptClient = new OrderDealRptClient(new InstanceContext(callBack));
                ICommunicationObject co3 = rptClient;
                co3.Faulted += CO3_Faulted;

                accountClient = new AccountAndCapitalManagementClient();
                ICommunicationObject co4 = accountClient;
                co4.Faulted += co4_Faulted;

                //hkTraderQueryClient = new HKTraderQueryClient();
                //ICommunicationObject co5 = hkTraderQueryClient;
                //co5.Faulted += co5_Faulted;

                hkTraderFindClient = new HKTraderFindClient();
                ICommunicationObject co6 = hkTraderFindClient;
                co6.Faulted += co6_Faulted;

                hkTraderQueryClient = new HKTraderQuerySevice.HKTraderQueryClient();

                commonQueryClient = new TraderQueryClient();

                IsServiceOk = true;
                if (string.IsNullOrEmpty(_channelID))
                {
                    Channelid = ServerConfig.ChannelID;
                    if (string.IsNullOrEmpty(Channelid))
                    {
                        Channelid = CommUtils.GetMacAddress();
                        ServerConfig.ChannelID = Channelid;
                    }
                }
                else
                {
                    Channelid = _channelID;
                }
                result = rptClient.RegisterChannel(Channelid);

                if (result)
                {
                    string msg = "WCF Service [DoOrderService] is connected! " + DateTime.Now;
                    WriteMsg(msg);

                    string msg2 = "WCF Service [TradeFindService] is connected! " + DateTime.Now;
                    WriteMsg(msg2);

                    string msg3 = "WCF Service [DoDealRptService] is connected! " + DateTime.Now;
                    WriteMsg(msg3);

                    WriteMsg("");
                }
                else
                {
                    IsServiceOk = false;
                }

                if (IsServiceOk)
                {
                    timer          = new Timer();
                    timer.Interval = 10 * 1000;
                    timer.Elapsed += CheckRptChannel;
                    timer.Enabled  = true;
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteError(ex.Message, ex);
            }

            return(result);
        }