src.cdm.margin.schedule.functions.GetGrossInitialMarginFromStandardizedSchedule.py Maven / Gradle / Ivy
# pylint: disable=line-too-long, invalid-name, missing-function-docstring, missing-module-docstring, superfluous-parens
# pylint: disable=wrong-import-position, unused-import, unused-wildcard-import, wildcard-import, wrong-import-order, missing-class-docstring
from __future__ import annotations
import sys
import datetime
import inspect
from decimal import Decimal
from rosetta.runtime.utils import *
from rosetta.runtime.func_proxy import replaceable, create_module_attr_guardian
from cdm.base.math.Quantity import Quantity
from cdm.margin.schedule.StandardizedSchedule import StandardizedSchedule
from cdm.margin.schedule.functions.GetIMRequirement import GetIMRequirement
__all__ = ['GetGrossInitialMarginFromStandardizedSchedule']
@replaceable
def GetGrossInitialMarginFromStandardizedSchedule(standardizedSchedule: StandardizedSchedule) -> Quantity:
"""
Takes the grid information from an specific trade and calculates the gross initial margin.
Parameters
----------
standardizedSchedule : StandardizedSchedule
Returns
-------
grossInitialMargin : Quantity
"""
self = inspect.currentframe()
initialMarginRequirement = GetIMRequirement(rosetta_resolve_attr(rosetta_resolve_attr(self, "standardizedSchedule"), "assetClass"), rosetta_resolve_attr(rosetta_resolve_attr(self, "standardizedSchedule"), "durationInYears"))
grossInitialMargin = _get_rosetta_object('Quantity', 'value', ((rosetta_resolve_attr(rosetta_resolve_attr(self, "standardizedSchedule"), "notional") * rosetta_resolve_attr(self, "initialMarginRequirement")) * 0.01))
grossInitialMargin = set_rosetta_attr(rosetta_resolve_attr(self, 'grossInitialMargin'), 'unit->currency', rosetta_resolve_attr(rosetta_resolve_attr(self, "standardizedSchedule"), "notionalCurrency"))
return grossInitialMargin
sys.modules[__name__].__class__ = create_module_attr_guardian(sys.modules[__name__].__class__)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy