Ejemplo n.º 1
0
        public string QueryTradesStr(string pUser,
                                     string pPassword,
                                     int pInstitutionID,
                                     DateTime pInitialDate,
                                     DateTime pFinalDate,
                                     ref DateTime pTradeID,
                                     string pTradeStatus,
                                     string pProduct,
                                     string pAfterHour,
                                     string pTraderID)
        {
            try
            {
                TradeProcessor trProc = new TradeProcessor();

                string pwd64 = base64Encode(pPassword);

                if (pUser.Equals(_config.OpenBlotterUsr) == false || pwd64.Equals(_config.OpenBlotterPwd) == false)
                {
                    return("pUser or pPassword is invalid!");

                    //QueryTradesStr1 error = new QueryTradesStr1();
                    //error.pTradeID = pTradeID.ToString("yyyy/MM/dd HH:mm:ss");
                    //error.QueryTradesStrResult = "pUser or pPassword is invalid!";

                    //return error;
                }

                logger.Info("QueryTradesStr(" + pTradeID.ToString("yyyy/MM/dd HH:mm:ss") + ") Inicio");

                string xmlTrades = trProc.GetTrades(pTradeID);

                //string xmlRet = "<QueryTradesStrResponse>";

                //string xmlRet = "<QueryTradesStrResult>";
                //xmlRet += xmlTrades;
                //xmlRet += "</QueryTradesStrResult>";
                //xmlRet += "<pTradeID>";
                //xmlRet += pTradeID.ToString("yyyy/MM/dd HH:mm:ss");
                //xmlRet += "</pTradeID>";
                //xmlRet += "</QueryTradesStrResponse>";

                logger.Debug("XML Trades [" + xmlTrades + "]");

                logger.Info("QueryTradesStr(" + pTradeID.ToString("yyyy/MM/dd HH:mm:ss") + ") FIM");

                return(xmlTrades);

                //QueryTradesStr1 resp = new QueryTradesStr1();
                //resp.pTradeID = pTradeID.ToString("yyyy/MM/dd HH:mm:ss");
                //resp.QueryTradesStrResult = xmlTrades;

                //return resp;
            }
            catch (Exception ex)
            {
                logger.Error("QueryTradesStr: " + ex.Message, ex);
            }

            return("<trades/>");
        }