Beispiel #1
0
        /// <summary>
        /// 接收行情
        /// </summary>
        private void Receiving()
        {
            try
            {
                //上证DBF
                Show2003Analyzer show2003 = new Show2003Analyzer(Common.strSHQuotation.Trim());
                //深证DBF
                SjshqAnalyzer sjshq = new SjshqAnalyzer(Common.strSZQuotation.Trim());
                //上证类股票DBF即时行情
                Dictionary <string, Show2003DBFRecord> mapSHTemp = new Dictionary <string, Show2003DBFRecord>();
                //深证类股票DBF即时行情
                Dictionary <string, SjshqDBFRecord> mapSZTemp = new Dictionary <string, SjshqDBFRecord>();
                //接收运行中心
                while (bReceiving && mapSHRates != null && mapSZRates != null)
                {
                    try
                    {
                        if (!Management.Work || Common.IsWeekend ||
                            DateTime.Now.TimeOfDay < Common.BeginAMTS ||
                            DateTime.Now.TimeOfDay > Common.EndPMTS.Add(new TimeSpan(0, 10, 0)))
                        {
                            Thread.Sleep(30000);
                            continue;
                        }

                        mapSHTemp.Clear(); show2003.ReadAllRecords(out mapSHTemp);
                        mapSZTemp.Clear(); sjshq.ReadAllRecords(out mapSZTemp);
                        if (mapSHTemp.Count > 0)
                        {
                            lock (mapSHRates)
                            {
                                mapSHRates = new Dictionary <string, Show2003DBFRecord>(mapSHTemp);
                            }
                        }
                        if (mapSZTemp.Count > 0)
                        {
                            lock (mapSZRates)
                            {
                                mapSZRates = new Dictionary <string, SjshqDBFRecord>(mapSZTemp);
                            }
                        }
                    }
                    catch (Exception err)
                    {
                        Common.Log(err);
                    }
                    Thread.Sleep(1000);
                }
            }
            catch (Exception err)
            {
                Common.Log(err);
                Common.Log("Error: The Quotation Thread Has Crashed !");
                Common.stkTrading.Uninitialize();
            }
        }
Beispiel #2
0
        /// <summary>
        /// ��������
        /// </summary>
        private void Receiving()
        {
            try
            {
                //��֤DBF
                Show2003Analyzer show2003 = new Show2003Analyzer(Common.strSHQuotation.Trim());
                //��֤DBF
                SjshqAnalyzer sjshq = new SjshqAnalyzer(Common.strSZQuotation.Trim());
                //��֤���ƱDBF��ʱ����
                Dictionary<string, Show2003DBFRecord> mapSHTemp = new Dictionary<string, Show2003DBFRecord>();
                //��֤���ƱDBF��ʱ����
                Dictionary<string, SjshqDBFRecord> mapSZTemp = new Dictionary<string, SjshqDBFRecord>();
                //������������
                while (bReceiving && mapSHRates != null && mapSZRates != null)
                {
                    try
                    {
                        if (!Management.Work || Common.IsWeekend
                            || DateTime.Now.TimeOfDay < Common.BeginAMTS
                            || DateTime.Now.TimeOfDay > Common.EndPMTS.Add(new TimeSpan(0, 10, 0)))
                        {
                            Thread.Sleep(30000);
                            continue;
                        }

                        mapSHTemp.Clear(); show2003.ReadAllRecords(out mapSHTemp);
                        mapSZTemp.Clear(); sjshq.ReadAllRecords(out mapSZTemp);
                        if (mapSHTemp.Count > 0)
                        {
                            lock (mapSHRates)
                            {
                                mapSHRates = new Dictionary<string, Show2003DBFRecord>(mapSHTemp);
                            }
                        }
                        if (mapSZTemp.Count > 0)
                        {
                            lock (mapSZRates)
                            {
                                mapSZRates = new Dictionary<string, SjshqDBFRecord>(mapSZTemp);
                            }
                        }
                    }
                    catch (Exception err)
                    {
                        Common.Log(err);
                    }
                    Thread.Sleep(1000);
                }
            }
            catch (Exception err)
            {
                Common.Log(err);
                Common.Log("Error: The Quotation Thread Has Crashed !");
                Common.stkTrading.Uninitialize();
            }
        }