protected override void ParseXmlMessage(string name)
 {
     base.ParseXmlMessage(MsgName);
     BrokerOrderId       = FixmlUtil.ReadString(xml, "OrdID", true);
     BrokerOrderId2      = FixmlUtil.ReadString(xml, "OrdID2", true);
     ClientOrderId       = FixmlUtil.ReadString(xml, "ID", true);
     StatusReqId         = FixmlUtil.ReadString(xml, "StatReqID", true);
     ExecId              = FixmlUtil.ReadString(xml, "ExecID");
     ExecType            = ExecRptTypeUtil.Read(xml, "ExecTyp", true);
     Status              = ExecRptStatUtil.Read(xml, "Stat", true);
     RejectReason        = OrderRejRsnUtil.Read(xml, "RejRsn", true);
     Account             = FixmlUtil.ReadString(xml, "Acct", true);
     Instrument          = FixmlInstrument.Read(xml, "Instrmt");
     Side                = OrderSideUtil.Read(xml, "Side");
     Quantity            = FixmlUtil.ReadUInt(xml, "OrdQty/Qty", true);
     Type                = OrderTypeUtil.Read(xml, "OrdTyp", true);
     Price               = FixmlUtil.ReadDecimal(xml, "Px", true);
     StopPrice           = FixmlUtil.ReadDecimal(xml, "StopPx", true);
     Currency            = FixmlUtil.ReadString(xml, "Ccy", true);
     TimeInForce         = OrdTmInForceUtil.Read(xml, "TmInForce");
     ExpireDate          = FixmlUtil.ReadDateTime(xml, "ExpireDt", true);
     LastPrice           = FixmlUtil.ReadDecimal(xml, "LastPx", true);
     LastQuantity        = FixmlUtil.ReadUInt(Xml, "LastQty", true);
     LeavesQuantity      = FixmlUtil.ReadUInt(xml, "LeavesQty", true);
     CumulatedQuantity   = FixmlUtil.ReadUInt(xml, "CumQty", true);
     TransactionTime     = FixmlUtil.ReadDateTime(xml, "TxnTm", true);
     Commission          = FixmlUtil.ReadDecimal(xml, "Comm/Comm", true);
     CommissionType      = OrdCommTypeUtil.Read(xml, "Comm/CommTyp", true);
     NetMoney            = FixmlUtil.ReadDecimal(xml, "NetMny", true);
     MinimumQuantity     = FixmlUtil.ReadUInt(xml, "MinQty", true);
     DisplayQuantity     = FixmlUtil.ReadUInt(xml, "DsplyInstr/DisplayQty", true);
     Text                = FixmlUtil.ReadString(xml, "Text", true);
     TriggerType         = FixmlUtil.ReadChar(xml, "TrgrInstr/TrgrTyp", true);
     TriggerAction       = FixmlUtil.ReadChar(xml, "TrgrInstr/TrgrActn", true);
     TriggerPrice        = FixmlUtil.ReadDecimal(xml, "TrgrInstr/TrgrPx", true);
     TriggerPriceType    = FixmlUtil.ReadChar(xml, "TrgrInstr/TrgrPxTyp", true);
     DeferredPaymentType = FixmlUtil.ReadChar(xml, "DefPayTyp", true);
 }
Esempio n. 2
0
 internal MDEntry(XmlElement inc)
 {
     //TODO: NOL3 na razie nie przesyła wcale pola "UpdtAct".
     UpdateAction = MDUpdateAction.Change;             //MDUpdateActionUtil.Read(inc, "UpdtAct");
     EntryType    = MDEntryTypeUtil.Read(inc, "Typ");
     Instrument   = FixmlInstrument.Read(inc, "Instrmt");
     if (EntryType.In(MDEntryTypes.HasPrice))
     {
         PriceStr = FixmlUtil.ReadString(inc, "Px");
         if (!(new[] { "PKC", "PCR", "PCRO" }).Contains(PriceStr))
         {
             Price = FixmlUtil.ReadDecimal(inc, "Px");
         }
     }
     if (EntryType.In(MDEntryTypes.HasCurrency))
     {
         Currency = FixmlUtil.ReadString(inc, "CCy");
     }
     if (EntryType.In(MDEntryTypes.HasSize))
     {
         try { Size = FixmlUtil.ReadUInt(inc, "Sz"); }
         catch (FixmlException e) { e.PrintWarning(); }
     }
     if (EntryType.In(MDEntryTypes.HasTurnover))
     {
         Turnover = FixmlUtil.ReadDecimal(inc, "Tov", EntryType.In(MDEntryTypes.OpenClose));
     }
     if (EntryType.In(MDEntryTypes.BasicBook))
     {
         Level  = FixmlUtil.ReadUInt(inc, "MDPxLvl");
         Orders = FixmlUtil.ReadUInt(inc, "NumOfOrds");
     }
     if (EntryType == MDEntryType.Trade)
     {
         DateTime = FixmlUtil.ReadDateTime(inc, "Dt", "Tm");
     }
 }
        public StatementData(XmlElement xml)
        {
            AccountNumber = FixmlUtil.ReadString(xml, "Acct");
            XmlNodeList fundsXml     = xml.GetElementsByTagName("Fund");
            XmlNodeList positionsXml = xml.GetElementsByTagName("Position");

            Funds     = new Dictionary <StatementFundType, decimal>(fundsXml.Count);
            Positions = new Dictionary <FixmlInstrument, PosQuantity>(positionsXml.Count);
            foreach (XmlElement elem in fundsXml)
            {
                StatementFundType key;
                try { key = StatementFundUtil.Read(elem, "name"); }
                catch (FixmlException e) { e.PrintWarning(); continue; }
                decimal value = FixmlUtil.ReadDecimal(elem, "value");
                Funds.Add(key, value);
            }
            foreach (XmlElement elem in positionsXml)
            {
                FixmlInstrument key    = FixmlInstrument.FindById(FixmlUtil.ReadString(elem, "Isin"));
                int             acc110 = FixmlUtil.ReadInt(elem, "Acc110");
                int             acc120 = FixmlUtil.ReadInt(elem, "Acc120", true) ?? 0;
                Positions.Add(key, new PosQuantity(acc110, acc120));
            }
            // nie zaszkodzi się upewnić - czy to, co NOL3 podesłał, stanowi jakąś integralną całość...
            // (i czy ja w ogóle słusznie zakładam, jakie powinny być zależności między tymi wartościami)
            // - dla rachunku akcyjnego:
            if (CheckFundsSum(StatementFundType.CashReceivables, StatementFundType.Cash, StatementFundType.Receivables))
            {
                CheckFundsSum(StatementFundType.PortfolioValue, StatementFundType.CashReceivables, StatementFundType.SecuritiesValue);
            }
            // - dla rachunku kontraktowego:
            if (CheckFundsSum(StatementFundType.Deposit, StatementFundType.DepositBlocked, StatementFundType.DepositFree))
            {
                CheckFundsSum(StatementFundType.PortfolioValue, StatementFundType.Cash, StatementFundType.CashBlocked, StatementFundType.Deposit);
            }
        }