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);
                }
            }
        }
        //private RelayCommand _ShowGrid;

        //public RelayCommand ShowGrid
        //{
        //    get { return _ShowGrid ?? (_ShowGrid = new RelayCommand((object e) => Refresh())); }
        //}
        #endregion

        public void UpdateClientsByScrip(long scripCode)
        {
            NetPositionSWCWDataCollectionWindow = null;
            if (scripCode != 0)
            {
                ScripCodeSWCW = scripCode;
                NetPositionMemory.UpdateScripNetPositionDetail(scripCode.ToString(), MemoryManager.NetPositionSWDemoDict.Where(x => ((CommonFrontEnd.Model.Trade.NetPosition)x.Value).ScripCode == scripCode).ToList());
                NetPositionSWCWDataCollectionWindow = new ObservableCollection <ScripWiseDetailPositionModel>(NetPositionMemory.NetPositionSWCWDataCollection.Where(x => x.ScripCode == scripCode));
            }
            //BSE Equity
            var segment = CommonFunctions.GetSegmentID(scripCode);

            NetPositionScripDetail = string.Format("Net Position Details - {0}", Common.CommonFunctions.GetScripId(scripCode, "BSE", segment));
        }
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());
                }
            }
        }