Secdata, bonddata are two very useful functions in Murex for retrieving security data, date of next coupons, yield to price conversion, etc… The problem is that they’re not always easy to use. So get your documentation nearby as you’ll need it with these functions.
How to use them?
They basically require 3 inputs: (string,date,string). The first string is the description of the security you wish to use: Market and security label most of the time and you need to add the expiry label for futures. You need to separate the market and the security with a comma in the string.
For instance “Market,Label” works, “Market”,”Label” would basically make Murex believe that you’re trying to input “Label” into the date field.
So usually TP_SECMKT+’,’+INSTRUMENT would give you the right argument for the first string.
For the date, that should be no problem! 🙂
For the third one, refer to the documentation and you should be all set.
Alright, so now you have a working secdata (or bonddata) function and it all seems good. Unfortunately it is not so simple and here’s the SECDATA pitfall:
If you call SECDATA or BONDDATA while parsing non security instrument, it will return an error message with something such as XXXX security not found (where XXXX is the label of your instrument). This is especially the case where you have swaps, deposits, anything basically that is not security related.
If you try to use an IIF statement to avoid the problem, the error message will pop up anyway: IIF(TRN_GRP==’BOND’,SECDATA function,0). The reason is that Murex evaluates all arguments of an IIF statement even if the boolean is false.
So, are you doomed with error messages? No! You just need to create another horizontal field which will become the first string argument:
H_SECURITY –> IIF(TRN_GRP==’BOND’,TP_SECMKT+’,’+INSTRUMENT,”).
And then you use the IIF statement again (especially if you need to return something specific when it’s not a security):
So that’s how you can call upon SECDATA and BONDDATA when loading a portfolio not entirely made up of securities. This being said, I would recommend to look at already existing fields in the dynamic table to see if you can do without SECDATA or BONDDATA. Accruals being negative to see if the bond is in ex-div, MP_UPPRC for the current price, etc…
If you faced other problems or if you want to share any other trick with these 2 functions, feel free to!