Example #1
0
        /// <summary>
        /// 构造函数
        /// </summary>
        public QuoteDataBase()
        {
            Dc = DataCenterCore.CreateInstance();
            Cm = ConnectManager2.CreateInstance();

            IsPush = false;
        }
Example #2
0
        private void mainForm_Load(object sender, EventArgs e)
        {
            BasicConfiguration config = BasicConfiguration.FromNameValueCollection(System.Configuration.ConfigurationManager.AppSettings);

            DataCenterDataAccess.Config.ConnectionString = config.ConnectionString;

            core = new DataCenterCore(config);
            core.Start();
        }
        protected override bool DecodingBody(BinaryReader br)
        {
            byte market = br.ReadByte();

            byte[] buffer  = br.ReadBytes(0x10);
            byte[] srcCode = new byte[7];
            for (int i = 0; i < srcCode.Length; i++)
            {
                srcCode[i] = buffer[i];
            }
            String emcode = ConvertCode.ConvertIntToCode((uint)ConvertCode.ConvertCodeToInt(srcCode, market));

            switch (market)
            {
            case 8:
            {
                emcode = ConvertCode.ConvertFuturesCftEmCodeToOrgEmCode(emcode);
                break;
            }
            }
            if (DetailData.EmCodeToUnicode.ContainsKey(emcode))
            {
                this.Code = DetailData.EmCodeToUnicode[emcode];
            }
            else
            {
                return(false);
            }
            br.ReadBytes(4);
            float fieldValue = br.ReadSingle();
            float num5       = br.ReadSingle();

            switch (DataCenterCore.CreateInstance().GetMarketType(this.Code))
            {
            case MarketType.TB_NEW:
            case MarketType.TB_OLD:
                if (fieldValue >= 900000f)
                {
                    fieldValue = 0f;
                }
                if (num5 < 0f)
                {
                    num5 = 0f;
                }
                break;
            }
            DetailData.FieldIndexDataSingle[this.Code][FieldIndex.UpLimit]   = fieldValue;
            DetailData.FieldIndexDataSingle[this.Code][FieldIndex.DownLimit] = num5;
            CFTService.CallBack(FuncTypeRealTime.LimitedPrice, fieldValue.ToString() + num5.ToString());
            return(true);
        }
Example #4
0
 private void ConnectCallBack(TcpService tcpService, object stata)
 {
     if (tcpService == TcpService.SSHQ)
     {
         if (!a)
         {
             DataCenterCore.CreateInstance().SendLogonCft();
             a = true;
         }
     }
     Debug.Print(tcpService.ToString() + "连接成功");
     //if (tcpService == TcpService.ALL &&  _dataQuery.IsAliving)
     if (_dataQuery.IsAliving)
     {
         //ReqHeartDataPacket packet = new ReqHeartDataPacket();
         ////Request(packet);
         //if (DoAddOneClient != null)
         //    DoAddOneClient(this, new ConnectEventArgs(tcpService, null));
     }
 }
Example #5
0
        /// <summary>
        /// Start
        /// </summary>
        public static void Start()
        {
            try
            {
                LogUtilities.LogMessage("行情开始加载");
                ConnectManager2.CreateInstance().DoNetConnect();
                DataCenterCore dc = DataCenterCore.CreateInstance();
                //dc.TimerStart();
                //dc.DoTimerElapsed();


                //var codes = dc.GetQuoteCodeList(new List<String>() {"600000.SH"}, FieldIndex.Code);
                //订阅一个指数行情

                //……
            }
            catch (Exception e)
            {
                LoggerHelper.Log.Debug(e.Message + "\r\n" + e.StackTrace);
            }
        }
Example #6
0
 public static MarketType GetMarketType(int code)
 {
     return(DataCenterCore.CreateInstance().GetMarketType(code));
 }