Skip to content

Commit

Permalink
TH_Valuation_Instruction
Browse files Browse the repository at this point in the history
Native representation and qualification of an update of the valuation.
  • Loading branch information
gtarres committed Nov 29, 2023
1 parent 2407121 commit 9f85549
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
27 changes: 25 additions & 2 deletions rosetta-source/src/main/rosetta/event-common-func.rosetta
Original file line number Diff line number Diff line change
Expand Up @@ -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.">
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions rosetta-source/src/main/rosetta/event-common-type.rosetta
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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.">
Expand Down
10 changes: 10 additions & 0 deletions rosetta-source/src/main/rosetta/event-qualification-func.rosetta
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 9f85549

Please sign in to comment.