Beispiel #1
0
        protected override bool IgnoreSql(OpenMarketOperation data, ref string ignoreMessage)
        {
            var issueRate   = float.Parse(data._values[data.getColIdx("issueRate")]);
            var issueVolume = float.Parse(data._values[data.getColIdx("issueVolume")]);

            if (issueVolume == 0 && issueRate == 0)
            {
                ignoreMessage = " <span style=\"background:yellow;\">issueVolume = 0 && issueRate = 0</span> ";
                return(true);
            }
            return(false);
        }
Beispiel #2
0
        protected override bool IgnoreSql(OpenMarketOperation data, ref string ignoreMessage)
        {
            if (!data._ric.Contains("SLO"))
            {
                return(true);
            }
            var issueVolume = float.Parse(data._values[data.getColIdx("IssueVolume")]);
            var yield       = float.Parse(data._values[data.getColIdx("Yield")]);

            if (issueVolume != 0 || yield != 0)
            {
                return(false);
            }
            ignoreMessage = " <span style=\"background:yellow;\"> issueVolume = 0 && yield = 0</span>";
            return(true);
        }
Beispiel #3
0
        public virtual void Init(OpenMarketOperation data, QueueMessageFromRFA message)
        {
            string ignoreMessage = "";
            bool   isIgnore      = IgnoreSql(data, ref ignoreMessage);

            if (isIgnore)
            {
                message.OperationType = "Ignore";
                message.ReturnMessage = ignoreMessage;
                return;
            }

            int idx = data.getColIdx("issueDate");

            bool isExist = OracleHelper.Exists("select count(*) from " + data._tabName + " where ric='" + data._ric + "' and issuedate='" + data._values[idx] + "'");

            if (isExist)
            {
                UpdateSql(data);
                OracleHelper.ExecuteSql(data._bulkSqlStatments.ToString());
                message.OperationType = "Update";
            }
            else
            {
                InsertSql(data);
                OracleHelper.ExecuteSql(data._bulkSqlStatments.ToString());
                message.OperationType = "Insert";
            }
            message.ExecSql       = data._bulkSqlStatments.ToString();
            message.ReturnMessage = " <span style=\"color:green;\">Success!</span>";
        }
Beispiel #4
0
        protected virtual void UpdateSql(OpenMarketOperation data)
        {
            String        seprator = "";
            string        quot     = "";
            StringBuilder sqlCol   = new StringBuilder();

            for (int i = 0; i < data._dataTypes.Count; i++)
            {
                if (sqlCol.Length > 0)
                {
                    seprator = ",";
                }
                if (data._dataTypes[i] == "FLOAT" || data._dataTypes[i] == "INT" || data._values[i] == "null")
                {
                    quot = "";
                }
                else
                {
                    quot = "'";
                }

                sqlCol.Append(seprator + data._colNames[i] + "=" + quot);
                sqlCol.Append(data._values[i].ToString().Trim() + quot);
            }

            sqlCol.Append(seprator + "MODIFYDATE=");
            sqlCol.Append("to_date('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-mm-dd hh24:mi:ss')");

            int    idx = data.getColIdx("issueDate");
            string sql = "update " + data._tabName + " set " + sqlCol.ToString()
                         + " where RIC='" + data._ric + "' and  issuedate='" + data._values[idx] + "'";

            data._bulkSqlStatments.Append(sql);
        }
Beispiel #5
0
        protected override bool IgnoreSql(OpenMarketOperation data, ref string ignoreMessage)
        {
            if (!data._ric.Contains("MLF"))
            {
                return(true);
            }
            var issueVolume    = float.Parse(data._values[data.getColIdx("IssueVolume")]);
            var yield          = float.Parse(data._values[data.getColIdx("Yield")]);
            var residualVolume = float.Parse(data._values[data.getColIdx("ResidualVolume")]);

            if (issueVolume == 0 && yield == 0 && residualVolume == 0)
            {
                ignoreMessage = " <span style=\"color:yellow;\"> issueVolume = 0 && yield = 0 && residualVolume = 0</span>";
                return(true);
            }
            return(false);
        }
Beispiel #6
0
        private void ProcessMarketPrice(RespMsg respMsg)
        {
            Console.WriteLine("<- Received Market Price " + respMsg.RespType.ToString());

            // ==========================================================================
            // Display AttribInfo
            if ((respMsg.HintMask & RespMsg.HintMaskFlag.AttribInfo) != 0)
            {
                if ((respMsg.AttribInfo.HintMask & AttribInfo.HintMaskFlag.ServiceName) != 0)
                {
                    Console.WriteLine("Service name: " + respMsg.AttribInfo.ServiceName.ToString());
                }
                if ((respMsg.AttribInfo.HintMask & AttribInfo.HintMaskFlag.Name) != 0)
                {
                    Console.WriteLine("Symbol name: " + respMsg.AttribInfo.Name.ToString());
                }
            }

            // ==========================================================================
            // Decode Payload
            if ((respMsg.HintMask & RespMsg.HintMaskFlag.Payload) != 0)
            {
                _responseRic = respMsg.AttribInfo.Name.ToString();
                Data payload = respMsg.Payload;
                if (payload.DataType == DataEnum.FieldList)
                {
                    FieldList fieldList = payload as FieldList;
                    //Console.WriteLine("FieldList's entry count: " + fieldList.StandardDataCount);
                    var currentRicType =
                        _rics.Where(re => re.Ric == respMsg.AttribInfo.Name.ToString()).Select(re => re.Rictype).First();
                    OpenMarketOperation bs = new OpenMarketOperation(_fids.Where(re => re.Rictype == currentRicType).Select(re => re.TabName).First());
                    bs.setRic(respMsg.AttribInfo.Name.ToString());

                    if (fieldList != null)
                    {
                        foreach (FieldEntry fieldEntry in fieldList)
                        {
                            var fieldId = fieldEntry.FieldID;
                            try
                            {
                                RDMFidDef fidDef    = _rdmFieldDictionary.GetFidDef(fieldId);
                                Data      dataEntry = fieldEntry.GetData(fidDef.OMMType);
                                if (dataEntry.DataType == DataEnum.DataBuffer)
                                {
                                    if (!_currentFids.Contains(fidDef.Name.ToString()))
                                    {
                                        continue;
                                    }

                                    DataBuffer dataBuffer = dataEntry as DataBuffer;
                                    //Console.Write("\tFieldEntry: {0,-10} {1,-8}\t", fidDef.Name, "(" + fieldId + ")");
                                    if (dataBuffer != null)
                                    {
                                        string fidValue = dataBuffer.GetAsString().ToString();
                                        //Console.WriteLine(fidValue);

                                        var fid =
                                            _fids.First(re => re.Rictype == currentRicType && re.FidName == fidDef.Name);
                                        string colName = fid.ColName;
                                        if (fid.ColName.ToUpper() == "BONDLOCALNAME")
                                        {
                                            RMTESConverter conv = new RMTESConverter();
                                            conv.SetBuffer(dataBuffer.GetBuffer());
                                            // For refresh msg display
                                            fidValue = ToSimplifiedChinese(conv.ToString());
                                        }
                                        if (colName != null)
                                        {
                                            bs.getColIdx(colName);
                                        }
                                        bs.appendColNames(fid.ColName, fid.ColType);
                                        if (fid.ColType == "DATE")
                                        {
                                            fidValue = string.IsNullOrEmpty(fidValue) ? "null" : fidValue.Replace(' ', '-');
                                        }
                                        else if (fid.ColType == "FLOAT")
                                        {
                                            fidValue = string.IsNullOrEmpty(fidValue) ? "0" : float.Parse(fidValue).ToString(CultureInfo.InvariantCulture);
                                        }
                                        else if (fid.ColType == "INT")
                                        {
                                            fidValue = string.IsNullOrEmpty(fidValue) ? "0" : Convert.ToInt32(fidValue).ToString();
                                        }

                                        bs.appendValues(fidValue);
                                    }
                                }
                                if (_responseRic == _requestRic)
                                {
                                    CtrlBreakHandler.SetTerminated(true);
                                }
                            }
                            catch (InvalidUsageException)
                            {
                            }
                        }
                    }
                    ExecuteSqlByRicType(currentRicType, bs);
                }
            }
        }