diff --git a/rosetta-source/src/main/rosetta/event-common-func.rosetta b/rosetta-source/src/main/rosetta/event-common-func.rosetta index de0f6c138d..fea2d69b85 100644 --- a/rosetta-source/src/main/rosetta/event-common-func.rosetta +++ b/rosetta-source/src/main/rosetta/event-common-func.rosetta @@ -1102,6 +1102,24 @@ func Create_Observation: <"Function specification to create an observation that set after: before add after -> observationHistory: instruction -> observationEvent +func Create_Valuation: <"Function specification to incorporate a new assessment of the valuation in the valuation history of a given trade state."> + inputs: + instruction ValuationInstruction (1..1) + before TradeState (1..1) <"Specifies the trade to be updated."> + replace boolean (1..1) <"Specifies whether the previous valuation tracks in the valuation history are removed (True) or kept (False)."> + output: + after TradeState (1..1) <"Specifies the resulting trade state incorporating the valuation update in the valuation history."> + + alias beforeValuationHistory: + if replace = True then [] + else before -> valuationHistory + + set after: before + + set after -> valuationHistory: beforeValuationHistory + + add after -> valuationHistory: instruction -> valuationEvent + func UpdateSpreadAdjustmentAndRateOptions: <"For each of the trade state's price quantity, find a matching price quantity instruction, and call the update function."> inputs: tradeState TradeState (1..1) <"Specifies the trade to be updated."> @@ -2514,10 +2532,15 @@ func Create_TradeState: <"Creates a single trade state by applying primitive ins then indexTransition else Create_Observation(primitiveInstruction -> observation, indexTransition) + alias valuation: + if primitiveInstruction -> valuation is absent + then observation + else Create_Valuation(primitiveInstruction -> valuation, observation, False) + alias stockSplit: if primitiveInstruction -> stockSplit is absent - then observation - else Create_StockSplit(primitiveInstruction -> stockSplit, observation) + then valuation + else Create_StockSplit(primitiveInstruction -> stockSplit, valuation) condition NoSplit: <"The primitive instruction cannot contain a split, as this function is designed to return a single trade state."> primitiveInstruction -> split is absent diff --git a/rosetta-source/src/main/rosetta/event-common-type.rosetta b/rosetta-source/src/main/rosetta/event-common-type.rosetta index f6e544d303..3d3d7927e3 100644 --- a/rosetta-source/src/main/rosetta/event-common-type.rosetta +++ b/rosetta-source/src/main/rosetta/event-common-type.rosetta @@ -83,6 +83,7 @@ type PrimitiveInstruction: <"A Primitive Instruction describes the inputs requir indexTransition IndexTransitionInstruction (0..1) <"Specifies inputs needed to process a Index Transition business event."> stockSplit StockSplitInstruction (0..1) <"Specifies inputs needed to process a Stock Split business event."> observation ObservationInstruction (0..1) <"Specifies inputs needed to process an observation."> + valuation ValuationInstruction (0..1) <"Specifies inputs needed to process an update of a valuation."> type BusinessEvent extends EventInstruction: <"A business event represents a life cycle event of a trade. The combination of the state changes results in a qualifiable life cycle event. An example of a Business Event is a PartialTermination which is a defined by a quantity change primitive event."> [metadata key] @@ -105,6 +106,9 @@ type CounterpartyPositionBusinessEvent: <"A business event represents a life cyc type ObservationInstruction: <"Specifies inputs needed to process an observation."> observationEvent ObservationEvent (1..1) <"Contains all information related to an observation."> +type ValuationInstruction: <"Specifies inputs needed to process a valuation."> + valuationEvent Valuation (1..1) <"Contains all information related to a valuation."> + type ExecutionInstruction: <"Specifies instructions for execution of a transaction, consisting of a product, price, quantity, parties, trade identifier, execution details, and settlement terms."> product Product (1..1) <"Defines the financial product to be executed and contract formed."> priceQuantity PriceQuantity (1..*) <"Defines the prices (e.g. spread, equity price, FX rate), quantities (e.g. currency amount, no. shares) and settlement terms (e.g. initial fee, broker fee, up-front cds payment or option premium settlement) associated with the constituents of the transacted product."> diff --git a/rosetta-source/src/main/rosetta/event-qualification-func.rosetta b/rosetta-source/src/main/rosetta/event-qualification-func.rosetta index 5b572caf9b..c041eb51d2 100644 --- a/rosetta-source/src/main/rosetta/event-qualification-func.rosetta +++ b/rosetta-source/src/main/rosetta/event-qualification-func.rosetta @@ -508,3 +508,13 @@ func Qualify_CorporateActionDetermined: <"The qualification of the ocurrence of businessEvent -> instruction -> primitiveInstruction -> observation -> observationEvent -> corporateAction exists or businessEvent -> instruction -> before -> observationHistory -> corporateAction exists or businessEvent -> after -> observationHistory -> corporateAction exists + +func Qualify_ValuationUpdate: <"The qualification of a valuation update from the fact that the only component is a valuation."> + [qualification BusinessEvent] + inputs: + businessEvent BusinessEvent (1..1) + output: + is_event boolean (1..1) + + set is_event: + businessEvent -> instruction -> primitiveInstruction -> valuation only exists \ No newline at end of file