Carries out actions after a new contract has been activated on this account - the contract template is upgraded to a new version.
xxxxxxxxxx
from contracts_api import (
AccountNotificationDirective,
ConversionHookArguments,
ConversionHookResult,
Tside,
)
api = "4.0.0"
version = "1.0.0"
tside = Tside.ASSET
notification_types = ["conversion_notification"]
def conversion_hook(vault, hook_arguments: ConversionHookArguments):
effective_datetime = hook_arguments.effective_datetime
notification_directive = AccountNotificationDirective(
notification_type="conversion_notification",
notification_details={
"Conversion timestamp": f"{effective_datetime}",
"Account ID": f"{vault.account_id}",
},
)
return ConversionHookResult(account_notification_directives=[notification_directive])