예제 #1
0
        private void ProcessUserUpdateVM(byte[] arrMsgBody)
        {
            CUserVMUpdate updateVM = CUtilProto.DeserializeProto <CUserVMUpdate>(arrMsgBody);

            Log("[UserUpdateVM]");


            _childWinDataUpdater.Update(updateVM, _connId);
            _childWinDataUpdater.Update(updateVM.ListVM, _connId);
        }
        public void EnqueueUpdateVm(int botID)
        {
            if (!IsNeedSenUserPosLog(botID))
            {
                return;
            }

            var res = _dictBotIdConnId.FirstOrDefault(a => a.Key == botID);

            if (res.Key == 0)
            {
                return;               //not found
            }
            int connId = res.Value;


            CUserVMUpdate updateVM = new CUserVMUpdate();
            CBotTrader    bot      = _dictKBotIdVBotTrader[botID];

            lock (bot.DictVMBotSessionTotalClosed)
            {
                foreach (var kvp in bot.DictVMBotSessionTotalClosed)
                {
                    updateVM.ListVM.Add(new CUserVmInstrumentRecord {
                        Isin = kvp.Key, VM = kvp.Value
                    });
                }

                updateVM.VMStockRecord = new CUserVMStockRecord
                {
                    StockName = CodesStockExch.GetStockName(_stockExchId),
                    TotalVM   = bot.VMAllInstrClosed
                };
            }

            _bqTraderData.Add(new CTradingData
            {
                ConnId = connId,
                Data   = (object)updateVM,
                Event  = enmTradingEvent.UserUpdateVM
            }
                              );
        }
예제 #3
0
        public override void UpdateData(object data, int conId)
        {
            base.UpdateData(data, conId);


            CUserVMUpdate      vm         = (CUserVMUpdate)data;
            CUserVMStockRecord vmStockRec = vm.VMStockRecord;
            var res = ListStockRecords.FirstOrDefault(a => a.StockName == vmStockRec.StockName);

            if (res == null)
            {
                ListStockRecords.Add(new ModelStockRecord
                {
                    StockName = vmStockRec.StockName,
                    TotalVM   = vmStockRec.TotalVM,
                    ConId     = conId
                });
            }
            else
            {
                res.TotalVM = vmStockRec.TotalVM;
            }
            BindGrid();
        }
 private void SendUpdateTotalVM(int connId, CUserVMUpdate userUpdateVM)
 {
     SendDataToClients(userUpdateVM, enmTradingEvent.UserUpdateVM, "", connId);
 }