You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following the initial contribution and subsequent feedback, further work has been conducted on optimizing the Standardized Schedule method. New features have been introduced to enhance the model, which can be categorized into three main areas:
Model Stability Conditions
Code Optimization
Cosmetic Changes
CDM Documentation
1. Model Stability Conditions
The method employs functions that extract the necessary information to calculate the initial margin based on inputs and perform the relevant calculations according to the initial margin model. To ensure that the outputs of these functions are coherent and meaningful form a business perspective, conditions have been created to act as checkers.
An analysis of the functions was conducted to determine the required conditions. After applying the conditions, they were tested using both positive and negative samples to validate that warnings are triggered when conditions are not met. Furthermore, to enhance security, conditions were applied to the types, providing a double layer of security. If an error occurs, the conditions within the functions will detect it, and the types will also identify it.
Below are the key functions and types of the model, along with the reasoning for whether a condition was applied or not.
1.1. Standardised Schedule Asset Class Function
func StandardizedScheduleAssetClass: <"Identifies the asset class of a trade from qualifying functions, according to the standardized schedule classification.">
The qualifying functions within this function are assumed to operate as expected and correctly extract the asset class from the trade, following the standardized Schedule methodology. Since the asset class is a mandatory field and its output is restricted to a specific enumeration (StandardizedAssetClassEnum), no condition is necessary.
1.2. Standardised Schedule Product Class Function
func StandardizedScheduleProductClass: <"Identifies the product class of a trade from qualifying functions, according to the standardized schedule classification.">
Similarly, it is assumed that the qualifying functions behave as expected. The product class is mandatory and must be part of the StandardizedScheduleProductClassEnum, no condition is necessary.
1.3. Standardised Schedule Notional Function
func StandardizedScheduleNotional: <"Extracts the notional amount of a trade, according to the product class-depending extraction method defined in the ISDA industry survey.">
Based on ISDA’s survey results regarding notional amounts for initial margin calculations, this function extracts the notional value once the product class is identified. It is essential to ensure that the notional amount is a positive number.
Notional Condition
post-condition PositiveNotional: <"Ensure notional is greater than 0">
notional > 0
1.4. Standardized Schedule Notional Currency Function
func StandardizedScheduleNotionalCurrency: <"Extracts the notional currency of a trade, according to the product class-depending extraction method defined in the ISDA industry survey.">
The qualifying functions for each product are assumed to perform as expected. The currency extracted from trade must be valid according to ISO 4217 standards.
Currency Condition
post-condition ValidCurrency: <"Ensure Currency is an ISO 3-Letter Currency Code ">
notionalCurrency to-enum ISOCurrencyCodeEnum exists
1.5. Standardized Schedule Duration Function
func StandardizedScheduleDuration: <"Extracts the duration of a trade, according to the product class-depending extraction method defined in the ISDA industry survey.">
The duration is crucial for calculating the initial margin, and it is derived from the effective and termination dates, except for options, where the expiration date is used. Verifying the accuracy of the duration is essential.
Duration Condition
post-condition PositiveDuration: <"Ensure duration is greater than 0.">
durationInYears > 0
1.6. Get Standardized Schedule Margin Rate Function
func GetStandardizedScheduleMarginRate: <"Computes the margin rate, which is required in the calculation of the gross initial margin. It depends exclusively on the asset class of the trade and, in some cases, on the duration as well.">
The margin rate is expected to range between 1% and 15%. Since the function is designed to prevent values outside this range, no additional conditions is necessary.
1.7. Get Gross Initial Margin From Standardized Schedule Function
func GetGrossInitialMarginFromStandardizedSchedule: <"Takes the grid information from an specific trade and calculates the gross initial margin.">
The function calculates the gross initial margin, which must always be greater than 0.
Gross Initial Margin Condition
post-condition PositiveGrossInitialMargin: <"Ensure gross initial margin is greater than 0">
grossInitialMargin -> value > 0
1.8. Get Initial Margin From Exposure Function
func GetNetInitialMarginFromExposure: <"Computes the net initial margin, taking the gross initial margin result and the mark to market value for each trade in the portfolio.">
The net initial margin must be a non-negative value, and all trades within the portfolio must be converted to a single currency.
Net Initial Margin Condition
post-condition NonNegativeNetInitialMargin: <"Ensure net initial margin is non-negative">
initialMargin -> netInitialMargin -> value >= 0
Total Gross Initial Margin Condition
post-condition TotalGIMAddition: <"Ensure that only a single currency exists">
tradeInitialMargin -> grossInitialMargin -> unit -> currency distinct count = 1
NGR Addition
post-condition NGRAddition: <"Ensure that only a single currency exists">
tradeInitialMargin -> markToMarketValue -> unit -> currency distinct count = 1
1.9. Standardized Schedule Type
The StandardizedSchedule type is used within the functions BuildStandardizedSchedule , which takes a trade and uses qualification to extract the relevant information to populate the grid used to calculate the gross initial margin, and GetGrossInitialMarginFromStandardizedSchedule , which takes the grid information from a specific trade and calculates the gross initial margin. This table contains the following fields: assetClass , productClass , notional , notionalCurrency , and durationInYears .
As outlined in sections 1.1 and 1.2 of this document, no conditions are required for assetClass and productClass . However, both the notional and durationInYears fields must contain positive values, and the notionalCurrency must be valid. Accordingly, the following conditions have been defined.
Notional Condition
condition PositiveNotional: <"Ensure notional is greater than 0">
notional > 0
Currency Condition
condition ValidCurrency: <"Ensure Currency is an ISO 3-Letter Currency Code ">
notionalCurrency to-enum ISOCurrencyCodeEnum exists
Duration Condition
condition PositiveDuration: <"Ensure duration is greater than 0.">
durationInYears > 0
1.10. Standardized Schedule Trade Info Type
The StandardizedScheduleTradeInfo type is used within the GetNetInitialMarginFromExposure function. This function computes the net initial margin by taking the gross initial margin result and the mark-to-market value for each trade in the portfolio.
Therefore, it is necessary to ensure that the previously calculated gross initial margin is positive and that the entire portfolio is in a single currency.
Gross Initial Margin Condition
condition PositiveGrossInitialMargin: <"Ensure gross initial margin is greater than 0">
grossInitialMargin -> value > 0
Single Currency Condition
condition SameCurrencies: <"Ensure that only a single currency exists">
grossInitialMargin -> unit -> currency = markToMarketValue -> unit -> currency
1.11. Standardized Schedule Initial Margin Type
The StandardizedScheduleInitialMargin type is used within the GetNetInitialMarginFromExposure function, which computes the net initial margin by taking the gross initial margin result and the mark-to-market value for each trade in the portfolio. The output from this function is the net initial margin, which has the type StandardizedScheduleInitialMargin and cannot be negative under any circumstances.
Net Initial Margin Condition
condition NonNegativeNetInitialMargin: <"Ensure net initial margin is non-negative">
netInitialMargin -> value >= 0
2. Code Optimization
The objective was to avoid repeating the qualifying functions in each of the following functions: StandardizedScheduleAssetClass, StandardizedScheduleProductClass, StandardizedScheduleNotional, StandardizedScheduleNotionalCurrency and StandardizedScheduleDuration .
Instead, the results obtained from the StandardizedScheduleAssetClass and StandardizedScheduleProductClass functions would be utilized to facilitate the calculation of the initial margin.
To improve efficiency, the code was refined by minimizing the repetitive calls to these qualifying functions.
3. Cosmetic Changes
Description of certain functions have been expanded to provide clearer explanations of their functionality. Additionally, the function GetStandardizedScheduleMarginRate (previously named GetIMRequirement) has been renamed for better clarity and precision.
4. CDM Documentation
Documentation about the project has been added to the CDM website, it will be found in the "Use Cases" section. This provides users with detailed information about the project's purpose, methodology, and potential applications.
5. Conclusion
The improvements introduced have made the model more robust. These changes aim to increase code efficiency and facilitate easier maintenance. The expansion of function definitions has enhanced user understanding, and the application of conditions ensures that the data used in each step of the initial margin calculation is accurate, leading to more reliable results.
The text was updated successfully, but these errors were encountered:
Background
Following the initial contribution and subsequent feedback, further work has been conducted on optimizing the Standardized Schedule method. New features have been introduced to enhance the model, which can be categorized into three main areas:
1. Model Stability Conditions
The method employs functions that extract the necessary information to calculate the initial margin based on inputs and perform the relevant calculations according to the initial margin model. To ensure that the outputs of these functions are coherent and meaningful form a business perspective, conditions have been created to act as checkers.
An analysis of the functions was conducted to determine the required conditions. After applying the conditions, they were tested using both positive and negative samples to validate that warnings are triggered when conditions are not met. Furthermore, to enhance security, conditions were applied to the types, providing a double layer of security. If an error occurs, the conditions within the functions will detect it, and the types will also identify it.
Below are the key functions and types of the model, along with the reasoning for whether a condition was applied or not.
1.1. Standardised Schedule Asset Class Function
The qualifying functions within this function are assumed to operate as expected and correctly extract the asset class from the trade, following the standardized Schedule methodology. Since the asset class is a mandatory field and its output is restricted to a specific enumeration (
StandardizedAssetClassEnum
), no condition is necessary.1.2. Standardised Schedule Product Class Function
Similarly, it is assumed that the qualifying functions behave as expected. The product class is mandatory and must be part of the
StandardizedScheduleProductClassEnum
, no condition is necessary.1.3. Standardised Schedule Notional Function
Based on ISDA’s survey results regarding notional amounts for initial margin calculations, this function extracts the notional value once the product class is identified. It is essential to ensure that the notional amount is a positive number.
1.4. Standardized Schedule Notional Currency Function
The qualifying functions for each product are assumed to perform as expected. The currency extracted from trade must be valid according to ISO 4217 standards.
1.5. Standardized Schedule Duration Function
The duration is crucial for calculating the initial margin, and it is derived from the effective and termination dates, except for options, where the expiration date is used. Verifying the accuracy of the duration is essential.
1.6. Get Standardized Schedule Margin Rate Function
The margin rate is expected to range between 1% and 15%. Since the function is designed to prevent values outside this range, no additional conditions is necessary.
1.7. Get Gross Initial Margin From Standardized Schedule Function
The function calculates the gross initial margin, which must always be greater than 0.
1.8. Get Initial Margin From Exposure Function
The net initial margin must be a non-negative value, and all trades within the portfolio must be converted to a single currency.
1.9. Standardized Schedule Type
The StandardizedSchedule type is used within the functions
BuildStandardizedSchedule
, which takes a trade and uses qualification to extract the relevant information to populate the grid used to calculate the gross initial margin, andGetGrossInitialMarginFromStandardizedSchedule
, which takes the grid information from a specific trade and calculates the gross initial margin. This table contains the following fields:assetClass
,productClass
,notional
,notionalCurrency
, anddurationInYears
.As outlined in sections 1.1 and 1.2 of this document, no conditions are required for
assetClass
andproductClass
. However, both thenotional
anddurationInYears
fields must contain positive values, and thenotionalCurrency
must be valid. Accordingly, the following conditions have been defined.1.10. Standardized Schedule Trade Info Type
The
StandardizedScheduleTradeInfo
type is used within theGetNetInitialMarginFromExposure
function. This function computes the net initial margin by taking the gross initial margin result and the mark-to-market value for each trade in the portfolio.Therefore, it is necessary to ensure that the previously calculated gross initial margin is positive and that the entire portfolio is in a single currency.
1.11. Standardized Schedule Initial Margin Type
The
StandardizedScheduleInitialMargin
type is used within theGetNetInitialMarginFromExposure
function, which computes the net initial margin by taking the gross initial margin result and the mark-to-market value for each trade in the portfolio. The output from this function is the net initial margin, which has the typeStandardizedScheduleInitialMargin
and cannot be negative under any circumstances.2. Code Optimization
The objective was to avoid repeating the qualifying functions in each of the following functions:
StandardizedScheduleAssetClass
,StandardizedScheduleProductClass
,StandardizedScheduleNotional
,StandardizedScheduleNotionalCurrency
andStandardizedScheduleDuration
.Instead, the results obtained from the
StandardizedScheduleAssetClass
andStandardizedScheduleProductClass
functions would be utilized to facilitate the calculation of the initial margin.To improve efficiency, the code was refined by minimizing the repetitive calls to these qualifying functions.
3. Cosmetic Changes
Description of certain functions have been expanded to provide clearer explanations of their functionality. Additionally, the function
GetStandardizedScheduleMarginRate
(previously namedGetIMRequirement
) has been renamed for better clarity and precision.4. CDM Documentation
Documentation about the project has been added to the CDM website, it will be found in the "Use Cases" section. This provides users with detailed information about the project's purpose, methodology, and potential applications.
5. Conclusion
The improvements introduced have made the model more robust. These changes aim to increase code efficiency and facilitate easier maintenance. The expansion of function definitions has enhanced user understanding, and the application of conditions ensures that the data used in each step of the initial margin calculation is accurate, leading to more reliable results.
The text was updated successfully, but these errors were encountered: