Beispiel #1
0
        void SWThread_TickAsyncOnline()
        {
            while (true)
            {
                int length = MemoryManager.TradeMemoryConDict.Count;

                // initialStartPointSWAsync = MemoryManager.EndOfDownloadCount;
                if (MemoryManager.TradeMemoryConDict.Count > 0 && length > initialStartPointSWAsync)
                {
                    ParallelOptions oParallelOptions = new ParallelOptions();
                    oParallelOptions.MaxDegreeOfParallelism = 1;

                    Parallel.For(initialStartPointSWAsync, length, oParallelOptions, (index) =>
                    {
                        lock (newSWobjectAsync)
                        {
                            if (MemoryManager.TradeMemoryConDict.ContainsKey(index))
                            {
                                CommonFrontEnd.Processor.UMSProcessor.ProcessNetPositionSWDemo(MemoryManager.TradeMemoryConDict[index]);
                                NetPositionMemory.UpdateScripNetPosition(((CommonFrontEnd.Model.Trade.TradeUMS)MemoryManager.TradeMemoryConDict[index]).ScripCode.ToString(), MemoryManager.NetPositionSWDemoDict.Where(x => ((CommonFrontEnd.Model.Trade.NetPosition)x.Value).ScripCode == ((CommonFrontEnd.Model.Trade.TradeUMS)MemoryManager.TradeMemoryConDict[index]).ScripCode).ToList());

                                NetPositionMemory.UpdateScripNetPositionDetail(((CommonFrontEnd.Model.Trade.TradeUMS)MemoryManager.TradeMemoryConDict[index]).ScripCode.ToString(), MemoryManager.NetPositionSWDemoDict.Where(x => ((CommonFrontEnd.Model.Trade.NetPosition)x.Value).ScripCode == ((CommonFrontEnd.Model.Trade.TradeUMS)MemoryManager.TradeMemoryConDict[index]).ScripCode).ToList());
                            }
                        }
                    });

                    initialStartPointSWAsync = length;
                }
                else
                {
                    Thread.Sleep(1000);
                }
            }
        }
Beispiel #2
0
        void SWThread_TickAsyncPD()
        {
            bool DisplayFlag = true;

            while (true)
            {
                int length = MemoryManager.EndOfDownloadCount;//MemoryManager.TradeMemoryConDict.Count;

                if (length == initialStartPointSWAsync && DisplayFlag)
                {
                    DisplayFlag = false;
                    NetPositionMemory.UpdateScripNetPosition("", MemoryManager.NetPositionSWDemoDict.ToList());
                    ProcessSWTradeDisplayAsync().Wait();
                    ProcessScripWiseTradeAsyncOnline();
                    thSWPersonalDownload.Abort();
                }

                if (MemoryManager.TradeMemoryConDict.Count > 0 && length > initialStartPointSWAsync)
                {
                    ParallelOptions oParallelOptions = new ParallelOptions();
                    oParallelOptions.MaxDegreeOfParallelism = 1;

                    Parallel.For(initialStartPointSWAsync, length, oParallelOptions, (index) =>
                    {
                        lock (newSWobjectAsync)
                        {
                            if (MemoryManager.TradeMemoryConDict.ContainsKey(index))
                            {
                                CommonFrontEnd.Processor.UMSProcessor.ProcessNetPositionSWDemo(MemoryManager.TradeMemoryConDict[index]);
                                //TODO NP No Need
                                //CommonFrontEnd.Processor.UMSProcessor.ProcessNetPositionCWSWDetailsDemo(MemoryManager.TradeMemoryConDict[index]);
                                //CommonFrontEnd.Processor.UMSProcessor.ProcessNetPositionSWCWDetailsDemo(MemoryManager.TradeMemoryConDict[index]);
                            }
                        }
                    });

                    initialStartPointSWAsync = length;
                }
                else
                {
                    Thread.Sleep(1000);
                }
            }
        }
Beispiel #3
0
        void SWThread_TickAsyncPDDisplay()
        {
            if (MemoryManager.NetPositionSWDemoDict != null && MemoryManager.NetPositionSWDemoDict.Count > 0)
            {
                var results = MemoryManager.NetPositionSWDemoDict.GroupBy(p => ((CommonFrontEnd.Model.Trade.NetPosition)p.Value).ScripCode,
                                                                          p => p.Value,
                                                                          (key, g) => new
                {
                    scripCode = key,
                    scripData = g.ToList()
                }
                                                                          );

                foreach (var item in results)
                {
                    NetPositionMemory.UpdateScripNetPosition(item.scripCode.ToString(), MemoryManager.NetPositionSWDemoDict.Where(x => ((CommonFrontEnd.Model.Trade.NetPosition)x.Value).ScripCode == item.scripCode).ToList());
                    //TODO call SWCW for pd
                    NetPositionMemory.UpdateScripNetPositionDetail(item.scripCode.ToString(), MemoryManager.NetPositionSWDemoDict.Where(x => ((CommonFrontEnd.Model.Trade.NetPosition)x.Value).ScripCode == item.scripCode).ToList());
                }
            }
        }