Exemple #1
0
        /// <summary>
        /// Gera um subset XML completo com as informacoes deste
        /// </summary>
        /// <returns></returns>
        public string ToXML()
        {
            string response = "";
            string xml      = "<trade>";

            xml += "<SEQUENCIAL>" + this.Sequencial + "</SEQUENCIAL>";
            xml += "<TIPO_BOLETAGEM>" + this.RecordType + "</TIPO_BOLETAGEM>";
            xml += "<CHAVE_ESTRANGEIRA>" + this.Sequencial + "</CHAVE_ESTRANGEIRA>";
            xml += "<NOME_OPERADOR>" + this.NomeOperador + "</NOME_OPERADOR>";
            xml += "<DATA_OPERACAO>" + this.DataOperacao.ToString("yyyy-MM-dd") + "</DATA_OPERACAO>";
            xml += "<NOME_ATIVO>" + this.NomeAtivo.Trim() + "</NOME_ATIVO>";
            xml += "<TIPO_DE_OPERACAO>" + this.TipoOperacao + "</TIPO_DE_OPERACAO>";
            xml += "<QUANTIDADE>" + this.Quantidade + "</QUANTIDADE>";
            xml += "<PRECO>" + this.Preco.ToString(ciEn) + "</PRECO>";
            xml += "<AFTER_HOUR>" + this.AfterHour + "</AFTER_HOUR>";
            xml += "<COD_CORRETORA_BMF_ORIGEM>" + this.CodCorretoraBMFOrigem + "</COD_CORRETORA_BMF_ORIGEM>";
            xml += "<NOME_CORRETORA_ORIGEM>" + this.NomeCorretoraBMFOrigem + "</NOME_CORRETORA_ORIGEM>";
            xml += "<EXERCICIO_OPCAO_BMF>" + this.ExercicioOpcaoBMF + "</EXERCICIO_OPCAO_BMF>";
            xml += "<CNPJ_CLIENTE>" + this.CnpjCliente + "</CNPJ_CLIENTE>";
            xml += "<NOME_CLIENTE>" + this.NomeCliente + "</NOME_CLIENTE>";
            xml += "<EXTERNA>" + this.Externa + "</EXTERNA>";
            xml += "<BROKERAGEM>" + this.Brokeragem + "</BROKERAGEM>";
            xml += "<COD_CORRETORA_BMF_DESTINO>" + this.CodCorretoraBMFDestino + "</COD_CORRETORA_BMF_DESTINO>";
            xml += "<NOME_CORRETORA_DESTINO>" + this.NomeCorretoraBMFDestino + "</NOME_CORRETORA_DESTINO>";
            xml += "<LEILAO_TERMO>" + this.LeilaoTermo + "</LEILAO_TERMO>";
            xml += "<DATA_TERMO>" + this.DataVencimento.ToString("yyyy-MM-dd") + "</DATA_TERMO>";
            xml += "<TRADERID>" + this.TraderID + "</TRADERID>";
            xml += "<TRADERNAME>" + this.TraderName + "</TRADERNAME>";
            xml += "<NUM_CONTA_CLIENTE>" + this.NumContaCliente + "</NUM_CONTA_CLIENTE>";
            xml += "<OBSERVACAO>" + this.Observacao + "</OBSERVACAO>";
            xml += "<DELTA>" + this.Delta + "</DELTA>";
            xml += "<TX_JUROS_LONGO>" + this.ValorFuturoLongo + "</TX_JUROS_LONGO>";
            xml += "<TX_JUROS_CURTO>" + this.ValorFuturoCurto + "</TX_JUROS_CURTO>";
            xml += "<TRADE_TIMESTAMP>" + TradeTimestamp.ToString("yyyy-MM-ddTHH:mm:ss") + "</TRADE_TIMESTAMP>";


            response += xml;
            response += "</trade>";

            return(response);
        }
Exemple #2
0
        /// <summary>
        /// Gera um subset XML completo com as informacoes deste
        /// </summary>
        /// <returns></returns>
        public string ToXML()
        {
            string response = "";
            string xml      = "<trade>";

            xml += "<trade-date>" + TradeDate.ToString("yyyy-MM-dd") + "</trade-date>";
            xml += "<trade-id>" + TradeID + "</trade-id>";

            if ((DMASource != null && DMASource.Length > 0) &&
                (DMATrade != null && DMATrade.Length > 0) &&
                (DMATradeID != null && DMATradeID.Length > 0))
            {
                xml += "<dma>";
                xml += "<dma-source>" + DMASource + "</dma-source>";
                xml += "<dma-trader>" + DMATrade + "</dma-trader>";
                xml += "<dma-trade-id>" + DMATradeID + "</dma-trade-id>";
                xml += "</dma>";
            }
            //else
            //    xml += "<dma/>";

            xml += "<record-type>" + RecordType + "</record-type>";
            xml += "<product-id>" + ProductID + "</product-id>";
            xml += "<market-id>" + MarketID + "</market-id>";
            xml += "<serie>" + Serie + "</serie>";
            xml += "<maturity-date>" + MaturityDate.ToString("yyyy-MM-dd") + "</maturity-date>";
            xml += "<hedge-long-maturity>" + HedgeLongMaturity.ToString("yyyy-MM-dd") + "</hedge-long-maturity>";
            xml += "<trade-timestamp>" + TradeTimestamp.ToString("yyyy-MM-ddTHH:mm:ss") + "</trade-timestamp>";
            //xml += "<trade-timestamp>" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + "</trade-timestamp>";
            xml += "<negotiation-channel>" + NegotiationChannel + "</negotiation-channel>";
            xml += "<after-hours>" + AfterHours.ToString().ToLowerInvariant() + "</after-hours>";
            xml += "<orientation>" + Orientation + "</orientation>";
            xml += "<number-of-contracts>" + NumberOfContracts + "</number-of-contracts>";
            xml += "<price>" + Price.ToString(ciEn) + "</price>";

            if (OptionType != null && OptionType.Length > 0)
            {
                xml += "<option-type>" + OptionType + "</option-type>";
            }

            if (ValReference1 != 0)
            {
                xml += "<val-reference-1>" + ValReference1 + "</val-reference-1>";
            }

            if (ValReference2 != 0)
            {
                xml += "<val-reference-2>" + ValReference2 + "</val-reference-2>";
            }

            if (ValDelta != 0)
            {
                xml += "<val-delta>" + ValDelta + "</val-delta>";
            }

            response += xml;

            if (TradeDetails.Count > 0)
            {
                xml = "<additional-details>";
                foreach (TradeDetail detail in TradeDetails)
                {
                    xml += detail.ToXML();
                }
                xml += "</additional-details>";
            }
            else
            {
                xml = "<additional-details/>";
            }

            response += xml;

            xml  = "<buyer>";
            xml += "<buyer-code>{0}</buyer-code>";
            xml += "<buyer-name>{1}</buyer-name>";
            xml += "</buyer>";

            xml += "<broker>";
            xml += "<broker-code>{2}</broker-code>";
            xml += "<broker-name>{3}</broker-name>";
            xml += "</broker>";

            xml += "<seller>";
            xml += "<seller-code>{4}</seller-code>";
            xml += "<seller-name>{5}</seller-name>";
            xml += "</seller>";

            xml += "<trader>";
            xml += "<trader-code>{6}</trader-code>";
            xml += "<trader-name>{7}</trader-name>";
            xml += "</trader>";

            response += string.Format(xml,
                                      BuyerCode,
                                      BuyerName,
                                      BrokerCode,
                                      BrokerName,
                                      SellerCode,
                                      SellerName,
                                      TraderCode,
                                      TraderName);

            response += "</trade>";

            return(response);
        }