Pricing Script Lifecycle Events
Download PDF - Pricing Script Lifecycle Events
This document describes the process for applying lifecycle events to Pricing Script products.
A number of Pricing Script lifecycle events are provided out-of-the-box:
• | Physical Delivery |
• | Knock Out |
• | Knock In |
• | Redemption |
• | Structured Event |
Lifecycle events have their own workflow.
It is also possible to create custom lifecycle events.
For customization information, please refer to the Calypso Developer's Guide.
Limitations
OTC products
The Lifecycle Event window is limited to OTC products:
• | ScriptableOTCProduct (Exotic Notes, Pricing Sheet scriptable products) |
Partial Termination is not supported for ScriptableOTCProduct
• | EquityStructuredOption |
Pricing
If a user creates a custom event that spins off a trade or in any other way adds an asset with non zero value, the user should be aware that this custom event logic will not be taken into account when pricing. Pricing physical delivery today is only based on the parameters in the script payoff function call ‘Physical()’, which is priced correctly. All other pricing is based on cashflows.
1. Before you Begin
1.1 LifeCycleEvent Workflow
The lifecycle events have their own workflow, which is static and cannot be changed. Transitions are triggered by the user or a scheduled task, at Execute, Undo Event or Terminate.
You will notice there are three end states. Two end states indicate successful execution.
• | In a normal apply process, the route is from NONE to PROCESSED. |
• | In a normal undo process, the route is from PROCESSED to CANCELLED. |
• | In a failed process where the user manually terminates an event stuck in PENDING or CANCELLING, the LifeCycleEvent object will be set to TERMINATED. |
>> TERMINATED indicates the end state from abnormal activity.
The LifeCycle engine listens for events in "PENDING" and "CANCELLING" status.
Actions NEW and CANCEL initiate the execute and undo processes respectively, and the single action APPLY advances the lifecycle from the working state.
Product Type = ALL - Subtype = ALL
Orig Status | Action | Resulting Status | Use STP | Rules |
---|---|---|---|---|
CANCELLING |
AMEND |
CANCELLING |
false |
|
CANCELLING |
APPLY |
CANCELLED |
false |
|
CANCELLING |
TERMINATE |
TERMINATED |
false |
|
NONE |
NEW |
PENDING |
false |
|
PENDING |
AMEND |
PENDING |
false |
|
PENDING |
APPLY |
PROCESSED |
false |
|
PENDING |
TERMINATE |
TERMINATED | false | |
PROCESSED |
CANCEL |
CANCELLING | false |
1.2 Trade Workflow
Make sure that the following actions are defined in the Trade workflow of the trades using a Pricing Script. They need to have their own workflow with the following actions:
• | KNOCK_IN |
• | UN-KNOCK_IN |
• | EXERCISE |
• | UNEXERCISE |
• | KNOCK_OUT |
• | UN-KNOCK_OUT |
Example for product types ScriptableOTC and EquityStructuredOption:
Orig Status | Action | Resulting Status | Use STP | Rules |
---|---|---|---|---|
EXERCISED |
UNEXERCISE |
VERIFIED |
false |
UnexerciseOption,Reject |
KNOCKED_IN |
UN-KNOCK_IN |
VERIFIED |
false |
UnexerciseOption,Reject |
KNOCKED_OUT |
UN-KNOCK_OUT |
VERIFIED |
false |
UnexerciseOption,Reject |
VERIFIED |
EXERCISE |
EXERCISED |
false |
|
VERIFIED |
KNOCK_IN |
KNOCKED_IN |
false |
|
VERIFIED |
KNOCK_OUT |
KNOCKED_OUT |
false |
1.3 Access Permissions
Access permissions are controlled on 2 levels; whether or not the user can execute/undo the lifecycle event, and then whether the user has permissions to actually apply the actions to the trades (standard Workflow Access permissions).
The following access permission functions are used in the Lifecycle Events window:
• | "ExecuteLifeCycleEvent" - Permission to execute a lifecycle event |
• | "UndoLifeCycleEvent" - Permission to undo a lifecycle event |
If an action cannot be applied to a trade, you can activate the "LifeCycleEventProcessor" debug log level to generate the following type of messages:
"RedemptionTradeEventProcessor-UNEXERCISE not authorised on trade, id = 49852, status=VERIFIED
"
2. Lifecycle Events Configuration
2.1 Trigger Rules Configuration
From the Calypso Navigator, navigate to Configuration > Pricing Script Products > Life Cycle Trigger Rules (menu action lifecycle.rule.LaunchLCTriggerRuleDefinition
) to define map a lifecycle event to a Pricing Script and a trigger.
Sample Life Cycle Trigger Rules window
» | Click ![]() |
Product Type
Payoff - Pricing Script name or (Any) for all.
Event
Event Trigger
» | Click ![]() |
» | Click ![]() |
» | Click ![]() |
2.2 Processor Rules Configuration
From the Calypso Navigator, navigate to Configuration > Pricing Scripts Products > Life Cycle Processor Rules (menu action lifecycle.rule.LaunchLCProcessorRuleDefinition
) to map a lifecycle event to a product and lifecycle event processor.
Sample Life Cycle Processor Rules window
» | Click ![]() |
It bring up the New Rule window, shown below, where a product type, payoff and processor can be selected.
Fill in the necessary information and click Create.
» | Click ![]() |
» | Click ![]() |
» | Click ![]() |
Processor “Bermudan Exercise (Remove Flow)”
This processor will remove the known flow after exercise so that no transfer is generated.
It can be configured as needed on the Bermudan Exercise event for any payoff.
3. Applying Lifecycle Events
You can apply lifecycle events manually using the Lifecycle Events window, or in batch using the EVENT_LIFECYCLE scheduled task.
The Lifecycle events are created by the LifeCycle engine, based on trades, lifecycle trigger Rules, and lifecycle processor rules.
3.1 LifeCycle Engine Configuration
You need to add the LifeCycleEngine to the system using the Engine Manager in Web Admin.
Create a new engine called LifeCycleEventLifeCycleEngine, with class name com.calypso.engine.lifecycle.LifeCycleEngine
.
The LifeCycleEventLifeCycleEngine subscribes to PSEventTrade and PSEventLifecycle events.
The "config" engine parameter is config = LifeCycleEvent.
Add the value "LifeCycleEvent" to the domain "lifeCycleEntityType".
The behavior of the LifeCycle engine may be modified using the following engine parameters.
If a parameter is not available for setup, you can register it in the domain "engineParam".
Parameters | Description |
---|---|
IGNORE_ACTION |
Comma-separated list of trade actions to be ignored by the engine. |
MAX_BATCH_EVENT |
Maximum number of persistent events loaded at one time by an engine in batch mode. The engine will load events in MAX_BATCH_EVENT chunks until all events are processed. Persistent events received after MAX_QUEUE_SIZE is reached will be processed in batch mode. Allows controlling engine memory usage, therefore improving the performance. |
MAX_QUEUE_SIZE |
Maximum number of events buffered on an engine event queue. When this number is exceeded, real time events are discarded and the engine restarts based on the restart timer (TIMEOUT_RESTART), in order to process the unprocessed persistent events using batch mode. This parameter can be useful for controlling the engine’s memory usage. If not set, the default value for this parameter is no limit on queue size. Allows controlling engine memory usage, therefore improving the performance. |
PricingEnv |
Pricing environment used by the engine. If not set, the default Pricing Environment of the user running the engine will be used. Ⓘ [NOTE: If a pricing environment is set on the processing org’s attribute PricingEnv, it will be used instead] |
TIMEOUT_RESTART |
Number of seconds to wait before an engine restarts after MAX_QUEUE_SIZE has been reached. The default value is 3600 seconds (1 hour). |
3.2 Starting the LifeCycle Engine
The LifeCycleEventLifeCycle engine can be started from the Engine Manager in Web Admin.
Please refer to Calypso Web Admin documentation for complete details.
3.3 Lifecycle Events Window
From the Calypso Navigator, navigate to Trade Lifecycle > Pricing Script Products (menu action lifecycle.rule.LaunchLCRuleExecution
) to open the Lifecycle Events window.
When you open the Lifecycle Events window, you will be prompted to specify search criteria.
» | View - Select the view type: |
– | "by Trades" - The lifecycle events are grouped by trade |
– | "by Events" - The lifecycle events are grouped by event |
» | Data - Include Source |
» | Trade - Enter trades IDs as needed, select the trade status, and select a trade filter. |
» | Event - Enter the from and to dates, and select the event type. You can select new events only. |
» | Pricing Environment - Select a pricing environment. |
» | Click OK to load the corresponding events and trades. |
A new Event Process Date and Time field on Lifecycle Events window is also introduced. The default value would be the Current date time when the lifecycle Event window is opened.
When any action (Execute, Undo, Terminate) is executed from the LifeCycle Events Window, the Execution date and time would be the Process date and time.
When Lifecycle events using Scheduled Task EVENT_LIFECYCLE are executed, Process Datetime would be Valuation Datetime while running schedule task.
Applying an Event
To apply an event, select an event and click Execute.
Executing an event will save the event as an object in the database and give it the PROCESSED status. The event will be applied to the corresponding trades.
Canceling an Event
To can cancel an event, select an event and click Undo.
CANCEL is part of the default Lifecycle Event workflow, enabling rollback of an event. If, for example, a physical delivery is undone, the equity trade is canceled and the Lifecycle Event status goes from PROCESSED to CANCELED.
Creating an Event
If event generation fails, or for other reasons a custom event needs to be created, a manual event can be created.
Choose Event > Create to create an event.
Type in the event type, execution date, and trade id of the event that you want to process and hit save. The event will be picked up by the LifeCycleEngine.
3.4 EVENT_LIFECYCLE Scheduled Task
The scheduled task EVENT_LIFECYCLE executes lifecycle events in batch mode.
You may need to add EVENT_LIFECYCLE to the domain "scheduledTask".
4. Lifecycle Events
4.1 Knock Out Event
While processing KnockOut Event, the following Keywords are set with below values:
• | EXERCISED_DATETIME and TerminationTradeDate -> Event Lifecyle window Process Date and time. |
• | TerminationDate -> Maximum of Last Payment date of all known Cash Flows and Process Date. |