Search Security with id in history

I have added a Security with ExternalId.of(“ticker”, “ticker1”). Later I changed the security id from “ticker1” to “ticker11” by the following code block.

ExternalIdBundle existingIdBundle = existingSecurity.getExternalIdBundle();
newIdBundle = existingIdBundle.withoutScheme(id.getScheme());
newIdBundle = newIdBundle.withExternalId(id);


Now I could search the security with id “ticker11”. But can I search and find the same security with an id “ticker1” from history in some way?

The SecuritySearchRequest class contains a versionCorrection property which allows this. By default, the versionCorrection is set to “latest-latest”, which will only find the latest stte. If you set the property to a different VersionCorrection object, with a date/time in the past, then you will find the “ticker1” instance.

Can I get clarification on the parameters provided when creating a versionCorrection object like versionAsOf, correctedTo…and How can I get a versionCorrection object from a LocalDate / a date string given?

The instants represent two ways of slicing the data in the database. The correction instant is controlled by the underlying master class, and is always set to the database time when inserting or correcting a piece of information. The version instant can be controlled when making changes.

For example, in the case above, you have two versions of the security. As you are not working with corrections, you can ignore that dimension and set the correction instant to “LATEST”. For the two versions in the database, both will have an instant equal to the the moment when the add/update occurred (unless you take control of the clock or use other master methods). Call these two instants instant1 and instant2.

If your search version instant is before instant1, you get no matches.
If your search version instant is between instant1 and instant2, you get the old version of the security.
If your search version instant is after instant1, you get the latest version of the security.