public CRawUserDeal(USER_DEAL.user_deal deal, string instrument) { ReplId = deal.replID; ReplRev = deal.replRev; if (deal.status_buy == 1) { Dir = (sbyte)OrderDirection.Buy; } else if (deal.status_sell == 1) { Dir = (sbyte)OrderDirection.Sell; } Price = deal.price; Amount = deal.amount; Ext_id_buy = deal.ext_id_buy; Ext_id_sell = deal.ext_id_sell; Moment = deal.moment; //Isin_Id = deal.isin_id; Instrument = instrument; Id_ord_buy = deal.id_ord_buy; Id_ord_sell = deal.id_ord_sell; Session_id = deal.sess_id; Id_Deal = deal.id_deal; Fee_buy = deal.fee_buy; Fee_sell = deal.fee_sell; }
/// <summary> /// Entry point of CUserDealsPosBox /// /// Call from Plaza2Connector\Plaza2Listener.ProcessUserDeal /// </summary> /// <param name="deal"></param> public void Update(USER_DEAL.user_deal deal) { try { if (deal.nosystem != 0) { Error("No system user deal."); } //drop already-processed deals (with the same id) foreach (CRawUserDeal rud in m_listRawUserDeal) { if (rud.ReplId == deal.replID) { //mxListRawUserDeal.ReleaseMutex(); return; //note: could be duplicate. Nothing to do with it. } } string instrument = UserDealsPosBoxClient.GetTicker(deal.isin_id); m_listRawUserDeal.Add(new CRawUserDeal(deal, instrument)); CalculateBotsPos(new CRawUserDeal(deal, instrument)); UserDealsPosBoxClient.UpdateGUIDealCollection(new CRawUserDeal(deal, instrument)); } catch (Exception e) { m_logger.Log("Error update " + e.Message + " " + e.StackTrace); Error("CUserDealsBox.Update", e); } finally { } }