protected override void ParseXmlMessage(string name)
 {
     base.ParseXmlMessage(MsgName);
     UserReqID  = FixmlUtil.ReadUInt(xml, "UserReqID");
     Username   = FixmlUtil.ReadString(xml, "Username", true);
     Status     = UserStatUtil.Read(xml, "UserStat");
     StatusText = FixmlUtil.ReadString(xml, "UserStatText", true);
 }
        public static StatementFundType Read(XmlElement xml, string name)
        {
            string str = FixmlUtil.ReadString(xml, name, true);

            if (!dict.ContainsKey(str))
            {
                throw new FixmlException(string.Format("Unknown StatementFundType: '{0}'", str));
            }
            return(dict[str]);
        }
Example #3
0
        public static BizMsgRejectReason Read(XmlElement xml, string name)
        {
            int number = FixmlUtil.ReadInt(xml, name);

            if (!Enum.IsDefined(typeof(BizMsgRejectReason), (BizMsgRejectReason)number))
            {
                FixmlUtil.Error(xml, name, number, "- unknown BizRejectReason");
            }
            return((BizMsgRejectReason)number);
        }
        public static UserStatus Read(XmlElement xml, string name)
        {
            int number = FixmlUtil.ReadInt(xml, name);

            if (!Enum.IsDefined(typeof(UserStatus), (UserStatus)number))
            {
                FixmlUtil.Error(xml, name, number, "- unknown UserStatus");
            }
            return((UserStatus)number);
        }
Example #5
0
        public static OrderSide Read(XmlElement xml, string name)
        {
            char ch = FixmlUtil.ReadChar(xml, name);

            if (!Enum.IsDefined(typeof(OrderSide), (OrderSide)ch))
            {
                FixmlUtil.Error(xml, name, ch, "- unknown OrderSide");
            }
            return((OrderSide)ch);
        }
Example #6
0
        public static BizMsgReferenceMsgType Read(XmlElement xml, string name)
        {
            string str = FixmlUtil.ReadString(xml, name);

            if (!dict.ContainsKey(str))
            {
                FixmlUtil.Error(xml, name, str, "- unknown BizReferenceMsgType");
            }
            return(dict[str]);
        }
Example #7
0
        public static MDRejectReason Read(XmlElement xml, string name)
        {
            char ch = FixmlUtil.ReadChar(xml, name);

            if (!Enum.IsDefined(typeof(MDRejectReason), (MDRejectReason)ch))
            {
                FixmlUtil.Error(xml, name, ch, "- unknown MDRejectReason");
            }
            return((MDRejectReason)ch);
        }
Example #8
0
 protected override void ParseXmlMessage(string name)
 {
     base.ParseXmlMessage(MsgName);
     RequestId = FixmlUtil.ReadUInt(xml, "ReqID");
     SessionId = FixmlUtil.ReadString(xml, "SesID", true);
     try { SessionPhase = TrdgSesPhaseUtil.Read(xml, "SesSub"); }
     catch (FixmlException e) { e.PrintWarning(); }
     try { SessionStatus = TrdgSesStatusUtil.Read(xml, "Stat"); }
     catch (FixmlException e) { e.PrintWarning(); }
     RejectReason = TrdSesStatRejRsnUtil.Read(xml, "StatRejRsn");
     Instrument   = FixmlInstrument.Read(xml, "Instrmt");
 }
Example #9
0
        protected override void ParseXmlMessage(string name)
        {
            base.ParseXmlMessage(MsgName);
            RequestId = FixmlUtil.ReadInt(xml, "MDReqID");
            List <MDEntry> list = new List <MDEntry>();

            foreach (XmlElement inc in xml.GetElementsByTagName("Inc"))
            {
                list.Add(new MDEntry(inc));
            }
            Entries = list.ToArray();
        }
        public static OrdTimeInForce?Read(XmlElement xml, string name)
        {
            char?ch = FixmlUtil.ReadChar(xml, name, true);

            if (ch == null)
            {
                return(null);
            }
            if (!Enum.IsDefined(typeof(OrdTimeInForce), (OrdTimeInForce)ch))
            {
                FixmlUtil.Error(xml, name, ch, "- unknown OrdTimeInForce");
            }
            return((OrdTimeInForce)ch);
        }
        public static OrdRejectReason?Read(XmlElement xml, string name, bool optional)
        {
            int?number = FixmlUtil.ReadInt(xml, name, optional);

            if (number == null)
            {
                return(null);
            }
            if (!Enum.IsDefined(typeof(OrdRejectReason), (OrdRejectReason)number))
            {
                FixmlUtil.Error(xml, name, number, "- unknown OrderRejectReason");
            }
            return((OrdRejectReason)number);
        }
        public static ExecReportType?Read(XmlElement xml, string name, bool optional)
        {
            char?ch = FixmlUtil.ReadChar(xml, name, optional);

            if (ch == null)
            {
                return(null);
            }
            if (!Enum.IsDefined(typeof(ExecReportType), (ExecReportType)ch))
            {
                FixmlUtil.Error(xml, name, ch, "- unknown ExecType");
            }
            return((ExecReportType)ch);
        }
Example #13
0
        public static ExecReportStatus?Read(XmlElement xml, string name, bool optional)
        {
            string str = FixmlUtil.ReadString(xml, name, optional);

            if (str == null)
            {
                return(null);
            }
            if (!dict.ContainsKey(str))
            {
                throw new FixmlException(string.Format("Unknown OrderStatus: '{0}'", str));
            }
            return(dict[str]);
        }
Example #14
0
        public static TrdSesStatRejectReason Read(XmlElement xml, string name)
        {
            int?number = FixmlUtil.ReadInt(xml, name, true);

            if (number == null)
            {
                return(TrdSesStatRejectReason.None);
            }
            if (!Enum.IsDefined(typeof(TrdSesStatRejectReason), (TrdSesStatRejectReason)number))
            {
                FixmlUtil.Error(xml, name, number, "- unknown TrdSesStatRejectReason");
            }
            return((TrdSesStatRejectReason)number);
        }
Example #15
0
        protected override void ParseXmlMessage(string name)
        {
            base.ParseXmlMessage(MsgName);
            OrigTime = FixmlUtil.ReadString(xml, "OrigTm");
            Headline = FixmlUtil.ReadString(xml, "Headline");
            StringBuilder sb = new StringBuilder();

            foreach (XmlElement elem in xml.GetElementsByTagName("TxtLn"))
            {
                if (sb.Length > 0)
                {
                    sb.AppendLine();
                }
                sb.Append(FixmlUtil.ReadString(elem, "Txt").TrimEnd());
            }
            Text = sb.ToString();
        }
        public static FixmlInstrument Read(XmlElement parent, string name)
        {
            XmlElement elem = parent.SelectSingleNode("Instrmt") as XmlElement;

            if (elem == null)
            {
                return(null);
            }
            string sym = FixmlUtil.ReadString(elem, "Sym");
            string id  = FixmlUtil.ReadString(elem, "ID");
            char   src = FixmlUtil.ReadChar(elem, "Src");

            if (src != isinSrc)
            {
                throw new FixmlException("Unsupported SecurityIdSource: " + src);
            }
            return(Find(sym, id));
        }
Example #17
0
 protected override void PrepareXmlMessage(string name)
 {
     base.PrepareXmlMessage("OrdCxlReq");
     xml.SetAttribute("ID", OrderCancelId);
     if (ClientOrderId != null)
     {
         xml.SetAttribute("OrigID", ClientOrderId);
     }
     if (BrokerOrderId != null)
     {
         xml.SetAttribute("OrdID", BrokerOrderId);
     }
     if (BrokerOrderId2 != null)
     {
         xml.SetAttribute("OrdID2", BrokerOrderId2);
     }
     if (Account != null)
     {
         xml.SetAttribute("Acct", Account);
     }
     if (Instrument != null)
     {
         Instrument.Write(xmlDoc, xml, "Instrmt");
     }
     if (Side != null)
     {
         xml.SetAttribute("Side", OrderSideUtil.Write(Side));
     }
     if (CreateTime != null)
     {
         xml.SetAttribute("TxnTm", FixmlUtil.WriteDateTime((DateTime)CreateTime));
     }
     if (Quantity != null)
     {
         AddElement(xml, "OrdQty").SetAttribute("Qty", Quantity.ToString());
     }
     if (Text != null)
     {
         xml.SetAttribute("Txt", Text);
     }
 }
 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);
 }
Example #19
0
        public static TradingSessionPhase Read(XmlElement xml, string name)
        {
            string str = FixmlUtil.ReadString(xml, name, true);

            if (str == null)
            {
                return(TradingSessionPhase.Unknown);
            }
            uint number;

            if (uint.TryParse(str, out number))
            {
                if (Enum.IsDefined(typeof(TradingSessionPhase), (TradingSessionPhase)number))
                {
                    return((TradingSessionPhase)number);
                }
            }
            if (!dict.ContainsKey(str))
            {
                FixmlUtil.Error(xml, name, str, "- unknown TradingSessionPhase");
            }
            return(dict[str]);
        }
Example #20
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);
            }
        }
 protected override void ParseXmlMessage(string name)
 {
     base.ParseXmlMessage(MsgName);
     // NOL3 w razie problemów czasem zwraca tutaj ujemną wartość -1
     RequestId = FixmlUtil.ReadInt(xml, "ReqID");
 }
 protected override void PrepareXmlMessage(string name)
 {
     base.PrepareXmlMessage("Order");
     xml.SetAttribute("ID", ClientOrderId);
     if (TradeDate != null)
     {
         xml.SetAttribute("TrdDt", FixmlUtil.WriteDate((DateTime)TradeDate));
     }
     if (Account != null)
     {
         xml.SetAttribute("Acct", Account);
     }
     if (MinimumQuantity != null)
     {
         xml.SetAttribute("MinQty", FixmlUtil.WriteDecimal(MinimumQuantity));
     }
     if (DisplayQuantity != null)
     {
         AddElement(xml, "DsplyInstr").SetAttribute("DisplayQty", FixmlUtil.WriteDecimal(DisplayQuantity));
     }
     if (Instrument != null)
     {
         Instrument.Write(xmlDoc, xml, "Instrmt");
     }
     if (Side != null)
     {
         xml.SetAttribute("Side", OrderSideUtil.Write(Side));
     }
     xml.SetAttribute("TxnTm", FixmlUtil.WriteDateTime(CreateTime));
     AddElement(xml, "OrdQty").SetAttribute("Qty", Quantity.ToString());
     xml.SetAttribute("OrdTyp", OrderTypeUtil.Write(Type));
     if (Price != null)
     {
         xml.SetAttribute("Px", FixmlUtil.WriteDecimal(Price));
     }
     if (StopPrice != null)
     {
         xml.SetAttribute("StopPx", FixmlUtil.WriteDecimal(StopPrice));
     }
     if (Currency != null)
     {
         xml.SetAttribute("Ccy", Currency);
     }
     xml.SetAttribute("TmInForce", OrdTmInForceUtil.Write(TimeInForce));
     if (ExpireDate != null)
     {
         xml.SetAttribute("ExpireDt", FixmlUtil.WriteDate((DateTime)ExpireDate));
     }
     if (TriggerPrice != null)
     {
         XmlElement el = AddElement("TrgrInstr");
         el.SetAttribute("TrgrTyp", TriggerType.ToString());
         el.SetAttribute("TrgrActn", TriggerAction.ToString());
         el.SetAttribute("TrgrPx", FixmlUtil.WriteDecimal(TriggerPrice));
         el.SetAttribute("TrgrPxTyp", TriggerPriceType.ToString());
     }
     if (DeferredPaymentType != null)
     {
         xml.SetAttribute("DefPayTyp", DeferredPaymentType.ToString());
     }
 }