+ All Categories
Home > Documents > 1Introduction - Analytical Finance - by Jan...

1Introduction - Analytical Finance - by Jan...

Date post: 11-Jan-2020
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
152
MASTER THESIS-MS-2002-XX Mathematical statistics A COMPARISON OF MARGIN CALCULATION METHODS FOR CONTRACTS ON EXCHANGE TRADED SECURITIES by Mattias Bylund
Transcript

MASTER THESIS-MS-2002-XX

Mathematical statistics

A COMPARISON OF MARGIN CALCULATION METHODS FOR CONTRACTS ON EXCHANGE TRADED SECURITIES

by

Mattias Bylund

Department of MathematicsRoyal Institute of TechnologyS-100 44 Stockholm, Sweden

A COMPARISON OF MARGIN CALCULATION METHODS FOR CONTRACTS ON EXCHANGE TRADED SECURITIES

Mattias Bylund

Abstract

The main objective of this thesis is to analyse methods used by clearing organisations for calculating margin requirements on contract portfolios. Margin requirements are calculated to protect the clearinghouse in case of an unfavourable market outcome. Methods analysed include SPAN, TIMS and OMS II, these are compared with each other theoretically and with the help of simulations. The comparisons are not made to rank the methods but rather to highlight differences between them.

Summary in Swedish

När två parter går in i ett terminskontrakt så tar de på sig skyldigheten att köpa respektive sälja den underliggande varan till det specificerade priset på slutdagen. I fallet med en option så är det utfärdaren som har skyldigheten att köpa respektive sälja den underliggande varan på slutdagen. Detta gör att båda parter har en risk i kontraktet, nämligen risken att motparten inte kan fullfölja sina åtaganden på slutdagen. För att komma runt denna risk så går ett clearinghus in som motpart i alla sådana kontrakt, dvs clearinghuset garanterar att alla kontrakt blir utförda. Clearinghuset tar ut ett säkerhetskrav av alla som har en skyldighet i ett kontrakt, detta för att clearinghuset skall kunna skydda sig självt mot möjliga framtida förluster.

Säkerhetskraven räknas fram med hjälp av en marginalsäkerhets algoritm så som SPAN, TIMS eller OMS. Huvuduppgiften i denna rapport går ut på att jämföra dessa tre algoritmer mot varandra för att se hur de skiljer sig när det gäller att räkna ut marginalsäkerhetskravet. Detta görs både genom en teoretisk analys och med hjälp av simuleringar på ett antal konstruerade testportföljer.

Acknowledgements

I would like to thank my supervisor Erik Aurell, at the Department of Numerical Analysis and Computer Science at the Royal Institute of Technology, for his help with mathematical issues in this thesis.

The thesis has been performed at OM Technology AB and I would therefore like to thank my supervisor Stefan Engström and Sören Widlert at OM, and Bengt Jansson at Stockholmsbörsen for their support and for giving me the opportunity to perform my master thesis at OM Technology AB.

Contents1 INTRODUCTION.........................................................................................................................72 MARGIN METHODS....................................................................................................................8

2.1 Standard Portfolio Analysis of Risk.....................................................................................82.2 Theoretical Intermarket Margining System.......................................................................112.3 OM “Window Method”.....................................................................................................13

3 PORTFOLIO AND CONTRACT VALUATION................................................................................163.1 Formulas used when pricing options.................................................................................16

3.1.1 Black & Scholes.......................................................................................................................163.1.2 Black 76...................................................................................................................................183.1.3 Binomial model for American put...........................................................................................20

3.2 Calculating “risk margin” in each scan point..................................................................223.2.1 Margining contracts in OMS II................................................................................................223.2.2 Margining contracts in SPAN..................................................................................................243.2.3 Margining contracts in TIMS...................................................................................................253.2.4 Comparison..............................................................................................................................25

3.3 Taking correlation into account........................................................................................263.3.1 The Window method................................................................................................................263.3.2 TIMS........................................................................................................................................273.3.3 SPAN.......................................................................................................................................283.3.4 Comparison..............................................................................................................................31

4 ESTIMATING PARAMETERS......................................................................................................324.1 Estimating a valuation interval.........................................................................................324.2 Estimating windows between different underlying securities............................................364.4 SPAN Specific Parameters................................................................................................37

4.4.1 Inter-Month Spread Charge.....................................................................................................374.4.2 Short Option Min. Charge........................................................................................................374.4.3 Inter-Commodity Concession..................................................................................................374.4.4 Delta Spread Ratios..................................................................................................................37

4.5 TIMS Specific Parameters.................................................................................................375.4.1 Futures Spread Margin.............................................................................................................375.4.2 Options Spread Margin............................................................................................................37

5 SIMULATIONS..........................................................................................................................385.1 Simulating risk margin......................................................................................................38

5.1.1 Futures......................................................................................................................................385.1.2 Options.....................................................................................................................................39

5.2 Portfolios with inter month margin...................................................................................405.2.1 Futures......................................................................................................................................405.2.2 Options.....................................................................................................................................43

5.3 Portfolios with contracts on different underlying..............................................................465.3.1 Futures......................................................................................................................................475.3.2 Options.....................................................................................................................................49

6 CONCLUSIONS.........................................................................................................................547 SUGGESTIONS FOR FURTHER INVESTIGATIONS.......................................................................56APPENDIX A....................................................................................................................................57

Glossary......................................................................................................................................57APPENDIX B....................................................................................................................................58

Delivery Margin.........................................................................................................................58APPENDIX C....................................................................................................................................60

Visual Basic Scripts....................................................................................................................60REFERENCES..................................................................................................................................107

1 Introduction

When an option trade is made between a buyer and a seller the buyer receives the right to buy or sell the underlying commodity at the strike price at a given time in the future. On the other hand the seller of the option has made an obligation to buy or sell the underlying commodity at the strike price at a given time in future.

In the case of a forward or future both the buyer and the seller have made an obligation to buy or sell the underlying commodity at a predetermined price at a given time in the future.

In the option case the buyer faces a risk that the seller fails to fulfil his obligation in case of an unfavourable change in the price of the underlying commodity. In the case of a forward or a future both parties faces this risk. Such possible failures give rise to questions about the credit worthiness of the counterparty.

This problem is solved by the existence of a clearinghouse. One of the main functions of the clearinghouse is to guarantee that all contracts traded are honoured. The clearinghouse serves as counterparty in all transactions, that is, the clearinghouse becomes the buyer to every seller, and the seller to every buyer.

Acting as counterparty, and guaranteeing all transactions, the clearinghouse eliminates any questions about credit worthiness of the original counterparty. This also permits a secondary market for the contract to work more efficiently, since a market participant can close a position without recourse to the original counterparty.

However, the clearinghouse will now face the risk that a member or a client may fail to fulfil his obligation in case of an unfavourable change in the price of the underlying commodity. In case of a member failing to fulfil his obligation the clearinghouse is obliged to neutralise the position of the failing member.

To protect the clearinghouse in such cases each participant with an obligation has to pledge collateral. The collateral could be cash, stocks, bonds or other financial instruments. The amounts of collateral to be pledged is called margin requirement.

Important demands on the margin requirement are:

Not too small, since the clearinghouse may then loose money Not too high, since this may discourage trading.

To determine the margin requirement one uses a margin calculation algorithm. There are several algorithms in use by clearinghouses around the globe. Three of these margin calculation procedures are to be analysed in this thesis. These are the most common one, Standard Portfolio Analysis of Risk (SPAN), developed by the Chicago Mercantile Exchange (CME), the Theoretical Intermarket Margining System (TIMS), developed by the Options Clearing Corporation (OCC), and the “Window Method”, developed by OM Technology.

7

Mattias Bylund, 01/03/-1,

2 Margin methods

The ideas of the three algorithms are basically the same. The cost to neutralise an account immediately is the account’s negative market value. If it were possible to close an account in the same time as a member fails to pledge collateral, this negative market value would equal the margin requirement. This is normally not the case, and during the time it takes to neutralise an account, a negative value can increase in a rapidly falling/rising market. This calls for a simulation of the maximal neutralisation cost during a specified time frame. To do these simulations a valuation interval for all option and future series based on historical fluctuations of the underlying instrument is constructed. The valuation interval specifies how much the clearinghouse believes the price of the underlying can change during a one to two days time horizon. Additionally, for option contracts the clearinghouse has to take into consideration possible changes in volatility over the one to two days time. For portfolios containing several instruments one has to take into account the possibility of different price correlation when one adds the margin requirements for each instrument.

To calculate the cost of closing an option position, different pricing formulas are used. These are specified by the clearinghouse using the margining procedure and not by the margining procedure itself. The models used by “Stockholmsbörsen” are:

Black & Scholes Black-76 Binomial model

A further explanation of the pricing formulas and their usage will be presented later on in the beginning of chapter 3.

2.1 Standard Portfolio Analysis of Risk

The Standard Portfolio Analysis of Risk, or SPAN, method is a margining system developed by the Chicago Mercantile Exchange (CME) in 1988. In brief, SPAN calculates worst case loss scenarios on a contract portfolio, adjusting this loss for net premium cost or benefit from liquidating any option position, and finally adjusting for any offsetting profits generated by closely correlated portfolios in other contracts.

In SPAN the valuation interval is divided into 8 possible up or down moves, additionally for each up or down move the volatility can either increase or decrease. This gives us 16 alternative market scenarios to calculate the profit or loss a portfolio will make.

For the first 14 scenarios as shown below, each scenario is specified by an up or down move of volatility combined with no move, or an up or down move of the underlying price. The last 2 scenarios are related to extreme up or down moves of the underlying price. For the first 14 scenarios the full loss is used, for the two last ones only a fraction of the loss is used (usually 35%).

8

Underlying PriceScan Range

VolatilityScan range

CoveredFraction

1 Price unchanged Volatility up 100%2 Price unchanged Volatility down 100%3 Price up 1/3 range Volatility up 100%4 Price up 1/3 range Volatility down 100%5 Price down 1/3 range Volatility up 100%6 Price down 1/3 range Volatility down 100%7 Price up 2/3 range Volatility up 100%8 Price up 2/3 range Volatility down 100%9 Price down 2/3 range Volatility up 100%10 Price down 2/3 range Volatility down 100%11 Price up 3/3 range Volatility up 100%12 Price up 3/3 range Volatility down 100%13 Price down 3/3 range Volatility up 100%14 Price down 3/3 range Volatility down 100%15 Price up extreme move Volatility unchanged 35%16 Price down extreme move Volatility unchanged 35%Table 2.1: SPAN valuation scenarios

Mathematically one can view the risk calculations performed in SPAN as producing the maximum of the expected loss under each of sixteen probability measures. For the first fourteen scenarios the probability measures are point masses at each of the fourteen points in a space of securities prices and volatilities. The case of extreme moves corresponds to taking the convex combination (0.35, 0.65) of the losses at the extreme move point under study and the no move at all point.

The largest loss across these 16 scenarios is the “scanning risk” for the contract. For a portfolio consisting of contracts valued together, the “scanning risk” equals the largest loss given each scenario, added together for each contract. To achieve the total margin requirement this figure is adjusted for inter-month margins, inter-commodity concessions and spot month isolation. These adjustments are done because in calculating the scanning risk one does not take in to account the inter-month spread movements and one assumes perfect correlation between delivery months. The total margin calculation can be written as:

Total Initial Margin = Scanning Risk + Inter-Month Risk – Inter Commodity Spread – Net Option Value1

A description of the ingoing entities follows:

The Net Option Value is only used for equity options also called security style options. The Net Option Value reflects the current market value of the option position(s). Liquidating a long option position will generate a cash equivalent to the current premium, while liquidating a short option position will have a cost equal to the current premium. For a portfolio containing only long positions the Net Option Value will always be at least equivalent to the scanning risk, so no initial margin collateral is required.

1 Note: All three margin methods (SPAN, TIMS and OMS) also handles the risk between exercise and delivery. This is called delivery margin and will be omitted in the analysis. A brief explanation can be found in the appendix.

9

Before we continue with the two last entities let’s look at the scanning risk yet again. The 16 valuation points are used to create a risk array. This risk array is calculated by the clearinghouse. One risk array is calculated for each traded contract at all exchanges cleared by the clearinghouse. In calculating the risk arrays one takes the difference between the original option value (settlement value) and the recalculated option value, given the relevant scenario. The margin for a portfolio of contracts is then determined by multiplying each array value by the contract size. This gives the scanning risk for each contract. The largest loss is determined by adding each scan point value for a contract to the other contracts corresponding scan point value, i.e. scanpoint1(contract1)+scanpoint2(contract2) + scanpoint3(contract3)+… and then taking the maximum value of the 16 values achieved. In SPAN methodology the maximum loss is represented by the largest positive value.

Now, these risk arrays are delivered in a Risk Parameter File together with composite delta. Delta values measure the rate of change of the price of a derivative with the price of the

underlying asset. The delta of a derivative with price f is Δ= ∂ f

∂ S . Future deltas are always 1.0 whereas options deltas range from –1.0 to +1.0 (0 to +1.0 for long calls and 0 to –1.0 for long puts, the opposite holds for short calls and puts). The option deltas are dynamic, i.e. a change in value of the underlying will not only affect the options price but also its delta statistics. The composite deltas are delivered as a probability weighted average of a set of delta values, each of which is calculated under the 16 scenarios above. One can view the composite delta for an options contract as the best estimate of what the contract’s delta will be after the lookahead time has passed. These composite deltas are used in SPAN during the calculation of inter-month spread charges and for inter-commodity credits.

The inter-month risk charge, is used because of the potential for a less than perfect correlation between different delivery dates; i.e. the inter-month risk margin covers the calendar basis risk that may exist for portfolios containing futures and options with different expirations. SPAN identifies the net delta associated for each futures contract or other underlying instrument in which the portfolio has positions. The spreads are then formed using these net deltas according to patterns specified in the SPAN risk parameter file. When spreads are formed, SPAN keeps track, for each tier, which is a set of consecutive future contracts, of how much delta has been consumed by spreading for the tier, and how much remains. Then for each spread formed, a charge is assessed per spread at the specified charge rate for the spread. The inter-month spread charge is then the total of all these charges for a particular combined commodity.

Inter-commodity spread is used to recognise the risk reducing aspects of portfolios containing positions in related instruments. This is so because price movements tend to correlate fairly well between related underlying instruments. Often, as prices of related instruments move, they tend to do so in tandem. It is not probable that one instrument increases in price and another closely related instrument decreases in price at the same time. This leads to the conclusion that gains from held/written positions in one instrument may sometimes offset losses from written/held positions in another related instrument. SPAN identifies the net delta for each contract month, and for the underlying instrument as a whole, and then processes the inter-commodity spread data2 contained in the risk parameter file to form spreads between the combined commodities. The spreads are formed with the use of the deltas a more thorough explanation of this is contained in section 3.3.3.

2 This data contains tiers, credit and in which order the spreads shall be taken.

10

For some portfolios it will be possible to form a multitude of inter-commodity spreads. Highest priority is often given to those spreads that generate the largest monetary value savings and the lowest priority to those that generate the smallest savings. That is, with reference to historical data one sets the order of the spreads so that the ones generating the highest savings comes first in the table and those that generates the lowest savings comes last. If the order of the spreads were not set in the described way the delta could be consumed before the largest offset could be applied. According to what is stated below this would lead to a higher margin requirement. Now each spread generates a percentual saving from the outright margin requirement for the underlying instruments involved. The percentages are applied to these outright requirements and in most cases this results in a lower net requirement for the instrument (the case of no lowered net requirement of course means that the net requirement is the same).

As the total initial margin is calculated SPAN sets the final margin requirement according to the following procedure. The total initial margin (excluding any Net Option Value that may exist) is compared with the Short Option Minimum charge, and then the margin requirement is set to the largest value of these two.

The Short Option Minimum charge is set because of short option positions in extremely deep-out-of-the-money strikes may seem to have little or no risk across the entire scanning range. But if the underlying market condition change sufficiently these options may move into-the-money and generate large loss for the holders of short positions in these options.

One can therefore describe SPAN as the following maximum:

SPANRisk=max (Risk margin+inter-month margin+ inter-commodity spread,Short Option Minimum Margin )+Net Option Value

2.2 Theoretical Intermarket Margining System3

The Theoretical Intermarket Margining System or TIMS method was originally developed 1986 in Chicago by the Options Clearing Corporation (OCC). This is used to calculate margin requirements on its options and futures contracts, comprising a daily mark to market margin (or premium margin that equals the Net Option Value in SPAN) plus a cushion to cover the risk of an adverse price change (risk margin). It also contains a futures spread margin. TIMS organises all classes of options and futures relating to the same underlying asset into class groups and all class groups whose underlying assets exhibit close price correlation into product groups.

In TIMS methodology the valuation interval is divided into ten different valuation points. These consist of five downside values and five upside values. No consideration is taken to the possibility of a change in volatility.

3 Note: TIMS is here described as it is in [6], there may be differences in this method from the original one developed by the OCC in Chicago. Due to difficulties of obtaining any detailed guide to TIMS from the OCC the real TIMS can not be evaluated.

11

Underlying PriceScan Range

1 Price down 5/5 range2 Price down 4/5 range3 Price down 3/5 range4 Price down 2/5 range5 Price down 1/5 range6 Price up 1/5 range7 Price up 2/5 range8 Price up 3/5 range9 Price up 4/5 range10 Price up 5/5 rangeTable 2.2: TIMS valuation scenarios

Equivalently to SPAN the TIMS calculations can be viewed as producing the maximum of the expected loss under each of ten probability measures. For all ten scenarios the probability measures are point masses at each of the ten points in the space of securities prices.

Each scenario is subtracted with the settlement value for the contract. The largest loss across these ten scenarios is the risk margin for the contract. For a portfolio containing different contracts on different underlyings TIMS adds up the values for each class group exactly as SPAN adds its values. If the class group is not part of a bigger product group the maximum loss is taken as the risk margin for the class group. However if the class group is part of a bigger product group and we have offsetting values only a percentage of these (around 30%) are added to the other class group values. Again the largest loss is taken as the product group margin. To provide additional protection in the calculation of risk margin, the value of deep out-of-the-money short call positions at the maximum upside and deep out-of-the-money short put positions at the maximum downside is presumed to be at least a fixed percentage of the margin interval.

The total margin calculation in TIMS consists of:

Total Margin = Futures Spread Margin + Risk Margin + Premium Margin

The futures spread margin covers futures positions, which have been spread between different expiry months. TIMS applies a charge to these spreads to cover any risk involved in these spreads.

Again as in SPAN, the premium margin is the market value of the particular position at the close of business each day. That is the premium margin represents the cost to liquidate a portfolio of positions at current market prices. Premium margin is a credit for the holder of the long position as it represents the proceeds from selling the long position if it were liquidated at the current market price. If the option is in the money then the premium margin also is a credit for the holder of an exercised position, as it then represents the profit which would be derived from acquiring the underlying at the exercise price and selling it. Premium margin is a debit for the holder of the short position as it represents the cost to buy back the short position if it were to be liquidated at the current market price. It is also a debit for the holder of an assigned position as it represents the loss that would occur if the underlying were to be acquired at the current market price and delivered at the exercise price. The premium margin is as in SPAN methodology only calculated for securities style

12

options. For a portfolio consisting of several option contracts the premium margin for each class group is calculated by subtracting the market value of the long positions from the market value of the short positions.

If the risk margin for a particular product group is less than a calculated minimum margin, that is similar to the short option minimum charge in SPAN, for this product group, then this minimum margin is taken as the risk margin. TIMS only compares this minimum margin to the risk margin and not to the total margin.

For a multiple security portfolio the risk and premium margin is calculated in four steps:

1. Calculate separate portfolios2. Calculate total premium margin3. Calculate total risk margin4. Apply offsets to risk margins

2.3 OM “Window Method”

OMS II or the “Window method” or the “Vector method” is the OM risk calculation method for calculating margin requirements. It is included in the risk valuation or RIVA system within OM SECUR. It was constructed in order to handle non-linear instruments in a better way than SPAN or TIMS. OMS II calculates worst case loss scenarios, store these in vectors, adjust for spreading, and adds the vector in a way that takes correlation in to account. This will be described later on in this chapter.

In OMS II the valuation interval is divided into n (normally n=31) possible up or down moves, additionally for each up or down move the volatility can either increase stand still or decrease. This gives us 93 alternative market scenarios (if n=31) to calculate the profit or loss a portfolio will make.

The scenario with no price move at all is the middle scenario and around it there are 15 up and 15 down scenarios (or (n-1)/2 up and (n-1)/2 down scenarios).

Underlying PriceScan Range

VolatilityScan range

1 Price unchanged Volatility down2 Price unchanged Volatility unchanged3 Price unchanged Volatility up4 Price up 1/15 range Volatility down5 Price up 1/15 range Volatility unchanged6 Price up 1/15 range Volatility up7 Price down 1/15 range Volatility down8 Price down 1/15 range Volatility unchanged9 Price down 1/15 range Volatility up10 Price up 2/15 range Volatility down11 Price up 2/15 range Volatility unchanged12 Price up 2/15 range Volatility up13 Price down 2/15 range Volatility down14 Price down 2/15 range Volatility unchanged15 Price down 2/15 range Volatility up. . .

13

. . .

. . .88 Price up 15/15 range Volatility down89 Price up 15/15 range Volatility unchanged90 Price up 15/15 range Volatility up91 Price down 15/15 range Volatility down92 Price down 15/15 range Volatility unchanged93 Price down 15/15 range Volatility up

Table 2.3: OMS valuation scenarios. (n=31)

Yet again, as in both SPAN and TIMS, one can view OMS II mathematically as producing the maximum of the expected loss under each of 93 probability measures. For all 93 scenarios the probability measures are point masses at each of the 93 points in a space of securities prices and volatilities.

Each valuation point is saved in a 3x31 matrix, that is, each row contains a price move and the three volatility fluctuations. The matrix is expanded to a 6x31 matrix so that the case of both a bought and sold contract is represented in the matrix, this because of additional fine-tunings that are available in OMS II. These matrixes are saved for use when margin requirements of portfolios are calculated.

In the case of an account containing positions of two or more types of contracts the risk of the position is the combined risk characteristics of the different contracts registered to the account. To take the offsetting characteristics of the instrument into account one talks about cross margining. The default cross margining divides the positions into one group per underlying. Positions on instruments within the same underlying are said to be totally correlated. The default cross margin can be described as instruments with the same underlying being totally correlated and instruments with different underlying being uncorrelated. During a default cross margin run a portfolio with instruments on the same underlying will add the valuation files pointwise as in SPAN and then take the largest negative value as the margin requirement for the portfolio4. If the portfolio consists of instruments on different underlyings the largest negative value of each valuation file will be added.

However, a method such as default cross margining does not take correlations between different underlyings or different expiry months into consideration. Therefore in OMS II one uses the so-called “Window method” when a portfolio containing instruments on different underlyings or contracts with different expiry months is margined.

In the window method, the different instruments are sorted into a number of groups, called window classes. The window classes have a window size defined in percent. When the percentage goes down the correlation goes up and vice versa, e.g. a window size of 0% means that the instruments in the window class are totally correlated and a window size of 100% means that the instruments in the window class are uncorrelated. There is also a possibility for a window class to be a member of another window class, and in such case creating a tree structure of more complicated correlations. To calculate the margin for a portfolio, the window is moved from left to the right over the entire valuation interval for

4 Note: In OMS II the margin requirement is represented as the largest negative value as opposite to SPAN and TIMS where the largest positive value is taken as the margin, this can however be altered so that the margin requirement is represented as the largest positive value.

14

all window classes, starting with the ones in the bottom of the tree. The window is centred over each valuation point. A margin requirement is calculated at each valuation point where the window is positioned by adding the lowest value for each option position or futures position shown in the window. The total margin requirement will be the largest negative value of all these margin requirements. If there is no negative value this indicates a credit and no margin is required. A more thorough explanation of this will follow in section 3.3.1.

15

3 Portfolio and contract valuation

3.1 Formulas used when pricing options

The use of option pricing formulas when valuing an option contract during the calculation of margin for a portfolio depends heavily on which clearinghouse that is using the margining algorithm. Since this thesis is performed at OM, the methods described for valuing different options are the ones that are in use by OM, other clearing organisations may use different pricing formulas. As an example, the Options Clearing Corporation, that has developed the TIMS method, uses the Cox-Ross-Rubinstein binomial model for valuing all its contracts.

Product Without dividend With dividend Yield

With discrete Dividend

American call basedon spot

Black & Scholes Binomial Binomial withDividends

American put basedon spot

Binomial if interest rate is non-zeroBlack & Scholes if interest rate is zero

Binomial Binomial withDividends

American opt on realFuture

Binomial if interest rate is non-zeroBlack & Scholes if interest rate is zero

Binomial using r-q when calculating probabilities,And r when discounting backwards in the tree

Binomial withInterest rate r

European opt basedon spot

Black & Scholes Black & Scholes modifiedBy also using q

Discount spot with dividends, then useBlack & Scholes

European opt basedon future

Black – 76 Black – 76 (no q) Black –76

Table 3.1: Option valuation formulas, (for description se appendix)

3.1.1 Black & Scholes

The Black & Scholes model is used to set theoretical prices on European put and call options.

In the Black & Scholes model one assumes two securities: B the price process of a risk free asset and S the price process of a stock. These processes are assumed to follow a system of stochastic differential equations:

{dB ( t )=rB ( t )dt ¿¿¿¿Where r , μ , σ are real constants.

Now suppose that f ( t )=F (t , St ) is the price of some derivative contingent on S at time t. Let us construct a self financing portfolio I consisting of the stock S and the derivative f and then using the Itô formula.

16

dI=α df +β dS={ Itô }=

=α (( f t+μSf S+12

σ2S2 f SS)dt+σ Sf S dW )+β ( μ Sdt+σ SdW )

=α (f t+μ Sf S+12

σ2 S2 f SS)dt+ βμ Sdt+(αf S+β )σ SdW

Now assuming that the portfolio I is riskless; i.e. β=−αf S , so that

dI=α ( f t+μ Sf S+12

σ2 S2 f SS)dt+βμ Sdt

=α (f t+μ Sf S−μ Sf S+12

σ2 S2 f SS)dt

=α (f t+12

σ 2 S2 f SS)dt

If we further assume that the existence of an arbitrage opportunity is precluded, i.e. dI=rIdt , we obtain

dI=r ( αf +βS ) dt=r (αf −α Sf S)dt

We obtain

f t+rSf S+12

σ2 S2 f SS=rf , t <T

f ( t )=F (S ,T )

This is the Black & Scholes differential equation. Solving this equation with f t=max ( S (T )−X ,0 ) for a European call or f t=max ( X−S (T ) ,0 ) for a European put option yields the Black & Scholes formulas for the prices at time zero.

The Black & Scholes prices of a European call option on a non-dividend-paying stock and a European put option on a non-dividend-paying stock are:

c=S0 N (d1)−Xe−rT N (d2)and

p=Xe−rT N (−d2 )−S0 N (−d1)

where

17

d1=ln (S0/ X )+(r+σ 2/2)T

σ √T

d2=ln (S0/ X )+(r−σ2 /2)T

σ √T=d1−σ √T

HereN ( x ) is the cumulative probability distribution function for a variable that is normally

distributed with a mean of zero and a standard deviation of 1.0. S0 is the stock price at time zero, X is the strike price,r is the continuously compounded risk-free rate,σ is the stock price volatility, and T is the time to maturity of the option.

If we replace S0 by S0 e−qtin the above formula we obtain the price, c, of a European call

and the price, p, of a European put on a stock paying a continuous dividend yield at rate q:

c=S0 e−qt N (d1)−Xe−rT N (d2)p=Xe−rt N (−d2)−S0 e−qT N (−d1)

Because

ln ( S0 e−qT

X )=lnS0

X −qT

d1 and d2 are given by

d1=ln ( S0/ X )+(r−q+σ2/2 )Tσ √T

d2=ln ( S0/ X )+(r−q−σ2 /2)Tσ √T

=d1−σ √T

3.1.2 Black 76

European futures options can be valued with the Black 76 model. The underlying assumption is that futures prices have the same log-normal property that we assumed for stocks above.

Let the future price follow the process:

dF=μ Fdt+σ FdW

Consider the portfolio consisting of in the option and in the future. Let’s define V as the value of the portfolio. Because it costs nothing to enter into a futures contract,

V=αf

Define dW as the total change in wealth of the portfolio holder in time dt. We get:

18

dW =α df +βdS= {Itô }=

=α (( f t+μ Ff F+12

σ 2 F2 f FF )dt +σ Ff F dW )+β ( μFdt +σ FdW )

=α (f t+μ Ff F+12

σ2 F2 f FF)dt+βμ Fdt+(αf F+β )σ SdW

Now (as in section 3.2.1) assuming that the portfolio I is riskless; i.e. β=−αf F , so that

dW =α ( f t+μ Ff F+12

σ2 F2 f FF)dt+ βμFdt

=α (f t+μ Ff F−μ Ff F+12

σ2 F2 f FF )dt

=α (f t+12

σ 2F2 f FF)dt

This is riskless. Hence it must also be true that

dW =rVdt

Using V=αf we obtain

dW =rα fdt

Finally we arrive at a differential equation satisfied by a derivative dependent on a futures price.

f t+12

σ2 F2 f FF=rf

Solving this differential equation for a European call or put option on a future gives us the following price formulas:

c=e−rT ( F0 N (d1)−XN (d2 ))p=e−rT ( XN (−d2 )−F0 N (−d1))

where the stock price S0 is replaced by the futures price F0 and

d1=ln( F0 / X )+(σ2 /2 )Tσ √T

d2=ln( F0 / X )−(σ 2/2)Tσ √T

=d1−σ √T

19

3.1.3 Binomial model for American put

The Binomial model is used to price an American put option on a stock.

To derive the binomial model first consider a one period binomial model.In this model we have one risk free paper and one risky asset.

Consider the assets at time t=0;

Risk free paper

B0=bB1=(1+r ) b

Risky asset

S0=SS1=¿ {uS0 with prob . p ¿¿¿¿

¿

Where Bi = bond price at time i, Si = stock price at time i, r = interest rate, u and d = upward or downward movement in one time step.

We assume that the interest rate is constant and positive. Letting R=1+r we require u>r>d. If these inequalities did not hold, there would be profitable riskless arbitrage opportunities involving only the stock and riskless borrowing and lending. To see how to value a put on this stock, we start with the simplest situation: The expiration date is just one period away. Let f be the current value of the put, fd be its value at the end of the period if the stock price goes to uS, and fd be its value at the end of the period if the stock price goes to dS. We now know that fu=max[0,K-uS] and fd=max[0,K-dS].

Suppose we form a portfolio containing shares of stock and B amount in riskless bonds. This will cost S+B. At the end of the period, the value of the portfolio will be:

S1 Δ+B1

We can choose and B in any way we wish, so let’s choose them to equate the end-of-period values of the portfolio and the put for each possible outcome. This requires that

uS Δ+rB=f u

dS Δ+rB= f d

Solving these equations, we find

20

Δ=f u−f d

(u−d ) S

B=uf d−df u

(u−d ) r

To prevent riskless arbitrage opportunities, the current value of the put, f, cannot be less than the current value of the equivalent portfolio, S+B. If it were, we could make a riskless profit with no net investment by buying the call and selling the portfolio. So if there are to be no riskless arbitrage opportunities, it must hold that:

f =SΔ+B

=f u−f d

u−d+

uf d−df u

(u−d )r

=[(r−du−d ) f u+(u−r

u−d ) f d ]1rThis equation can be simplified by defining q≡(r−d ) / (u−d ) , so that 1−q= (u−r ) /(u−d ) and

f =[ qf u+(1−q ) f d ]

Now consider the next simplest situation: a put with two periods remaining before its expiration date.

fuu stands for the value of the put two periods from the current time, fuu and fdd has analogous definitions. At the end of the current period there will be one period left in the life of the put and we will be faced with a problem identical to the one we just solved. Thus from our previous analysis

f u=[qf uu+(1−q ) f ud ]/rf d=[ qf du+(1−p ) f dd ]/r

Again select a portfolio of S in stock and B in bonds whose end-of-period value will be fu

if the stock price goes to uS and fd if the stock price goes to dS. If we continue as for the one step model we arrive at (noting that fdu=fud)

f =[q2 f uu+2q (1−q ) f ud+(1−q )2 f dd ] /r={q2 max [ 0 ,K−u2 S ]+2q (1−q ) max [ 0 , K−duS ]+ (1−q )2 max [0 , K−d2 S ]}/r2

We now have a recursive procedure for finding the value of a put with any number of periods to go. By starting at the expiration day and working backwards, we can write down the general valuation formula for any n:

21

f ={∑j=0

n n!j ! (n− j ) !

q j (1−q )n− j max [0 ,K −u j dn− j S ]}/rn

This however is the case if one cannot exercise the option until the expiry date. In case of an American option one has to consider the possible benefits of early exercise. In such a case the options value in every time step has to be compared to the options intrinsic value. The formula for the value of the option in every time step is:

f i , j=max {X−S0 u j d i− j , e−rΔt [ qf i+1 , j+1+(1−q ) f i+1 , j ]}

3.2 Calculating “risk margin” in each scan point

3.2.1 Margining contracts in OMS II

For forwards the margining formulas are as follows:

RM B=([FP−AB±iV u/d

0 .50 (n−1 ) ]2−CP)⋅CM⋅P

RM S=(CP−[FP+A S±iV u/d

0 . 50 ( n−1 ) ]2)⋅CM⋅P

For futures:

RM B=[± iV u/d

0 .50 (n−1 )−AB ]2⋅CM⋅P

RM S=[±iV u/d

0 .50 (n−1 )−AS ]2⋅CM⋅P

i=0,1,…,15; j=0,1

HereRM B andRM S are required margin for bought respectively sold contracts.The parameters are as follows:

FP is the margin settlement price for the forwardCP is the forward price that applies to the specific dealP equals number of contracts that the portfolio containsCM equals the contract sizeV u/d equals the upward and downward valuation intervalAB/ S equals adjustment held/written, this parameter is used in order to reproduce the bid/ask spread.

For options:

22

RM H=¿{Put (UP±iV u/d

0 .50 (n−1 ), LP , r , q , T ,VOLBP± j

VOu/d

100, DIV )⋅CM⋅P ¿¿¿¿

¿

¿

i=0,1,…,15; j=0,1

HereRM H andRMW are required margin for held respectively written contracts. ThePut ( )andCall ( )expressions equals the option pricing formulas described above with the necessary parameters.

Parameters are as follows:

VOL equals the volatility for the underlying, in OMS this is taken from either ask or bid side depending on if the option is held or written.UP equals the underlying price V u/d equals the upward and downward valuation intervalLP equals the strike price of the optionT equals the time to maturityCM equals the contract sizeP equals number of contracts that the portfolio containsVOu /d equals the possible upside or downside change in volatilityr equals the risk free interest rateq equals dividend yieldDIV equals the discrete dividend It is also possible to make some fine-tunings in the calculation of risk margin in OMS II. These are done when valuing option contracts and exists mainly to avoid valuing held options to high and written options to low. If not stated otherwise these adjustments are unique to OMS II only. If these adjustments are applied the mathematical structure described in section 2.3 and 3.2.4 will not be valid. The adjustment that most obviously breaks the structure is adjustment for the spread between held and written options. Since this adjustment will apply a percentage change to the risk margin.

Reduction of time to maturity for held options. This reduction is done because of the fact that in case of a default situation the clearinghouse has to sell the position. Because of the lead-time the clearinghouse probably will have to sell the option with a shorter time to delivery.

23

A maximum value for the volatility for held options can be applied in order to avoid valuing these options too high. Similarly a minimum volatility can be applied to written options in order to avoid valuing these options too low.

In the case that the volatility for held options is zero then an adjustment for negative time value is applied. This is applied as a factor multiplied with the held option value, factor=market value/theoretical value. The factor is only used if it is less than one. The background to this adjustment is if there exists expected dividends and the system has not taken these in to account. The market takes these expected dividends into account and therefore the price of the option is affected. If OMS II does not recognise these expected dividends, the price may become too high.

An adjustment also made in an almost similar way in TIMS is the adjustment for minimal value. This is done for options that are deeply out-of-the-money, in such a case the theoretical option price formulas do not result in reasonable prices. With the aim not to over-value held options, vector file values for held options that are less than a specific value are set to zero. For the same reasons, vector file values for written options that are less than a given value are set to that value.

Additionally, one does not let the spread between held and written options to become too narrow. One prevents this by comparing vector file values for held and written options in the same valuation point. This adjustment is done because if the clearinghouse has to neutralise a position it has to do so against the bid/ask spread that one assumes exists. So to assure oneself that the bid/ask spread is large enough one implements this adjustment.

3.2.2 Margining contracts in SPAN

In SPAN no consideration is taken to possible spreads between bid and ask prices, the risk parameter files are constructed according to the following pattern:

Futures:

Scan poin t value=± i3⋅Full price move

where i=0,1,2,3

Additionally on the endpoints one sets

Scan point value=±2⋅Full price move⋅0 . 35

For options:

Scan point value=

Settlement value−Call / Put (UP±i3⋅Full price move , LP ,r , q ,T ,VOL±VO

100, DIV )

where i=0,1,2,3

As for futures an extreme move is considered

24

Scan point value=( Settlement value−Call / Put (UP±2⋅Full price move ,LP , r ,q ,T ,VOL ,DIV ))⋅0 .35

Parameters as in OMS II with the exception that the volatility is taken as a mean value from both bid and ask, the volatility interval is the same for upward and downward fluctuations.

All values are then multiplied with the corresponding P and CP

3.2.3 Margining contracts in TIMS

As in SPAN no consideration is taken to possible spreads between bid and ask prices, the theoretical values file are constructed according to the following pattern:

Futures:

Scan poin t valueU /D=± i5⋅Full price move

where i=1,2 , .. . ,5

For options:

Scan point valueU / D=

Call / Put (UP±i3⋅Full price move , LP ,r ,q ,T ,VOL ,DIV )−Settlement value

where i=1,2 , .. . ,5

If we have a call option then for the largest positive price move:

Scan point valueU =max (Scan point valueU ,Short option adjustment )

If we have a put option then for the largest negative price move:

Scan point valueD=max (Scan poin t valueD, Short option adjustment )

Parameters as in OMS II with the exception that the volatility is taken as a mean value from both bid and ask, the volatility interval is the same for upward and downward fluctuations. The Short option adjustment is set by the clearing organisation as a fixed percentage of the margin interval. This short option adjustment is used for short out-of-the-money option positions.

All values are then multiplied with the corresponding P and CP

3.2.4 Comparison

All methods used in the above methods for calculating “risk margin”, “scan risk” or “required margin” are of equal character. We can view them as taking the maximum value of the contract value in different scenarios. Here I use the notation for the risk measures.

25

ρSPAN=

max [SV −V ( X1) , SV−V (X 2) , .. . , SV−V ( X14 ) ,0. 35⋅( SV−V (X15 )) ,0. 35⋅(SV −V (X16 )) ]ρTIMS=max [V (X1 )−SV , V ( X2)−SV ,. .. ,V ( X10 )−SV ]

ρOMS=max [V ( X1) , V ( X2 ) ,. .. ,V ( X93 ) ]

V ( X i )=Valuation of contract in scan poin t i and SV = settlement value for the contract

The difference between ρSPAN and ρTIMS in subtracting SV comes from the methods different definition of long and short contracts. A major difference exists between SPAN and TIMS on one hand and OMS on the other. As is obvious from above OMS does not subtract the settlement value from the theoretical value. SPAN and TIMS starts with the assumption that all options are future style options and adjusts this later on by applying an additional “premium margin” for securities style options. OMS adjusts its calculations after the fine tunigs are done if the option is a future styled one. This is done in the following way, for held future style options the fixing price is subtracted from the margin vector value, for written future style options the fixing price is added to the margin vector value. However this procedure does not contribute to any differences between the achieved “risk margin”. The major important difference between the methods is the number of price scenarios considered, the handling of a possible “extreme” price move and using fluctuations in volatility or not.

Another major difference exists between OMS on one hand and SPAN and TIMS on the other hand. This difference arises from the possibilities of fine-tunings that exist in OMS and the consideration taken to the spread between bid and ask prices.

3.3 Taking correlation into account

When calculating margin for a portfolio containing more than one instrument and then especially instruments with different underlying securities the correlation between the underlying securities have to be considered. Equally when handling instruments with different expiry months the possibility of non-perfect correlation between these months has to be considered. Below follows an explanation on how OMS, SPAN and TIMS perform this.

3.3.1 The Window method

As described before OMS saves all scan point values for each contract in a 3x31 matrix. This matrix comes in handy when a portfolio of instruments is margined. The basics of the “window method” is to handle margin calculations when two or more instruments with underlying securities that have less than 100% and larger than 0% correlation between each other. The windows can also be used to sort the instruments with the same underlying securities but with different expiry months. As said before each window class can be a part of an even larger window class. E.g. instruments with the same underlying securities and expiry dates in September belong to one window class with a size of 0% and instruments with the same underlying securities as before but expiry dates in December belong to

26

another window class with a size of 0%. These window-classes are then part of a window class with size say 10%.

The windows have their size defined in percent. A size of 100% means no correlation and 0% means total correlation. In order to utilise these window sizes in calculations they have to be converted to points instead. The conversion works as follows:

1. Let x=(1−window size/100 )⋅(total number of poin ts−1 )2. Round x to nearest integer

3. Let x=total number of poin ts−x4. If x is even, increment x

This gives us a window size in points. This window is centred over the scan point studied. An example might explain this in a better way:

Example:

Window size = 3 points, number of scan points =5.

Figure 3.1: Example calculation – Window size 3 Points

3.3.2 TIMS

TIMS considers correlation between underlying securities when the risk margin calculations are performed. It is a very simple approach that is used. At the last step of calculating risk margin (or additional margin) for a class group TIMS determines if the class group is part of any larger product group. If this is the case all of the ten class-group risk margin values that represents a credit are multiplied by an offsetting factor. This factor usually is around 30%. The 10 values for each class group contained in the product group is then added as before. This part is used to offset between instruments with different underlying securities where the price between these underlying securities has close price correlation. The factor is applied because one does not want to use all credit since this would indicate total corellation.

27

TIMS also recognises the risk involved when having different expiry months. This however is only done for futures positions. Spreading a net long position in one contract month against a net short position in another contract months does this. A spot or regular margin rate may be charged depending on whether the spread contract involves the spot month. This is done in the following way:

For each class group one calculates the total net long and short future positions. The total spread quantity (both long and short) will equal the lesser of the total net long and total net short quantity. The next step consists of calculating a spot month spread contract quantity. This is done by comparing the contract size of the spoth month against the class group spread long quantity if the spot month is a long position or against the class group spread short quantity if the spot month is a short position. The spoth month quantity is set as the minimum contract size in the calculation. (These calculations are done against netted positions, i.e. a month with 5 written contracts and 2 held contracts is a net long position). The total class group spread quanitity equals the sum of the total spread long and spread short contract quantity. The second step is to calculate a non spot spread quantity: Non Spot Spread Quantity = Total Spread Quantity – Spot Month Spread quantity. The spread margin for the class group is now set according to:

Total class group spread margin requirement=Spot spread rate⋅Total spread quantity+Non−spot spread rate⋅Non−spot spread quantity

3.3.3 SPAN

The method for handling correlation between instruments in SPAN differs from that in OMS and TIMS remarkably. There are two parts in SPAN that takes correlation between instruments into account.

The main part in these correlation calculations is the concept of delta. As described briefly

above the delta of an option is calculated as Δ= ∂ f

∂ S . The delta describes the change in the derivative price due to a change in the underlying securities price. In SPAN the deltas used for a contract is called composite deltas, these deltas are derived as a probability-weighted average of the deltas for the contract in each scan point.

ΔC i=

∂ f Ci

∂ SCi

, i=1 ,. . ., 16

ΔC ,Composite=∑i=1

16

w i ΔC i

The delta weights are set according to the preferences of the clearinghouse. An example of delta weights are the delta weights used by the Sydney Futures Exchange (SFE)

Risk Scenario

Delta weight

Risk Scenario

Delta Weights

1 0,138 9 0,0552 0,138 10 0,055

28

3 0,108 11 0,0184 0,108 12 0,0185 0,108 13 0,0186 0,108 14 0,0187 0,055 15 08 0,055 16 0

Table 3.2: Delta weights used by SFE

The composite deltas are stored and used for calculations on the portfolios as described below.

The inter-month spread charge is used to identify reductions in risk, due to the presence of opposite positions on different months within the same combined commodity. The basic hypothesis used for calculating scanning risk is that futures contracts prices for the various months are perfectly correlated. Therefore SPAN assumes that the risk relative to a long position expressed in delta for a given month is cancelled by a short position expressed in delta for another month. The prices are however not always correlated from one month to another. The gains on a month do not totally offset the losses on another, this gives rise to an inter-month calendar risk. The process handling the spreading is called tiering5. First, for a portfolio SPAN calculates a net delta in the following way.

ΔNet=∑i=1

n

αi Pi Δci

where n = number of contracts in the combined commodity and P is the amount of one contract, is a delta scaling factor. The delta scaling factor is used to take into account relative size differences between two underlying securities. A tier consists of one or more consecutive futures months. For each tier a positive delta and negative delta will be calculated. This is done by summing all positive deltas for the contracts with expiry months that belong to the tier. The same is done for the negative deltas.

ΔPositive , Tier i=∑

j=1

n

ΔjPositive,Tier i , i=1, . .. ,number of tiers

ΔNegative ,Tier i=∑

j=1

n

ΔjNegative ,Tieri , i=1 , .. . ,number of tiers

For a portfolio a required inter-month spreads number is defined. This number gives the order of priority when spreading among the tiers. For a portfolio a delta/spread ratio is also given. The delta/spread ratios are calculated to minimise the standard deviation between movements in the settlement price across the restricted time period.

The charge is now calculated by determining the number of spreads that can be formed and multiplying these spreads with the spread charge for each spread. These spreads are calculated from the positive and negative deltas described above. (See appendix for full algorithmic steps).

5 This is the spreading under the “Table driven” method in SPAN, there are more methods to be used but this is the most common one.

29

M= ∑i=1

No . of spreads

No . of spreads formedi⋅Charg e rate per spreadi

The parameter No. of spreads formed is as can be seen in Appendix C a manipulated minimum delta for the spread.

The second part of correlation calculation in SPAN is the inter-commodity spread credit that is granted in recognition of the fact that offsetting positions in related underlying securities may reduce overall portfolio exposure. This credit is based on the price risk (the risk arising from the variation in underlying contract price) of spread positions. The three key elements of the scanning risk operation are the calculation of futures price risk, volatilty risk, and time risk. To calculate the credit the volatility risk and time risk has to be deduced from the scanning risk, this will yield the futures price risk. SPAN views scanning risk as (this is however only an approximation):

ρScan=ρP rice+ ρVolatility+ ρTime

To determine the volatility risk a paired scenario must be found in the scanning risk, i.e., two scenarios with the same underlying securities price variation, but with opposite volatility variations. Since these calculations only are made on the active scenario (that is the maximum loss scenario) we have to find the paired scenario for the active scenario. The paired scenarios in SPAN are as follows:

Scanning Risk

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Paired Scenario

2 1 4 3 6 5 8 7 10 9 12 11 14 13 15 16

Figure 3.2. SPAN Paired scenarios

Thus if active scenario = 3 then the volatility risk equals

ρVolatility=Scenario 3+Scenario 4

2

The time risk can be inferred in a similar way. Scenarios 1 and 2 do not consider an underlying securities price variation, they only consider a variation in volatility. As above taking the arithmetic mean of these two values:

ρTime=Scenario 1+Scenario 2

2

The volatility risk is eliminated and we are left with an estimation of risk arising solely from the time factor.

The price risk is now obtained as

ρFutures price=max (ρScan−ρVolatility− ρTime , 0 )

Hence the futures price risk may never be zero.

30

To achieve the weighted futures price risk one divides the figure above with the combined commodity net delta. This delta is achieved by summing across all futures month for the combined commodity, of futures contract-month net delta.

ρWeighted futures price=ρFutures price / Abs ( ΔNet )

These calculations are done for each combined commodity in the combined commodity group. For the group a priority table exists with allowable spreads. Start by initialising remaining combined commodity delta as the combined commodity net delta and then start checking each allowable spread for that group, starting with the highest priority spread and working downward. In the appendix the method for determining if a spread can be formed is found. If a spread is formed the inter commodity spread credit equals:

Inter Commodity Credit=∑i=1

n

ρiWeighted futures price Δ

iConsumed⋅Credit Ratei

Here n = the number of combined commodities that exists in a combined commodity group.

3.3.4 Comparison

The methods have vastly different approaches for taking correlation into account. Now what are the advantages and drawbacks of these methods? And how well do they approximate the correlation between expiry months and between different underlying securities.

One can see that TIMS does not consider the possibilities of non-total correlation between different expiry months when it comes to option contracts. However TIMS applies the Futures Spread Margin to futures positions that are spread. The spreads between the futures are multiplied with a given charge rate determined by the underlying and gives the Futures Spread Margin. This procedure can be viewed as some sort of handling non-total correlation between different expiry months but only when it comes to futures contracts. In SPAN and OMS the possibilities of non-total correlation between underlying contract months for both options and futures are considered. In OMS one can adjust the tree structure so that a contract with the same underlying but different expiry months arranges some months into different window classes. I.e. a portfolio containing futures with expiry months January, February, Mars, April, June, July can be arranged so that January and February is contained in one window class with total correlation, Mars and April in another and so on. These window classes then can be part of another higher window class either containing just some of the “month”-classes or all. It is however difficult to model the case that the correlation between months might get higher the closer the months lie. In such a case SPAN is better because it groups all months in different tiers and applies different charge rates to the deltas in the different tiers.

All methods have their own way of handling offsetting between closely related instruments. As for TIMS the method is very simple as described earlier. It all depends on which underlyings one assumes are part of a product group. When the product group is determined only one offsetting figure can be applied. In OMS one can use the correlation between different underlying to produce another tree-structure with different products in different window classes of the tree. This is a little more non-static approach than the one

31

used in TIMS. The approach using the deltas for determining credits used in SPAN is also a more non-static method than the one used in TIMS. With this approach one can offset with different figures for different underlying as long as the remaining delta is non zero.

32

4 Estimating parameters

This chapter contains explanations of the values of the parameters estimated by the clearing organisation. Since the analysis of the algorithms is made with contracts taken from the Sydney Futures Exchange (SFE), the parameters used will be those given in [13]. It is highly relevant that the parameters estimated are done so in the same way in order to compare the algorithms, otherwise we would be comparing estimations of parameters and not algorithms. Not having the same parameters would yield a situation resembled to comparing apples with pears. Since SFE uses the SPAN method we will lack some parameters. Therefore the algorithm specific variables for OMS and TIMS will be estimated as well as possible to achieve a good comparison.

4.1 Estimating a valuation interval

Taken from [10] this section describes how “Stockholmsbörsen” sets its valuation interval, this is an explanation of how one can set a valuation interval it can however be set in other ways.

Let us look at a purely numerical statistical method for estimating an interval. A purely mathematical view will be discussed; this should not be the only method used for a discussion of intervals. Economic considerations should also be part of a consideration. However such considerations will not be included here. The method that will be discussed has two main features; it is simple and gives general acceptance for a layman. This rules out the use of any method involving alteration of some basic distribution, we are left with the basic numerical brute force method.

Consider an example let’s say Ericsson B, with two years of data ending 17 Oct. 2001.

{66 . 12, 64 . 50 ,. . . , 41. 30 }= {f 1 ,f 2 ,. .. ,f n}

Calculate one-day differences, expressed in percent.

{ f 2−f 1

f 1,

f 3− f 2

f 2,. .. ,

f n−f n−1

f n−1}= {g1 , g2 ,. . . , gn−1}

In our case with Ericsson B we get.

{64 . 50−66 . 1264 . 50

,66 . 50−64 .5064 .50

, . .. , 41 .30−39 .6039. 60 }={−0 . 0251 ,0 . 0310 , . . ., 0 . 0429 }

Now put the elements in ascending order, divide the elements number in line minus one

with total number of elements minus one (¿n−2 ) and save this with the original value. This yields a collection of points in a two dimensional space that represents the numerical cumulative distribution of our object.

{{g1 , 0n−2 },{g2 , 1

n−2 }, . .. , {gn−1 , n−2n−2 }}

33

{ {-0,21472 ,0 }, {-0,15894 ,0 . 0020 } , .. . , {0,150632 ,1 } }

Plotting these values in a graph, yields:

Now one can freely choose a level of confidence for the parameters. Let’s state 99.5 percent of the distribution to be inside the margin parameters and also that 0.25 percent of outliners in both ends (symmetric)

-0.25 -0.2 -0.15 -0.1 -0.05 0 0.05 0.1 0.15 0.2

0

0.2

0.4

0.6

0.8

1

1.2

-0.3 -0.25 -0.2 -0.15 -0.1 -0.05 0

0

0.002

0.004

0.006

0.008

0.01

0.012

0.014

34

Use a simple linear interpolation between points and at the end a linear extrapolation. This is a simple approach but one wants to keep things as simple as possible. We get the following limits:

Lower limit -15,6%Upper limit 13,2%

The method described above is used if one wants to use asymmetric intervals. If one limit is wanted the absolute movements are considered. Listing the absolute value of each element in equation (4.2) yields:

{ Abs [ g1 ] , Abs [g2] , .. . , Abs [ gn−1 ] }={c1 , c2 , . .. , cn−1 }

Now, yet again, put the elements in ascending order. Divide the element number in line minus one with the total number of elements minus one. Now plotting this new value gives us a representation of the cumulative distribution of the new object, here all elements are positive.

{{c1 , 0n−2 },{c2 , 1

n−2 }, .. . , {cn−1 , n−2n−2 }}

A plot of these values is shown below.

0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16

0.98

0.985

0.99

0.995

1

1.005

35

Let us again want 99.5 percent of the distribution to be inside the margin parameters. To do this let’s investigate the upper end of the distribution.

The following intervals are achieved.

Limit 14,4%

0 0.05 0.1 0.15 0.2 0.25

0

0.2

0.4

0.6

0.8

1

1.2

0 0.05 0.1 0.15 0.2 0.25

0.98

0.985

0.99

0.995

1

1.005

36

4.2 Estimating windows between different underlying securities

This section refers to [11] where the estimations of window sizes are explained. When trying to adjust for correlation between different underlying one can choose between two methods, first the standard approach in the Value at Risk standard framework or secondly some kind of structured simulation. When OM determines window sizes they use a form of full simulation, this is the window method described earlier.

Given two different underlyings which one feels are correlated enough for using the “window method” the following historical data is given.

{ f 1 , f 2 ,. . ., f n} , {g1 , g2 ,. .. , gn }

Using the above parameters (from estimating parameters) { p f , pg} for these data ( { pf , pg } corresponds to the confidence interval ) , calculate one-day differences, but express this as a percentage of the whole interval.

{f 2− f 1

p f f 1,f 2− f 1

pf f 1, . .. ,

f 2− f 1

p f f 1}= {u1 , u2 , .. . ,un−1 }

{g2−g1

pg g1,g2−g1

pg g1, .. . ,

g2−g1

pg g1}={v1 , v2 , .. . , vn−1 }

Now for each date calculate the difference between the values.

{u1−v1 ,u2−v2 , .. . ,un−1−vn−1}

Now, these differences represent the minimum value for a window that we can have for each date. If one wants to include more than two different instruments in the investigation one simply observes that it is sufficient to subtract the smallest value from the largest one each day.

{Max [u1 , v1 , z1 ]−Min [u1 , v1 , z1] , Max [u2 , v2 , z2]−Min [u2 , v2 , z2 ] ,.. . , Max [un−1 , vn−1 , zn−1 ]−Min [un−1 , vn−1 , zn−1 ]}={x1 , x2 ,. . ., xn−1 }

Now when this is done the resulting x series can be analysed in the same way as when calculating intervals.

The resulting x series can now be transferred to a higher class of window that, as an example, span long and short interest products. This is done in exactly the same way as above.

4.3 Volatility

In OM methodology the volatility range is always set to 10%. This can be a relative good approximation of the possible maximal one-day moves in volatility for contracts traded at Stockholmsbörsen. The volatilities used by SFE however are set with reference to one year

37

99% confidence levels. This is done in a similar way as with the valuation intervals. Large volatility movements on expiry days may be removed from the data.

4.4 SPAN Specific Parameters

The methods for setting SPAN parameters described here are the ones used by the Sydney Futures Exchange (SFE). The parameter settings are described in [12].

4.4.1 Inter-Month Spread Charge

These are set by reference to 6 month 99% confidence levels. But can be set with reference to 1-year confidence level.

4.4.2 Short Option Min. Charge

Set equal to the minimum tradeable tick size or half a tick if this is too high.

4.4.3 Inter-Commodity Concession

Set with reference to one year 99% confidence levels (based on front contract months only as these contracts hold the majority of open positions). 6 month and 3 year confidence levels may also be analysed although the focus is on one-year confidence levels.

4.4.4 Delta Spread Ratios

Delta spread ratios are calculated to minimise the standard deviation between movements in the settlement price across the restricted time period. These are set with reference to one year.

4.5 TIMS Specific Parameters

I will here try to explain how some of the parameters used in TIMS are estimated.

5.4.1 Futures Spread Margin

5.4.2 Options Spread Margin

38

5 Simulations

Since the margin requirements achieved by using either of the methods described above depend heavily on what preferences the clearing organisations have. Simulations may not be a very good tool when analysing the methods. However simulations performed on portfolios containing Australian 90-Day Bank Bill futures and options on these futures, Australian 10 Year 6% Coupon Government Bond futures and options on these futures and Australian 3 Year 6% Coupon Government Bond futures and options on these futures are described below. The simulations will if not give exact results show how the methods behave during certain scenarios.

Since the contracts are traded on SFE only parameters for SPAN can be found. The other parameters are estimated as good as possible. Since both bid and ask prices are not given on the contracts at http://www.sfe.com.au the functionality of using both bid ask in OMS will be omitted during the simulations.

Window sizes are estimated with the method described in chapter 4. Simulations for OMS are done both using adjustment factor for held written and without it.

The portfolios are constructed with the mentioned instruments because of the following facts. The 90 DBB is one of two contracts on SFE that uses tiering when calculating Inter-month-charge. The 10 and 3-Year Government Bill are the only contracts included in the same combined commodity group. Hence with these instruments we might be able to analyse how the methods behave for certain behaviours of the instruments.

5.1 Simulating risk margin

In these simulations we only consider instruments with the same underlying and with the same underlying contract month. In this way we isolate the risk margin behaviour of the algorithms.

5.1.1 Futures

Start with the most simple case, a portfolio containing only one 90 DBB future. The following margin requirement is calculated.

Instrument Number Bought/Sold Expiry90 DBB Future 1 Bought 0112

Traded day 2001-10-05

Method Margin RequirementOMS 700OMS (adj) 719,796SPAN 700TIMS 700

Since a future is a linear instrument it is rather natural that the margin requirement equals the valuation interval. The only difference that occurs is that, taking the bid/ask spread in to account yields a higher margin requirement. Hence having a portfolio of futures on the same underlying with the same contract months will yield equal amounts of margin

39

requirements for all methods. The same result will occur for a portfolio consisting of a sold 90 DBB future

5.1.2 Options

Let’s now look at the case of portfolios containing one sold call option on a 90 DBB future. We do this for portfolios containing in-, at-, and out-of-the money calls. The following margin requirement is calculated.

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 1 Sold 0112 89.5 95.82 0.21%

Traded day 2001-10-05

Method Margin RequirementOMS 15627,048SPAN 15627,048TIMS 15627,048

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 1 Sold 0112 92.5 95.82 0.21%

Traded day 2001-10-05

Method Margin RequirementOMS 8596,108SPAN 8596,108TIMS 8596,108

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 1 Sold 0112 95.5 95.82 0.21%

Traded day 2001-10-05

Method Margin RequirementOMS 1540,107SPAN 1540,107TIMS 1477,779

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 1 Sold 0112 96.25 95.82 0.21%

Traded day 2001-10-05

Method Margin RequirementOMS 354,579SPAN 354,579TIMS 199,822

One notice that the SPAN and OMS calculations gives the same results for these options portfolios. This is not very surprising since a position consisting of one option will have its largest and smallest value at the end points of the interval (both the valuation interval and

40

volatility interval). TIMS does not use volatility changes in its calculations, therefore the result differs from that calculated with SPAN and OMS. This is especially noteable when the option is out-of-the money. TIMS will in this case give a lower margin requirement than SPAN and OMS.

Instrument Number Bought/Sold Expiry Strike Underlying Volatility

90 DBB Call 1 Sold 0112 95.5 95.82 0.21%90 DBB Put 1 Sold 0112 95.5 95.82 0,21%

Traded day 2001-10-05

Method Margin RequirementOMS 1617,926SPAN 1617,926TIMS 1493,269

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 1 Sold 0112 96.25 95.82 0.21%90 DBB Put 1 Sold 0112 96.25 95.82 0,21%

Traded day 2001-10-05

Method Margin RequirementOMS 1828,213SPAN 1828,213TIMS 1741,884

Yet again TIMS gives a lower margin requirement, this since it does not use volatility shifts in its simulations.

5.2 Portfolios with inter month margin

Let’s study the margin requirement for some portfolios containing instruments with different contract months. We cannot isolate the inter-month margin behaviour here but we know how the risk margin behaves under certain scenarios, and from that knowledge we can study the inter-month margin behaviour. For the options we can use in-the-money options. From results above we see that the methods gives the same results for these options.

5.2.1 Futures

Yet again we start with portfolios consisting of futures positions.

Instrument Number Bought/Sold Expiry90 DBB Future 1 Bought 011290 DBB Future 1 Bought 0203

Traded day 2001-10-05

Method Margin RequirementOMS 1400OMS (adj) 1439,495SPAN 1400

41

TIMS 1400

This portfolio does not contain any spread positions hence no adjustment for any corellation between months is noticed.

Instrument Number Bought/Sold Expiry90 DBB Future 1 Bought 011290 DBB Future 1 Sold 0203

Traded day 2001-10-05 (Window size 18% between months)

Method Margin RequirementOMS 280OMS (adj) 319,495SPAN 200 (IMC) 6

TIMS 600 (FSM) 7

These positions are the oposite of each other so in TIMS and SPAN no risk margin is achieved, only inter-month charge and futures spread margin is calculated. A direct comparision of the results is not possible since the results depend on how we set the parameters. We have to do more simulations to see how the methods behave.

Instrument Number Bought/Sold Expiry90 DBB Future 1 Bought 011290 DBB Future 1 Bought 020390 DBB Future 1 Bought 020690 DBB Future 1 Bought 020990 DBB Future 1 Bought 021290 DBB Future 1 Bought 0303

Traded day 2001-10-05 (Window size 50% between months)

Method Margin RequirementOMS 4200OMS (adj) 4318,602SPAN 4200TIMS 4200

No spread positions gives no rise to any differencies between the methods.

Instrument Number Bought/Sold Expiry90 DBB Future 1 Bought 011290 DBB Future 1 Bought 020390 DBB Future 1 Sold 0206

Traded day 2001-10-05 (Window size 30% between months)

Method Margin RequirementOMS 1166,667OMS (adj) 1225,955SPAN 1050 (IMC=350)

6 IMC = Inter Month Charge7 FSM = Futures Spread Margin

42

TIMS 1300 (FSM=600)

Instrument Number Bought/Sold Expiry90 DBB Future 1 Sold 011290 DBB Future 1 Sold 020390 DBB Future 1 Bought 0206

Traded day 2001-10-05 (Window size 30% between months)

Method Margin RequirementOMS 1166,667OMS (adj) 1225,955SPAN 1050 (IMC=350)TIMS 1300 (FSM=600)

Instrument Number Bought/Sold Expiry90 DBB Future 1 Sold 011290 DBB Future 1 Bought 020390 DBB Future 1 Sold 0206

Traded day 2001-10-05 (Window size 30% between months)

Method Margin RequirementOMS 1166,667OMS (adj) 1225,955SPAN 900 (IMC=200)TIMS 1300 (FSM=600)

Instrument Number Bought/Sold Expiry90 DBB Future 1 Bought 011290 DBB Future 1 Sold 020390 DBB Future 1 Bought 0206

Traded day 2001-10-05 (Window size 30% between months)

Method Margin RequirementOMS 1166,667OMS (adj) 1225,955SPAN 900 (IMC=200)TIMS 1300 (FSM=600)

These four portfolios have the same contracts but different contract sizes. From this we can see how the methods behave during some scenarios with differently spread positions. We see that OMS and TIMS has the same margin requirement for all portfolios. They are rather static. However using SPAN gives different margin requirements for all portfolios. SPAN changes its inter-month charge for some scenarios. Possibly SPAN is a more dynamic method when handling correlation between months.

Let’s also consider some portfolios on futures with the same contract sizes but changing contract months for each portfolio.

43

2 Bought 1 Sold OMS OMS (adj) SPAN TIMS0112 0203 980 1039,391 900 13000112 0206 980 1039,391 1050 13000112 0209 980 1039,391 1050 13000112 0212 980 1039,391 1200 13000112 0303 980 1039,391 1200 13000203 0303 980 1039,391 1200 1300

The simulations presented above allow us to compare the methods on how they behave when margining contracts with different months. We especially see how they work when the months are moved closer or moved apart. One notes that TIMS and OMS charges the same margin requirement for all portfolios whilst SPAN changes its margin requirement depending on how far/close the months lie.

5.2.2 Options

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 1 Sold 0112 89.5 95.82 0.21%90 DBB Call 1 Sold 0203 89.5 95,82 0.21%90 DBB Call 1 Sold 0206 89.5 95,82 0.21%90 DBB Call 1 Sold 0212 89.5 95,82 0.21%90 DBB Call 1 Sold 0303 89.5 95,82 0.21%

Traded day 2001-10-05

Method Margin RequirementOMS 73454,021SPAN 73792,530TIMS 73453,94

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 5 Sold 0112 89.5 95.82 0.21%90 DBB Call 5 Sold 0203 89.5 95,82 0.21%90 DBB Call 5 Sold 0206 89.5 95,82 0.21%90 DBB Call 5 Bought 0212 89.5 95,82 0.21%90 DBB Call 5 Bought 0303 89.5 95,82 0.21%

Traded day 2001-10-05 (Window size 51% between months)

Method Margin RequirementOMS 110760,060SPAN 102274,720

(IMC=5000)TIMS 97274,72

44

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 1 Bought 0112 89.5 95.82 0.21%90 DBB Call 1 Bought 0203 89.5 95,82 0.21%90 DBB Call 1 Sold 0206 89.5 95,82 0.21%90 DBB Call 1 Sold 0212 89.5 95,82 0.21%90 DBB Call 1 Sold 0303 89.5 95,82 0.21%

Traded day 2001-10-05 (Window size 51% between months)

Method Margin RequirementOMS 69559,870SPAN 63515,180 (IMC=4400)TIMS 58748,85

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 1 Sold 0112 95.5 95.82 0.21%90 DBB Call 1 Sold 0203 95.5 95,82 0.21%90 DBB Call 1 Sold 0206 95.5 95,82 0.21%90 DBB Call 1 Sold 0212 95.5 95,82 0.21%90 DBB Call 1 Sold 0303 95.5 95,82 0.21%

Traded day 2001-10-05 (Window size 51% between months)

Method Margin RequirementOMS 7700,304SPAN 7700,304TIMS 6390,275

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 1 Sold 0112 95.5 95.82 0.21%90 DBB Call 1 Sold 0203 95.5 95,82 0.21%90 DBB Call 1 Sold 0206 95.5 95,82 0.21%90 DBB Call 1 Bought 0212 95.5 95,82 0.21%90 DBB Call 1 Bought 0303 95.5 95,82 0.21%

Traded day 2001-10-05 (Window size 51% between months)

Method Margin RequirementOMS 23682,066SPAN 19366,791 (IMC=2000)TIMS 14378,82

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 1 Bought 0112 95.5 95.82 0.21%90 DBB Call 1 Bought 0203 95.5 95,82 0.21%90 DBB Call 1 Sold 0206 95.5 95,82 0.21%90 DBB Call 1 Sold 0212 95.5 95,82 0.21%90 DBB Call 1 Sold 0303 95.5 95,82 0.21%

Traded day 2001-10-05 (Window size 51% between months)

45

Method Margin RequirementOMS 14131,801SPAN 7127,154 (IMC=2050)TIMS 1696,69

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 1 Sold 0112 96.25 95.82 0.21%90 DBB Call 1 Sold 0203 96.25 95,82 0.21%90 DBB Call 1 Sold 0206 96.25 95,82 0.21%90 DBB Call 1 Sold 0212 96.25 95,82 0.21%90 DBB Call 1 Sold 0303 96.25 95,82 0.21%

Traded day 2001-10-05 (Window size 51% between months)

Method Margin RequirementOMS 3013,572SPAN 3013,572TIMS 1614,406

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 1 Sold 0112 96.25 95.82 0.21%90 DBB Call 1 Sold 0203 96.25 95,82 0.21%90 DBB Call 1 Sold 0206 96.25 95,82 0.21%90 DBB Call 1 Bought 0212 96.25 95,82 0.21%90 DBB Call 1 Bought 0303 96.25 95,82 0.21%

Traded day 2001-10-05 (Window size 51% between months)

Method Margin RequirementOMS 8754,554SPAN 3591,566 (IMC=1000)TIMS 2521,163

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 1 Bought 0112 96.25 95.82 0.21%90 DBB Call 1 Bought 0203 96.25 95,82 0.21%90 DBB Call 1 Sold 0206 96.25 95,82 0.21%90 DBB Call 1 Sold 0212 96.25 95,82 0.21%90 DBB Call 1 Sold 0303 96.25 95,82 0.21%

Traded day 2001-10-05 (Window size 51% between months)

Method Margin RequirementOMS 9794,907SPAN 5140,994 (IMC=350)TIMS 1792,83

Instrument Number Bought/Sold Expiry Strike Underlying Volatility

46

90 DBB Call 5 Sold 0112 95.5 95.82 0.21%90 DBB Put 2 Bought 0203 95.5 95,88 0.21%

Traded day 2001-10-05 (Window size 18% between months)Method Margin RequirementOMS 7696,351SPAN 7307,382TIMS 7250,883

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 5 Sold 0112 95.5 95.82 0.21%90 DBB Put 2 Sold 0203 95.5 95,88 0.21%

Traded day 2001-10-05 (Window size 18% between months)

Method Margin RequirementOMS 8260,287SPAN 8536,904 (IMC=400)TIMS 7526,921

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 5 Sold 0112 95.5 95.82 0.21%90 DBB Put 2 Sold 0203 96.25 95,88 0.21%

Traded day 2001-10-05 (Window size 18% between months)

Method Margin RequirementOMS 9743,079SPAN 9630,214 (IMC=200)TIMS 8628,55

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 5 Sold 0203 95.5 95.88 0.21%90 DBB Put 2 Sold 0112 95.5 95,82 0.21%

Traded day 2001-10-05 (Window size 18% between months)

Method Margin RequirementOMS 9286,868SPAN 9604,408TIMS 8333,902

The most noticable in these calculations is that since there are no futures position in these portfolios, TIMS does not charge for any additional margin that may be required due to different contract months.

5.3 Portfolios with contracts on different underlying

Let’s consider portfolios that consist of instruments on closely related underlyings. These portfolios will consist of 90-Day Bank Bill futures and options on these futures, 10 and 3 Year 6% Coupon Government Bond futures and options on these futures. With these

47

portfolios we can test how the methods handle correlation between contracts on different underlying.

5.3.1 Futures

We start in usual order with portfolios containing futures only.

Instrument Number Bought/Sold Expiry90 DBB Future 1 Bought 0112

10Y6%GB Future 1 Bought 01123Y6%GB Future 1 Bought 0112

Traded day 2001-10-05 (Window size 50% between underlyings)

Method Margin RequirementOMS 3300OMS (adj) 3361,493SPAN 3300TIMS 3300

Natural result since no spread positions.

Instrument Number Bought/Sold Expiry90 DBB Future 1 Sold 0112

10Y6%GB Future 1 Bought 01123Y6%GB Future 1 Bought 0112

Traded day 2001-10-05 (Window size 50% between underlyings)

Method Margin RequirementOMS 2646,667OMS (adj) 2708,160SPAN 2429,375

(ISC=870,625)8

TIMS 2110

Instrument Number Bought/Sold Expiry90 DBB Future 1 Bought 0112

10Y6%GB Future 1 Sold 01123Y6%GB Future 1 Bought 0112

Traded day 2001-10-05 (Window size 50% between underlyings)

Method Margin RequirementOMS 1806,667OMS (adj) 1868,160SPAN 2266,04

(ISC=1033,958)TIMS 580

8 ISC = Inter Spread Credit

48

Instrument Number Bought/Sold Expiry90 DBB Future 1 Bought 0112

10Y6%GB Future 1 Bought 01123Y6%GB Future 1 Sold 0112

Traded day 2001-10-05 (Window size 50% between underlyings)

Method Margin RequirementOMS 2460OMS (adj) 2521,493SPAN 1713,333

(ISC=1586,667)TIMS 1770

One can see that the results between the methods differ quite a bit. There is no obvious raking between the methods, i.e. no method sets the highest or the lowest margin requirement, instead they alternate in setting highest and lowest margin requirement. The margin requirements are of course also a result of how the parameters are set.

Let’s consider portfolios with different underlyings and different contract months.

Instrument Number Bought/Sold Expiry90 DBB Future 1 Bought 011290 DBB Future 1 Bought 020390 DBB Future 1 Bought 020690 DBB Future 1 Bought 0209

10Y6%GB Future 1 Bought 01123Y6%GB Future 1 Bought 0112

Traded day 2001-10-05 (Window size 50% between underlyings, 50% between months)

Method Margin RequirementOMS 5400OMS (adj) 5520,868SPAN 5400TIMS 5400

Instrument Number Bought/Sold Expiry90 DBB Future 1 Bought 011290 DBB Future 1 Bought 020390 DBB Future 1 Bought 020690 DBB Future 1 Bought 0209

10Y6%GB Future 1 Sold 01123Y6%GB Future 1 Bought 0112

Traded day 2001-10-05 (Window size 50% between underlyings, 50% between months)

Method Margin RequirementOMS 4240OMS (adj) 4360,046SPAN 3644,167

49

(ISC=1755,833)TIMS 2510

Instrument Number Bought/Sold Expiry90 DBB Future 1 Bought 011290 DBB Future 1 Bought 020390 DBB Future 1 Bought 020690 DBB Future 1 Bought 0209

10Y6%GB Future 1 Sold 01123Y6%GB Future 1 Sold 0112

Traded day 2001-10-05 (Window size 50% between underlyings, 50% between months)

Method Margin RequirementOMS 4360OMS (adj) 4480,868SPAN 3658,75 (ISC=1741,25)TIMS 980

Instrument Number Bought/Sold Expiry90 DBB Future 1 Sold 011290 DBB Future 1 Bought 020390 DBB Future 1 Bought 020690 DBB Future 1 Bought 0209

10Y6%GB Future 1 Sold 01123Y6%GB Future 1 Sold 0112

Traded day 2001-10-05 (Window size 50% between underlyings, 50% between months)

Method Margin RequirementOMS 4186,667OMS (adj) 4307,535SPAN 2940 (ISC=1260)

(IMC=200)TIMS 2220 (FSM=600)

Instrument Number Bought/Sold Expiry90 DBB Future 1 Bought 011290 DBB Future 1 Bought 020390 DBB Future 1 Bought 020690 DBB Future 1 Sold 0209

10Y6%GB Future 1 Sold 01123Y6%GB Future 1 Sold 0112

Traded day 2001-10-05 (Window size 50% between underlyings, 50% between months)

Method Margin RequirementOMS 4186,667OMS (adj) 4307,535SPAN 2915 (ISC=1260)

(IMC=175)TIMS 2220 (FSM=600)

50

5.3.2 Options

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 1 Sold 0112 95.5 95.82 0.21%10YGB Call 1 Sold 0112 94.5 94.58 8.47%3YGB Call 1 Sold 0112 95.5 95.46 3.52%

Traded day 2001-10-05 (Window size 50% between underlying)

Method Margin RequirementOMS 5872,101SPAN 5872,101TIMS 5451,364

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 3 Sold 0112 95.5 95.82 0.21%10YGB Call 3 Bought 0112 94.5 94.58 8.47%3YGB Call 5 Sold 0112 95.5 95.46 3.52%

Traded day 2001-10-05 (Window size 50% between underlying)

Method Margin RequirementOMS 6513,485SPAN 6549,887

(ISC=1959,47)TIMS 2000,704

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 3 Bought 0112 95.5 95.82 0.21%10YGB Call 3 Sold 0112 94.5 94.58 8.47%3YGB Call 5 Sold 0112 95.5 95.46 3.52%

Traded day 2001-10-05 (Window size 50% between underlying)

Method Margin RequirementOMS 13340,318SPAN 13212,075

(ISC=1559,791)TIMS 10195,87

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 3 Sold 0112 95.5 95.82 0.21%10YGB Call 3 Sold 0112 94.5 94.58 8.47%3YGB Call 5 Bought 0112 95.5 95.46 3.52%

Traded day 2001-10-05 (Window size 50% between underlying)Method Margin RequirementOMS 12227,446SPAN 11960,799

(ISC=1449,483)TIMS 8472,965

51

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 1 Sold 0112 95.5 95.82 0.21%90 DBB Call 1 Sold 0203 95.5 95.82 0.21%90 DBB Call 1 Sold 0206 95.5 95.82 0.21%90 DBB Call 1 Sold 0212 95.5 95.82 0.21%90 DBB Call 1 Sold 0303 95.5 95.82 0.21%10YGB Call 1 Sold 0112 94.5 94.58 8.47%3YGB Call 1 Sold 0112 95.5 95.46 3.52%

Traded day 2001-10-05 (Window size 50% between underlying, 50% between months)

Method Margin RequirementOMS 12032,312SPAN 12032,312TIMS 10363,88

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 5 Sold 0112 95.5 95.82 0.21%90 DBB Call 5 Sold 0203 95.5 95.82 0.21%90 DBB Call 3 Sold 0206 95.5 95.82 0.21%90 DBB Call 3 Bought 0212 95.5 95.82 0.21%90 DBB Call 3 Bought 0303 95.5 95.82 0.21%10YGB Call 2 Bought 0112 94.5 94.58 8.47%3YGB Call 5 Sold 0112 95.5 95.46 3.52%

Traded day 2001-10-05 (Window size 50% between underlying, 50% between months)

Method Margin RequirementOMS 24194,374SPAN 20035,766 (IMC=1500)

(ISC=2612,569)TIMS 15073,19

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 5 Sold 0112 95.5 95.82 0.21%90 DBB Call 5 Sold 0203 95.5 95.82 0.21%90 DBB Call 3 Sold 0206 95.5 95.82 0.21%90 DBB Call 3 Bought 0212 95.5 95.82 0.21%90 DBB Call 3 Bought 0303 95.5 95.82 0.21%10YGB Call 2 Sold 0112 94.5 94.58 8.47%3YGB Call 5 Bought 0112 95.5 95.46 3.52%

Traded day 2001-10-05 (Window size 50% between underlying, 50% between months)

Method Margin RequirementOMS 25398,095SPAN 21771,696

(ISC=1932,645) (IMC=1500)

TIMS 16044,64

52

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Call 5 Sold 0112 95.5 95.82 0.21%90 DBB Call 5 Sold 0203 95.5 95.82 0.21%90 DBB Call 3 Sold 0206 95.5 95.82 0.21%90 DBB Call 3 Sold 0212 95.5 95.82 0.21%90 DBB Call 3 Bought 0303 95.5 95.82 0.21%10YGB Call 2 Bought 0112 94.5 94.58 8.47%3YGB Call 5 Sold 0112 95.5 95.46 3.52%

Traded day 2001-10-05 (Window size 50% between underlying, 50% between months)

Method Margin RequirementOMS 28704,126SPAN 24569,652

(ISC=2612,569) (IMC=500)

TIMS 20535,3

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Put 2 Sold 0112 95.5 95.82 0.21%10YGB Call 2 Sold 0112 94.5 94.58 8.47%3YGB Call 2 Sold 0112 95.5 95.46 3.52%

Traded day 2001-10-05 (Window size 50% between underlying)

Method Margin RequirementOMS 9112,410SPAN 8979,145

(ISC=623,916)TIMS 8019,5

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Put 5 Sold 0112 95.5 95.82 0.21%10YGB Call 2 Sold 0112 94.5 94.58 8.47%3YGB Call 2 Sold 0112 95.5 95.46 3.52%

Traded day 2001-10-05 (Window size 50% between underlying)

Method Margin RequirementOMS 9785,051SPAN 10374,282

(ISC=637,395)TIMS 8128

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Put 2 Sold 0112 95.5 95.82 0.21%10YGB Call 2 Sold 0112 94.5 94.58 8.47%3YGB Call 5 Sold 0112 95.5 95.46 3.52%

Traded day 2001-10-05 (Window size 50% between underlying)

53

Method Margin RequirementOMS 12754,267SPAN 12465,022

(ISC=779,895)TIMS 11243,07

Instrument Number Bought/Sold Expiry Strike Underlying Volatility90 DBB Put 2 Sold 0112 95.5 95.82 0.21%10YGB Call 5 Sold 0112 94.5 94.58 8.47%3YGB Call 2 Sold 0112 95.5 95.46 3.52%

Traded day 2001-10-05 (Window size 50% between underlying)

Method Margin RequirementOMS 18466,529SPAN 18333,263

(ISC=623,416)TIMS 16716,68

TIMS lies lower in margin requirement because of the defined percentual offset. This can be changed and is not of imoprtance to how the margin calculation procedure behaves. One can also see that SPAN and OMS alternately gives highest and lowest margin requirement (not including TIMS).

54

6 ConclusionsWhat is good margin behaviour? Of course this depends on whose view one uses. If we look from the members point of view then we want as low margin requirement as possible, on the contrary the clearinghouse want as high margin requirement as nescesary to cover any potential losses. From this we se that one can not rank the methods as being best or worst. What is important however is to highlight where the methods differ.

At first we conclude that the key determinants in deciding a margin requirement are the methods used to simulate potential losses, their way of handling corellation and the estimation of valuation intervals and other parameters. The last one is equally important as the calculation method, since a weak methodology could well produce coverage that is significantly less than intended.

However, we only focus on the calculation methods we we make our conclusions.

We start with the differencies in the risk margin calculations. As one sees, TIMS does not simulate any change in volatility during the simulations of possible market scenarios. If one uses the same approach for determining a valuation interval for all methods, a significant difference in the margin requirement for a portfolio containing options will occur. Especially if the options considered are out-of-the-money. TIMS will in this case give a lower margin requirement than SPAN and OMS. However, OCC, that has developed TIMS, uses a slightly different way of determining its valuation intervals. A new version of TIMS called OCC-TIMS does implement volatility shifting. In that version one can slide volatilities as one project changes in the value of the underlying instrument in order to keep volatility and option moneyness consistent with the current implied volatility curves.

Another difference exists between OMS and SPAN/TIMS. When calculating the risk margin in OMS one differentiate between held and written positions. That is one uses different prices/volatilities for held and written options, these are taken from the bid and ask side of the market. OMS also use the fine tunings described in section 3.2.1. These procedures will provide additional margin to accounts under the specified market scenarios.

All methods use some procedure to cover for additional losses, in SPAN these are the application of extreme price moves and short option minimum margin, TIMS uses a short option adjustment and OMS uses a minimum value for held and written options. SPAN is the only method that considers any extreme scenario during the risk margin calculations, as what concerns the adjustment for short options the methods differs slightly. SPAN calculates a charge for written options whilst TIMS does this for both futures and options. OMS solely sets short options to a minimum value if their value is below a pre given value.

The other major conclusion is that the models differ a bit in how static they are when handling correlation between instruments with different months and between instruments on different underlyings.

Simulation results show that SPAN sets its margin requirement more dynamic than TIMS and OMS when different contract months are involved. Constructing portfolios of futures with different contract months gives us a tool to analyse this. We see that when we change a portfolio with futures on some months to futures on other months SPAN changes its margin requirement whilst OMS and TIMS does not. This is a result of SPAN’s way of using the deltas and tiers. The charges for the deltas depends on how far the tiers are apart,

55

this will lead to different inter-month charges if we change the portfolio to contain a future in another tier. It is harder handle such behaviour in OMS since the tree structure will become very complicated then. One can sort the months in different window classes but each month can only be part of one window class. In the TIMS method studied this is even harder since one only applies a static margin requirement depending on the total number of contracts related to the number of contracts in the spot month. When using portfolios with options it is even harder to handle the inter-month correlation behaviour since TIMS charge no additional margin if the options are on different months. However, I do believe that this is something that is adjusted in the OCC-TIMS method described very briefly in [7].

Additional one sees differencies if the positions are spread in different ways. Consider a portfolio of e.g. futures with the same underlying but different contract months. Let’s alter the portfolio in the following way + 1future (0112), +1 future (0203), -1 future (0206) - 1future (0112), +1 future (0203), +1 future (0206). The same margin requirement occurs for these portfolios. But if we would alter from + 1future (0112), +1 future (0203), -1 future (0206) to - 1future (0112), +1 future (0203), -1 future (0206) the margin requirement would change. This only happens for SPAN and not for any of the other methods. This is again explained whit the fact that SPAN applies different charge rates for different tiers.

Conclusions drawn from simulations on portfolios with contracts on different underlyings are the following:

It is hard to say how well the methods calculate their margin requirement on these portfolios. Highest/lowest margin is set by different methods for different cases. One though could say that TIMS is weakest in handling correlation because of its product groups/class groups, these will give a very static approach. OMS can handle this with its window sizes and SPAN uses its spreading table. The conclusion drawn is that SPAN/OMS is more dynamic than the TIMS version analysed in this report.

As a last step one can question how rough and correct the estimations of price, volatility and time risk in SPAN really are. This could possibly be a suggestion for another analysis performed on SPAN.

56

7 Suggestions for further investigationsOBS OBS OBS, detta kommer att inkluderas, skriver detta när rapporten är på granskning “Ruin theory”, “testing correctness of SPAN delta methods”

57

Appendix A

Glossary

Combined Commodity: Set of contracts having the same underlying product..

Combined Commodity Group: Group of combined commodities, which are eligible for inter-commodity credits.

Future Style Option: The premium or trade price of the option is marked to market each day in the same way as for futures.

Intrinsic value: The maximum of zero and the value the option would have if it where exercised immediately.

Lookahead time: The time horizon used when calculating the possible losses on the contracts margined.

Moneyness: Options are referred to as in the money, at the money, or out of the money. An in-the-money option is one that would lead to a positive cash flow to the holder if it were exercised immediately. Similarly, an at-the-money option would lead to zero cash flow if it were exercised immediately, and an out-of-the-money option would lead to a negative cash flow if it were exercised immediately.

Premium: The price one has to pay to buy an option.

Premium Style Option: The premium or trade price of the option is paid in full by the buyer and received by the seller.

58

Appendix B

Delivery Margin

This part of margining has arisen due to the delivery risk between exercise/closing and settlement. The procedures used for calculating delivery margin in the analysed methods will be presented in brief in this appendix. These explanations are almost word for word taken from [2], [6] and [9].

TIMS

Delivery positions are positions that have been tendered or assigned but have not yet been settled.The calculation is a very simple procedure. The deliver margin is set according to:

Delivery margin = Delivery rate⋅Contract Quantity

The delivery positions are not included in the calculations of additional or spread margin.

SPAN

In SPAN the delivery charge calculations are done during the calculations of inter-month margin. The following is done to calculate the delivery margin:

When all required spreads have been processed and the total inter-month spread charge has been determined if delivery charge is to be applied this is done now. For the futures months in delivery for the combined commodity, the SPAN risk parameter file will specify two charge rates:

The delivery month additional charge rate per delta consumed by inter-month spreadsThe delivery month charge rate per delta remaining in outrights.

For each futures month for the combined commodity:Determine if this future month is one of those for which the above two charge rates are specified.

If so, continue.Take the absolute value of the total delta consumed by spreads for that futures month. Multiply by

the delivery month additional charge rate per delta consumed by inter-month spread for that month. Yields the additional delivery charge for spreads for that futures month.

Take the absolute value of the remaining net delta for the futures month. Multiply by the delivery month charge rate per delta remaining for outrights for that futures month.

Sum the delivery month additional charge for spreads, for all futures month in delivery, yielding the total delivery month additional charge for spreads for the combined commodity.

Sum the delivery month charge for outrights, for all futures month in delivery, yielding the total delivery month charge for outrights for the combined commodity.

Add the two above figures yielding the total delivery month charge for the combined commodity.

OMS

59

In the delivery period, the delivery may be margined in the same way as forwards or in the same way as futures.

It is possible to impose a cutoff limit for delivery margin. The reason for this is that customers that only buy options do not have to pledge collateral as long as the options are open. In the delivery period however, delivery margin is present. In order to avoid this for small customers, accounts meeting some criterias described in [9] will get a margin requirement of zero.

Payment margin: the cash sum that is to be paid at delivery to the margins between exercise and settlement will be present as a payment margin. Note that for futures, the only thing that happens at expiration is that the last daily cash settlement takes place.

60

Appendix C

Visual Basic Scripts

In this appendix the Visual Basic scripts written for simulating margin requirements with the threemethods are included.

Main program

Public Const Portfolio As Integer = 7Public Const Spreads As Integer = 15Public Const CreditSpreads As Integer = 3Public Const Tiers As Integer = 5Public Const Months As Integer = 20

Sub CallMargin() Dim CCG(Portfolio) As Integer, CC(Portfolio) As Double Dim ContractType(Portfolio) As Integer, OptionType(Portfolio) As Integer Dim PutCall(Portfolio) As Integer, P(Portfolio) As Integer Dim Excercised(Portfolio) As Integer, Assigned(Portfolio) As Integer Dim CM(Portfolio) As Integer, ContractMonth(Portfolio) As Integer Dim CMV(Portfolio) As Double, MP_a(Portfolio) As Double, MP_b(Portfolio) As Double Dim FP(Portfolio) As Double, MP(Portfolio) As Double, LP(Portfolio) As Double Dim CP(Portfolio) As Double, VOL_a(Portfolio) As Double, VOL_b(Portfolio) As Double Dim VOL(Portfolio) As Double, T(Portfolio) As Double, q(Portfolio) As Double Dim DIV(Portfolio) As Double, ValInt(Portfolio) As Double Dim VAL_min(Portfolio) As Double, ZL(Portfolio) As Double, VO_d(Portfolio) As Double Dim VO_u(Portfolio) As Double, VOL_max(Portfolio) As Double Dim VOL_min(Portfolio) As Double, ER(Portfolio) As Integer, ER_D(Portfolio) As Integer Dim SpotSpreadRate(Portfolio) As Double, NonSpotSpreadRate(Portfolio) As Double Dim SpreadCharge2(Portfolio) As Double, OptionsMinimumMargin(Portfolio) As Double Dim FuturesMinimumMargin(Portfolio) As Double, Offset(Portfolio) As Double Dim ShortAdjustment(Portfolio) As Double, WindowSize(Portfolio) As Integer Dim Aa(Portfolio) As Double, InterestRD(Portfolio) As Integer Dim TableOrTier(Portfolio) As Integer, BaseValuation(Portfolio) As Double Dim b_s(Portfolio) As Integer, DeltaWeights(16, Portfolio) As Double Dim ChargeRateSO(Months, CreditSpreads) As Double, DeltaScaling(Months, CreditSpreads) As Double Dim MarketSide(Spreads, 2) As Integer, SpreadTier(Spreads, 2) As Integer Dim DeltaRatio(Spreads, 2) As Double, SpreadCharge(Spreads) As Double Dim Legs(Spreads) As Integer, CreditRate(Spreads) As Double Dim Tier(5, 2) As Integer, TierMonths(2, Months) As Integer, CCGWSize(Portfolio) As Integer Dim CCWS(Portfolio) As Double, DeltaSpreadRat(CreditSpreads, 2) As Double, CreditR(CreditSpreads) As Double Dim ICCindikator(CreditSpreads, 2) As Integer, DeltaScalingF(Portfolio) As Double Worksheets("Parameters").Activate

For i = 1 To Portfolio CCG(i) = Cells(3, i + 1) CC(i) = Cells(4, i + 1) CCWS(i) = Cells(5, i + 1) ContractType(i) = Cells(6, i + 1) OptionType(i) = Cells(7, i + 1) PutCall(i) = Cells(8, i + 1) P(i) = Cells(9, i + 1) Excercised(i) = Cells(10, i + 1) Assigned(i) = Cells(11, i + 1) CM(i) = Cells(12, i + 1)

61

ContractMonth(i) = Cells(13, i + 1) CMV(i) = Cells(15, i + 1) MP_a(i) = Cells(16, i + 1) MP_b(i) = Cells(17, i + 1) FP(i) = Cells(16, i + 1) MP(i) = (MP_a(i) + MP_b(i)) / 2 LP(i) = Cells(18, i + 1) CP(i) = Cells(18, i + 1) VOL_a(i) = Cells(19, i + 1) VOL_b(i) = Cells(20, i + 1) VOL(i) = (VOL_a(i) + VOL_b(i)) / 2 T(i) = Cells(21, i + 1) q(i) = Cells(22, i + 1) DIV(i) = Cells(23, i + 1) ValInt(i) = Cells(25, i + 1) VAL_min(i) = Cells(27, i + 1) ZL(i) = Cells(28, i + 1) VO_d(i) = Cells(29, i + 1) VO_u(i) = Cells(29, i + 1) VOL_max(i) = Cells(30, i + 1) VOL_min(i) = Cells(31, i + 1) ER(i) = Cells(32, i + 1) ER_D(i) = Cells(33, i + 1) SpotSpreadRate(i) = Cells(34, i + 1) NonSpotSpreadRate(i) = Cells(35, i + 1) SpreadCharge2(i) = Cells(36, i + 1) OptionsMinimumMargin(i) = Cells(37, i + 1) FuturesMinimumMargin(i) = Cells(38, i + 1) Offset(i) = Cells(39, i + 1) ShortAdjustment(i) = Cells(40, i + 1) DeltaScalingF(i) = Cells(41, i + 1) CCGWSize(i) = Cells(42, i + 1) WindowSize(i) = Cells(43, i + 1) Aa(i) = Cells(44, i + 1) InterestRD(i) = Cells(45, i + 1) TableOrTier(i) = Cells(46, i + 1) BaseValuation(i) = Cells(15, i + 1) If P(i) < 0 Then b_s(i) = 1 ElseIf P(i) > 0 Then b_s(i) = 0 End If For j = 1 To 16 DeltaWeights(j, i) = Cells(98 + j, i + 1) Next j Next i IR = Cells(48, 2) For l = 1 To CreditSpreads For k = 1 To Months ChargeRateSO(k, l) = -Cells(50 + k, l * 2) DeltaScaling(k, l) = Cells(50 + k, l * 2 + 1) Next k Next l For M = 1 To Spreads For l = 1 To 2 MarketSide(M, l) = Cells(79 + M, l + 3) SpreadTier(M, l) = Cells(79 + M, l + 5) DeltaRatio(M, l) = Cells(79 + M, l + 7) Next l

62

SpreadCharge(M) = Cells(79 + M, 2) Legs(M) = Cells(79 + M, 3) Next M For M = 1 To 5 For l = 1 To 2 Tier(M, l) = Cells(72 + M, l + 1) Next l Next M For j = 1 To UBound(Tier, 2) For k = Tier(j, 1) To Tier(j, 2) TierMonths(j, k + 1 - Tier(j, 1)) = k Next k Next j For i = 1 To CreditSpreads For j = 1 To 2 DeltaSpreadRat(i, j) = Cells(116 + i, 3 + j) ICCindikator(i, j) = Cells(116 + i, 1 + j) Next j CreditR(i) = Cells(116 + i, 6) Next i

OMS_bid_ask = OMSCalculator1(CCG, CCWS, ContractType, OptionType, PutCall, P, CM, ContractMonth, CMV, MP_a, MP_b, FP, MP, LP, CP, VOL_a, VOL_b, VOL, T, q, DIV, ValInt, VAL_min, ZL, VO_d, VO_u, VOL_max, VOL_min, ER, ER_D, WindowSize, Aa, InterestRD, BaseValuation, b_s, IR, CCGWSize)

OMS_average = OMSCalculator2(CCG, CCWS, ContractType, OptionType, PutCall, P, CM, ContractMonth, CMV, MP_a, MP_b, FP, MP, LP, CP, VOL_a, VOL_b, VOL, T, q, DIV, ValInt, VAL_min, ZL, VO_d, VO_u, VOL_max, VOL_min, ER, ER_D, WindowSize, InterestRD, BaseValuation, b_s, IR, CCGWSize)

SPAN = SpanCalc(CCG, CCWS, ContractType, OptionType, PutCall, P, CM, ContractMonth, CMV, MP, LP, CP, VOL, T, q, DIV, ValInt, VO_d, VO_u, SpreadCharge2, InterestRD, TableOrTier, DeltaWeights, ChargeRateSO, DeltaScaling, DeltaScalingF, MarketSide, SpreadTier, DeltaRatio, SpreadCharge, Legs, CreditRate, Tier, TierMonths, IR, DeltaSpreadRat, CreditR, ICCindikator)

TIMS = TimsCalculator(CCG, CC, ContractType, OptionType, PutCall, P, Excercised, Assigned, CM, ContractMonth, CMV, MP, LP, CP, VOL, T, q, DIV, ValInt, VO_d, VO_u, SpotSpreadRate, NonSpotSpreadRate, OptionsMinimumMargin, FuturesMinimumMargin, Offset, ShortAdjustment, InterestRD, IR)

End Sub

OMS II function without using adjustmentfactor

Option Base 1Private Const n As Integer = 31

Public Function OMSCalculator2(CCG, CCWS, ContractType, OptionType, PutCall, P, CM, ContractMonth, CMV, MP_a, MP_b, FP, MP, LP, CP, VOL_a, VOL_b, VOL, T, q, DIV, ValInt, VAL_min, ZL, VO_d, VO_u, VOL_max, VOL_min, ER, ER_D, WindowSize, InterestRD, BaseValuation, b_s, IR, CCGWSize)

Dim Volla(2) As Double, MPrice(2) As Double Dim Vfiles(n, Portfolio * 3) As Double Dim CCGWV(n, 3 * Portfolio) Static PortfolioCC(Portfolio) As Integer

63

Static a As Double Static b As Double For i = 1 To Portfolio PortfolioCC(i) = PortfolioCC(i) * 0 Next i a = 1 b = CCWS(1) AdjustF = 0 For k = 1 To Portfolio + 1 If k > Portfolio Then GoTo jump: If CCWS(k) = b Then PortfolioCC(a) = PortfolioCC(a) + 1 Else jump:

If k > Portfolio Then GoTo exitif: a = a + 1 b = CCWS(k) k = k - 1 GoTo exitif: End If b = CCWS(k) exitif: Next k Worksheets("OMSvectors").Activate Static MarginReq As Double MarginReq = MarginReq * 0 Static stepvar As Integer stepvar = stepvar * 0 stepvar = 1 Static stepvar2 As Integer stepvar2 = stepvar2 * 0 stepvar2 = 1 For l = 1 To a For k = stepvar To stepvar + PortfolioCC(l) - 1 tablevar = 2 + (k - 1) * 4 If ContractType(k) = -1 Then ContractCalc = ForwardCalculation2(FP(k), AdjustF, ValInt(k), ValInt(k), CP(k), CM(k), P(k), b_s(k), tablevar)

64

ElseIf ContractType(k) = 0 Then ContractCalc = FutureCalculation2(AdjustF, AdjustF, ValInt(k), ValInt(k), CM(k), P(k), b_s(k), tablevar) ElseIf ContractType(k) = 1 Or ContractType(k) = 2 Then ContractCalc = OptionCalculation2(OptionType(k), PutCall(k), CMV(k), LP(k), IR, q(k), T(k), VOL(k), DIV(k),

ValInt(k), ValInt(k), VO_d(k), VO_u(k), CM(k), MP(k), VOL_max(k), VOL_min(k), ER(k), ER_D(k), BaseValuation(k), VAL_min(k), ZL(k), b_s(k), tablevar, P(k), InterestRD(k))

End If For i = 1 To n For j = 1 To 3 Vfiles(i, j + (k - stepvar) * 3) = ContractCalc(i, j) Next j Next i WSize = WindowSize(k) Next k stepvar = stepvar + PortfolioCC(l) WindowVector = WindowMethod2(PortfolioCC(l), Vfiles, WSize) For i = 1 To n For j = 1 To 3 CCGWV(i, (l - 1) * 3 + j) = WindowVector(i, j) Next j Next i For j = 1 To n Cells(36 + j, stepvar2 + 1).Value = WindowVector(j, 1) Cells(36 + j, stepvar2 + 2).Value = WindowVector(j, 2) Cells(36 + j, stepvar2 + 3).Value = WindowVector(j, 3) Next j stepvar2 = stepvar2 + 3 Next l treevar = l - 1 CCGWindowVector = WindowMethod2(treevar, CCGWV, CCGWSize(1)) For j = 1 To n Cells(69 + j, 2).Value = CCGWindowVector(j, 1) Cells(69 + j, 3).Value = CCGWindowVector(j, 2) Cells(69 + j, 4).Value = CCGWindowVector(j, 3) Next j testmin = CCGWindowVector(1, 1) For S = 1 To 3 For v = 1 To n If testmin > CCGWindowVector(v, S) Then testmin = CCGWindowVector(v, S) End If Next v Next S

65

MarginReq2 = testmin If MarginReq2 > 0 Then MarginReq2 = 0 End If Cells(34, 3).Value = -MarginReq2 End Function

Private Function ForwardCalculation2(FP, a, Vd, Vu, CP, CM, P, b_s, tablevar)

Worksheets("OMSvectors").Activate Dim VF(n, 3) As Double Dim RM(n, 3) As Double Ptemp = P If Ptemp < 0 Then Ptemp = Abs(Ptemp) End If If b_s = 0 Then VF((n + 1) / 2, 1) = (FP - a) * 100 VF((n + 1) / 2, 2) = VF((n + 1) / 2, 1) VF((n + 1) / 2, 3) = VF((n + 1) / 2, 1) ElseIf b_s = 1 Then VF((n + 1) / 2, 1) = (FP + a) * 100 VF((n + 1) / 2, 2) = VF((n + 1) / 2, 1) VF((n + 1) / 2, 3) = VF((n + 1) / 2, 1) End If For i = 1 To (n - 1) / 2 If b_s = 0 Then VF(i, 1) = (FP - a - Vd + (i - 1) * Vd / (0.5 * (n - 1))) * 100 VF(i, 2) = VF(i, 1) VF(i, 3) = VF(i, 1) ElseIf b_s = 1 Then VF(i, 1) = (FP + a - Vd + (i - 1) * Vd / (0.5 * (n - 1))) * 100 VF(i, 2) = VF(i, 1) VF(i, 3) = VF(i, 1) End If Next i For i = (n + 1) / 2 + 1 To n If b_s = 0 Then VF(i, 1) = (FP - a + Vu + (i - 31) * Vu / (0.5 * (n - 1))) * 100 VF(i, 2) = VF(i, 1) VF(i, 3) = VF(i, 1) ElseIf b_s = 1 Then VF(i, 1) = (FP + a + Vu + (i - 31) * Vu / (0.5 * (n - 1))) * 100 VF(i, 2) = VF(i, 1) VF(i, 3) = VF(i, 1) End If Next i

66

For j = 1 To n If b_s = 0 Then RM(j, 1) = ((VF(j, 1) / 100 - CP) * CM * Ptemp) RM(j, 2) = RM(j, 1) RM(j, 3) = RM(j, 1) ElseIf b_s = 1 Then RM(j, 1) = ((CP - VF(j, 1) / 100) * CM * Ptemp) RM(j, 2) = RM(j, 1) RM(j, 3) = RM(j, 1) End If Cells(j + 1, tablevar).Value = RM(j, 1) Cells(j + 1, tablevar + 1).Value = RM(j, 2) Cells(j + 1, tablevar + 2).Value = RM(j, 3) Next j ForwardCalculation2 = RM End Function

Private Function FutureCalculation2(A_B, A_S, Vd, Vu, CM, P, b_s, tablevar)

Ptemp = P If Ptemp < 0 Then Ptemp = Abs(Ptemp) End If

Worksheets("OMSvectors").Activate Dim VF(n, 3) As Double Dim RM(n, 3) As Double If b_s = 0 Then VF((n + 1) / 2, 1) = (-A_B) * 100 VF((n + 1) / 2, 2) = VF((n + 1) / 2, 1) VF((n + 1) / 2, 3) = VF((n + 1) / 2, 1) ElseIf b_s = 1 Then VF((n + 1) / 2, 1) = (A_S) * 100 VF((n + 1) / 2, 2) = VF((n + 1) / 2, 1) VF((n + 1) / 2, 3) = VF((n + 1) / 2, 1) End If For i = 1 To (n - 1) / 2 If b_s = 0 Then VF(i, 1) = (-Vd + (i - 1) * Vd / (0.5 * (n - 1)) - A_B) * 100 VF(i, 2) = VF(i, 1) VF(i, 3) = VF(i, 1) ElseIf b_s = 1 Then VF(i, 1) = (-Vd + (i - 1) * Vd / (0.5 * (n - 1)) + A_S) * 100 VF(i, 2) = VF(i, 1) VF(i, 3) = VF(i, 1) End If Next i For i = (n + 1) / 2 + 1 To n

67

If b_s = 0 Then VF(i, 1) = (Vu + (i - 31) * Vu / (0.5 * (n - 1)) - A_B) * 100 VF(i, 2) = VF(i, 1) VF(i, 3) = VF(i, 1) ElseIf b_s = 1 Then VF(i, 1) = (Vu + (i - 31) * Vu / (0.5 * (n - 1)) + A_S) * 100 VF(i, 2) = VF(i, 1) VF(i, 3) = VF(i, 1) End If Next i

For j = 1 To n If b_s = 0 Then RM(j, 1) = (VF(j, 1) / 100 * CM * Ptemp) RM(j, 2) = RM(j, 1) RM(j, 3) = RM(j, 1) ElseIf b_s = 1 Then RM(j, 1) = (-VF(j, 2) / 100 * CM * Ptemp) RM(j, 2) = RM(j, 1) RM(j, 3) = RM(j, 1) End If Cells(j + 1, tablevar).Value = RM(j, 1) Cells(j + 1, tablevar + 1).Value = RM(j, 2) Cells(j + 1, tablevar + 2).Value = RM(j, 3) Next j FutureCalculation2 = RM End Function

Private Function OptionCalculation2(OT, PutCall, UP, LP, r, q, T, VOL, DIV, Vd, Vu, VOd, VOu, CM, MP, VOLmax, VOLmin, ER, ERD, BV, VALmin, ZL, b_s, tablevar, CSize, IRD)

'PutCall = 1 för call -1 för put

MPtemp = MP Strike = LP

If IRD = 1 Then MPtemp = (1000000 * 365 / (365 + ((100 - LP) * 90 / 100)) - 1000000 * 365 / (365 + ((100 - (LP - 0.01)) * 90 / 100))) *

MP * 100 Strike = 1000000 * 365 / (365 + ((100 - LP) * 90 / 100)) End If If IRD = 2 Then MPtemp = (1000 * (6 / 2 * (1 - (1 / (1 + (100 - LP) / 200)) ^ 20) / ((100 - LP) / 200) + 100 * (1 / (1 + (100 - LP) / 200)) ^

20) - 1000 * (6 / 2 * (1 - (1 / (1 + (100 - (LP - 0.01)) / 200)) ^ 20) / ((100 - (LP - 0.01)) / 200) + 100 * (1 / (1 + (100 - (LP - 0.01)) / 200)) ^ 20)) * MP * 100

Strike = 1000 * (6 / 2 * (1 - (1 / (1 + (100 - LP) / 200)) ^ 20) / ((100 - LP) / 200) + 100 * (1 / (1 + (100 - LP) / 200)) ^ 20)

End If If IRD = 3 Then

68

MPtemp = (1000 * (6 / 2 * (1 - (1 / (1 + (100 - LP) / 200)) ^ 6) / ((100 - LP) / 200) + 100 * (1 / (1 + (100 - LP) / 200)) ^ 6) - 1000 * (6 / 2 * (1 - (1 / (1 + (100 - (LP - 0.01)) / 200)) ^ 6) / ((100 - (LP - 0.01)) / 200) + 100 * (1 / (1 + (100 - (LP - 0.01)) / 200)) ^ 6)) * MP * 100

Strike = 1000 * (6 / 2 * (1 - (1 / (1 + (100 - LP) / 200)) ^ 6) / ((100 - LP) / 200) + 100 * (1 / (1 + (100 - LP) / 200)) ^ 6) End If Worksheets("OMSvectors").Activate Dim VF(n, 6) As Double Dim RM(n, 3) As Double Dim VOLa(2) As Double, VOLb(2) As Double, VOLau(2) As Double, VOLad(2) As Double, VOLbu(2) As Double,

VOLbd(2) As Double If CSize > 0 And VOL = 0 Then Factor = MPtemp / OptVal(OT, PutCall, UP, Strike, r, q, T - 1 / 360, VOL, DIV, 0) End If If Factor > 1 Or CSize < 0 Or VOL <> 0 Then Factor = 1 End If VOLa(1) = VOLmin VOLa(2) = VOL VOLau(1) = VOLmin VOLau(2) = VOL + VOu VOLad(1) = VOLmin VOLad(2) = VOL - VOd VOLb(1) = VOLmax VOLb(2) = VOL VOLbu(1) = VOLmax VOLbu(2) = VOL + VOu VOLbd(1) = VOLmax VOLbd(2) = VOL - VOd adjp = (UP - BV) adjt = ER / ERD VF((n + 1) / 2, 3) = OptVal(OT, PutCall, UP + adjp, Strike, r, q, T, Application.Max(VOLa), DIV, 0) * CM * CSize VF((n + 1) / 2, 4) = OptVal(OT, PutCall, UP + adjp, Strike, r, q, T - adjt, Application.Min(VOLb), DIV, 0) * CM * CSize

* Factor VF((n + 1) / 2, 5) = OptVal(OT, PutCall, UP + adjp, Strike, r, q, T, Application.Max(VOLau), DIV, 0) * CM * CSize VF((n + 1) / 2, 6) = OptVal(OT, PutCall, UP + adjp, Strike, r, q, T - adjt, Application.Min(VOLbu), DIV, 0) * CM * CSize

* Factor VF((n + 1) / 2, 1) = OptVal(OT, PutCall, UP + adjp, Strike, r, q, T, Application.Max(VOLad), DIV, 0) * CM * CSize VF((n + 1) / 2, 2) = OptVal(OT, PutCall, UP + adjp, Strike, r, q, T - adjt, Application.Min(VOLbd), DIV, 0) * CM * CSize

* Factor For i = 1 To (n - 1) / 2 VF(i, 3) = OptVal(OT, PutCall, UP + (i - 16) * Vd / (0.5 * (n - 1)) + adjp, Strike, r, q, T, Application.Max(VOLa), DIV,

0) * CM * CSize VF(i, 4) = OptVal(OT, PutCall, UP + (i - 16) * Vd / (0.5 * (n - 1)) + adjp, Strike, r, q, T - adjt, Application.Min(VOLb),

DIV, 0) * CM * CSize * Factor VF(i, 5) = OptVal(OT, PutCall, UP + (i - 16) * Vd / (0.5 * (n - 1)) + adjp, Strike, r, q, T, Application.Max(VOLau),

DIV, 0) * CM * CSize VF(i, 6) = OptVal(OT, PutCall, UP + (i - 16) * Vd / (0.5 * (n - 1)) + adjp, Strike, r, q, T - adjt, Application.Min(VOLbu),

DIV, 0) * CM * CSize * Factor VF(i, 1) = OptVal(OT, PutCall, UP + (i - 16) * Vd / (0.5 * (n - 1)) + adjp, Strike, r, q, T, Application.Max(VOLad),

DIV, 0) * CM * CSize

69

VF(i, 2) = OptVal(OT, PutCall, UP + (i - 16) * Vd / (0.5 * (n - 1)) + adjp, Strike, r, q, T - adjt, Application.Min(VOLbd), DIV, 0) * CM * CSize * Factor

Next i For i = (n + 1) / 2 + 1 To n VF(i, 3) = OptVal(OT, PutCall, UP + (i - 16) * Vu / (0.5 * (n - 1)) + adjp, Strike, r, q, T, Application.Max(VOLa), DIV,

0) * CM * CSize VF(i, 4) = OptVal(OT, PutCall, UP + (i - 16) * Vu / (0.5 * (n - 1)) + adjp, Strike, r, q, T - adjt, Application.Min(VOLb),

DIV, 0) * CM * CSize * Factor VF(i, 5) = OptVal(OT, PutCall, UP + (i - 16) * Vu / (0.5 * (n - 1)) + adjp, Strike, r, q, T, Application.Max(VOLau),

DIV, 0) * CM * CSize VF(i, 6) = OptVal(OT, PutCall, UP + (i - 16) * Vu / (0.5 * (n - 1)) + adjp, Strike, r, q, T - adjt, Application.Min(VOLbu),

DIV, 0) * CM * CSize * Factor VF(i, 1) = OptVal(OT, PutCall, UP + (i - 16) * Vu / (0.5 * (n - 1)) + adjp, Strike, r, q, T, Application.Max(VOLad),

DIV, 0) * CM * CSize VF(i, 2) = OptVal(OT, PutCall, UP + (i - 16) * Vu / (0.5 * (n - 1)) + adjp, Strike, r, q, T - adjt, Application.Min(VOLbd),

DIV, 0) * CM * CSize * Factor Next i

minval = 100 * VALmin minzl = 100 * ZL For k = 1 To n For l = 1 To 5 Step 2 If Abs(VF(k, l)) < minval Then VF(k, l) = -minval End If Next l For M = 2 To 6 Step 2 If VF(k, M) < minzl Then VF(k, M) = 0 End If Next M For z = 1 To 5 Step 2 PercentCheck = Abs(VF(k, z + 1) / VF(k, z)) If PercentCheck > 0.95 Then VF(k, z + 1) = Abs(VF(k, z)) * 0.95 End If Next z Next k

For j = 1 To n If b_s = 0 Then RM(j, 1) = VF(j, 2) RM(j, 2) = VF(j, 4) RM(j, 3) = VF(j, 6) ElseIf b_s = 1 Then

70

RM(j, 1) = VF(j, 1) RM(j, 2) = VF(j, 3) RM(j, 3) = VF(j, 5) End If Cells(j + 1, tablevar).Value = RM(j, 1) Cells(j + 1, tablevar + 1).Value = RM(j, 2) Cells(j + 1, tablevar + 2).Value = RM(j, 3) Next j OptionCalculation2 = RM End Function

Private Function WindowMethod2(NumOfContractsCC, VectorFiles, WindowSize)

Worksheets("OMSvectors").Activate Dim TotalVector(n, 3) As Double Static temp(Portfolio * 3) As Double Static X As Double For i = 1 To Portfolio * 3 temp(i) = temp(i) * 0 Next i If WindowSize = 0 Then For i = 1 To n For j = 0 To NumOfContractsCC * 3 - 1 Step 3 For k = 1 To 3 TotalVector(i, k) = TotalVector(i, k) + VectorFiles(i, j + k) Next k Next j Next i Else X = (1 - WindowSize / 100) * (n - 1) X = Rounding(X) X = n - X Xtemp = X / 2 Xtest = RoundingDown(Xtemp) If Xtemp = Xtest Then X = X + 1 End If For i = 1 To n For j = 1 To NumOfContractsCC * 3 Step 3 S = i - (X - 1) / 2

71

If S < 1 Then S = 1 End If temp(j) = VectorFiles(S, j) For k = 0 To 2 For l = i - (X - 1) / 2 To i + (X - 1) / 2 If l < 1 Then l = 1 End If If VectorFiles(l, j + k) < 0 And temp(j) < 0 And temp(j) > VectorFiles(l, j + k) Then temp(j) = VectorFiles(l, j + k) ElseIf VectorFiles(l, j + k) > 0 And temp(j) > 0 And temp(j) > VectorFiles(l, j + k) Then temp(j) = VectorFiles(l, j + k) ElseIf VectorFiles(l, j + k) < 0 And temp(j) > 0 Then temp(j) = VectorFiles(l, j + k) End If If l = n Then GoTo exitl: End If Next l exitl: Next k Next j TotalVector(i, 1) = Application.Sum(temp) TotalVector(i, 2) = TotalVector(i, 1) TotalVector(i, 3) = TotalVector(i, 1) Next i

End If

WindowMethod2 = TotalVector End Function

Private Function Rounding(RDvar)

Dim invar2 As Integer, RD As IntegerDim y As Doubleinvar2 = RDvar

72

Rounding = invar2

End Function

OMS II function using adjustment factor

Option Base 1Private Const n As Integer = 31

Public Function OMSCalculator1(CCG, CCWS, ContractType, OptionType, PutCall, P, CM, ContractMonth, CMV, MP_a, MP_b, FP, MP, LP, CP, VOL_a, VOL_b, VOL, T, q, DIV, ValInt, VAL_min, ZL, VO_d, VO_u, VOL_max, VOL_min, ER, ER_D, WindowSize, Aa, InterestRD, BaseValuation, b_s, IR, CCGWSize)

Dim Volla(2) As Double, MPrice(2) As Double Dim Vfiles(n, Portfolio * 3) As Double Dim CCGWV(n, 3 * Portfolio) Static PortfolioCC(Portfolio) As Integer Static a As Double Static b As Double For i = 1 To Portfolio PortfolioCC(i) = PortfolioCC(i) * 0 Next i a = 1 b = CCWS(1) For k = 1 To Portfolio + 1 If k > Portfolio Then GoTo jump: If CCWS(k) = b Then PortfolioCC(a) = PortfolioCC(a) + 1 Else jump:

If k > Portfolio Then GoTo exitif: a = a + 1 b = CCWS(k) k = k - 1 GoTo exitif: End If b = CCWS(k) exitif: Next k Worksheets("OMSvectorsBidAsk").Activate Static MarginReq As Double MarginReq = MarginReq * 0

73

Static stepvar As Integer stepvar = stepvar * 0 stepvar = 1 Static stepvar2 As Integer stepvar2 = stepvar2 * 0 stepvar2 = 1 For l = 1 To a For k = stepvar To stepvar + PortfolioCC(l) - 1 tablevar = 2 + (k - 1) * 4 Volla(1) = VOL_a(k) Volla(2) = VOL_b(k) MPrice(1) = MP_a(k) MPrice(2) = MP_a(k) If ContractType(k) = -1 Then ContractCalc = ForwardCalculation(FP(k), Aa(k), ValInt(k), ValInt(k), CP(k), CM(k), P(k), b_s(k), tablevar) ElseIf ContractType(k) = 0 Then ContractCalc = FutureCalculation(Aa(k), Aa(k), ValInt(k), ValInt(k), CM(k), P(k), b_s(k), tablevar) ElseIf ContractType(k) = 1 Or ContractType(k) = 2 Then ContractCalc = OptionCalculation(OptionType(k), PutCall(k), CMV(k), LP(k), IR, q(k), T(k), Volla, DIV(k),

ValInt(k), ValInt(k), VO_d(k), VO_u(k), CM(k), MPrice, VOL_max(k), VOL_min(k), ER(k), ER_D(k), BaseValuation(k), VAL_min(k), ZL(k), b_s(k), tablevar, P(k), InterestRD(k))

End If For i = 1 To n For j = 1 To 3 Vfiles(i, j + (k - stepvar) * 3) = ContractCalc(i, j) Next j Next i WSize = WindowSize(k) Next k stepvar = stepvar + PortfolioCC(l) WindowVector = WindowMethod(PortfolioCC(l), Vfiles, WSize) For i = 1 To n For j = 1 To 3 CCGWV(i, (l - 1) * 3 + j) = WindowVector(i, j) Next j Next i For j = 1 To n Cells(36 + j, stepvar2 + 1).Value = WindowVector(j, 1) Cells(36 + j, stepvar2 + 2).Value = WindowVector(j, 2) Cells(36 + j, stepvar2 + 3).Value = WindowVector(j, 3) Next j stepvar2 = stepvar2 + 3 Next l

74

treevar = l - 1 CCGWindowVector = WindowMethod(treevar, CCGWV, CCGWSize(1)) For j = 1 To n Cells(69 + j, 2).Value = CCGWindowVector(j, 1) Cells(69 + j, 3).Value = CCGWindowVector(j, 2) Cells(69 + j, 4).Value = CCGWindowVector(j, 3) Next j testmin = CCGWindowVector(1, 1) For S = 1 To 3 For v = 1 To n If testmin > CCGWindowVector(v, S) Then testmin = CCGWindowVector(v, S) End If Next v Next S MarginReq2 = testmin If MarginReq2 > 0 Then MarginReq2 = 0 End If Cells(34, 3).Value = -MarginReq2 End Function

Private Function ForwardCalculation(FP, a, Vd, Vu, CP, CM, P, b_s, tablevar)

Worksheets("OMSvectorsBidAsk").Activate Dim VF(n, 3) As Double Dim RM(n, 3) As Double Ptemp = P If Ptemp < 0 Then Ptemp = Abs(Ptemp) End If If b_s = 0 Then VF((n + 1) / 2, 1) = (FP - a) * 100 VF((n + 1) / 2, 2) = VF((n + 1) / 2, 1) VF((n + 1) / 2, 3) = VF((n + 1) / 2, 1) ElseIf b_s = 1 Then VF((n + 1) / 2, 1) = (FP + a) * 100 VF((n + 1) / 2, 2) = VF((n + 1) / 2, 1) VF((n + 1) / 2, 3) = VF((n + 1) / 2, 1) End If For i = 1 To (n - 1) / 2 If b_s = 0 Then VF(i, 1) = (FP - a - Vd + (i - 1) * Vd / (0.5 * (n - 1))) * 100 VF(i, 2) = VF(i, 1) VF(i, 3) = VF(i, 1) ElseIf b_s = 1 Then VF(i, 1) = (FP + a - Vd + (i - 1) * Vd / (0.5 * (n - 1))) * 100

75

VF(i, 2) = VF(i, 1) VF(i, 3) = VF(i, 1) End If Next i For i = (n + 1) / 2 + 1 To n If b_s = 0 Then VF(i, 1) = (FP - a + Vu + (i - 31) * Vu / (0.5 * (n - 1))) * 100 VF(i, 2) = VF(i, 1) VF(i, 3) = VF(i, 1) ElseIf b_s = 1 Then VF(i, 1) = (FP + a + Vu + (i - 31) * Vu / (0.5 * (n - 1))) * 100 VF(i, 2) = VF(i, 1) VF(i, 3) = VF(i, 1) End If Next i For j = 1 To n If b_s = 0 Then RM(j, 1) = ((VF(j, 1) / 100 - CP) * CM * Ptemp) RM(j, 2) = RM(j, 1) RM(j, 3) = RM(j, 1) ElseIf b_s = 1 Then RM(j, 1) = ((CP - VF(j, 1) / 100) * CM * Ptemp) RM(j, 2) = RM(j, 1) RM(j, 3) = RM(j, 1) End If Cells(j + 1, tablevar).Value = RM(j, 1) Cells(j + 1, tablevar + 1).Value = RM(j, 2) Cells(j + 1, tablevar + 2).Value = RM(j, 3) Next j ForwardCalculation = RM End Function

Private Function FutureCalculation(A_B, A_S, Vd, Vu, CM, P, b_s, tablevar)

Ptemp = P If Ptemp < 0 Then Ptemp = Abs(Ptemp) End If

Worksheets("OMSvectorsBidAsk").Activate Dim VF(n, 3) As Double Dim RM(n, 3) As Double If b_s = 0 Then VF((n + 1) / 2, 1) = (-A_B) * 100 VF((n + 1) / 2, 2) = VF((n + 1) / 2, 1) VF((n + 1) / 2, 3) = VF((n + 1) / 2, 1) ElseIf b_s = 1 Then VF((n + 1) / 2, 1) = (A_S) * 100

76

VF((n + 1) / 2, 2) = VF((n + 1) / 2, 1) VF((n + 1) / 2, 3) = VF((n + 1) / 2, 1) End If For i = 1 To (n - 1) / 2 If b_s = 0 Then VF(i, 1) = (-Vd + (i - 1) * Vd / (0.5 * (n - 1)) - A_B) * 100 VF(i, 2) = VF(i, 1) VF(i, 3) = VF(i, 1) ElseIf b_s = 1 Then VF(i, 1) = (-Vd + (i - 1) * Vd / (0.5 * (n - 1)) + A_S) * 100 VF(i, 2) = VF(i, 1) VF(i, 3) = VF(i, 1) End If Next i For i = (n + 1) / 2 + 1 To n If b_s = 0 Then VF(i, 1) = (Vu + (i - 31) * Vu / (0.5 * (n - 1)) - A_B) * 100 VF(i, 2) = VF(i, 1) VF(i, 3) = VF(i, 1) ElseIf b_s = 1 Then VF(i, 1) = (Vu + (i - 31) * Vu / (0.5 * (n - 1)) + A_S) * 100 VF(i, 2) = VF(i, 1) VF(i, 3) = VF(i, 1) End If Next i

For j = 1 To n If b_s = 0 Then RM(j, 1) = (VF(j, 1) / 100 * CM * Ptemp) RM(j, 2) = RM(j, 1) RM(j, 3) = RM(j, 1) ElseIf b_s = 1 Then RM(j, 1) = (-VF(j, 2) / 100 * CM * Ptemp) RM(j, 2) = RM(j, 1) RM(j, 3) = RM(j, 1) End If Cells(j + 1, tablevar).Value = RM(j, 1) Cells(j + 1, tablevar + 1).Value = RM(j, 2) Cells(j + 1, tablevar + 2).Value = RM(j, 3) Next j FutureCalculation = RM End Function

Private Function OptionCalculation(OT, PutCall, UP, LP, r, q, T, VOL, DIV, Vd, Vu, VOd, VOu, CM, MP, VOLmax, VOLmin, ER, ERD, BV, VALmin, ZL, b_s, tablevar, CSize, IRD)

'PutCall = 1 för call -1 för put

77

Worksheets("OMSvectorsBidAsk").Activate Dim VF(n, 6) As Double Dim RM(n, 3) As Double Dim VOLa(2) As Double, VOLb(2) As Double, VOLau(2) As Double, VOLad(2) As Double, VOLbu(2) As Double,

VOLbd(2) As Double MPtemp = MP(2) Strike = LP If IRD = 1 Then MPtemp = (1000000 * 365 / (365 + ((100 - LP) * 90 / 100)) - 1000000 * 365 / (365 + ((100 - (LP - 0.01)) * 90 / 100))) *

MP(2) * 100 Strike = 1000000 * 365 / (365 + ((100 - LP) * 90 / 100)) End If If IRD = 2 Then MPtemp = (1000 * (6 / 2 * (1 - (1 / (1 + (100 - LP) / 200)) ^ 20) / ((100 - LP) / 200) + 100 * (1 / (1 + (100 - LP) / 200)) ^

20) - 1000 * (6 / 2 * (1 - (1 / (1 + (100 - (LP - 0.01)) / 200)) ^ 20) / ((100 - (LP - 0.01)) / 200) + 100 * (1 / (1 + (100 - (LP - 0.01)) / 200)) ^ 20)) * MP(2) * 100

Strike = 1000 * (6 / 2 * (1 - (1 / (1 + (100 - LP) / 200)) ^ 20) / ((100 - LP) / 200) + 100 * (1 / (1 + (100 - LP) / 200)) ^ 20)

End If If IRD = 3 Then MPtemp = (1000 * (6 / 2 * (1 - (1 / (1 + (100 - LP) / 200)) ^ 6) / ((100 - LP) / 200) + 100 * (1 / (1 + (100 - LP) / 200)) ^

6) - 1000 * (6 / 2 * (1 - (1 / (1 + (100 - (LP - 0.01)) / 200)) ^ 6) / ((100 - (LP - 0.01)) / 200) + 100 * (1 / (1 + (100 - (LP - 0.01)) / 200)) ^ 6)) * MP(2) * 100

Strike = 1000 * (6 / 2 * (1 - (1 / (1 + (100 - LP) / 200)) ^ 6) / ((100 - LP) / 200) + 100 * (1 / (1 + (100 - LP) / 200)) ^ 6) End If If CSize > 0 And VOL(2) = 0 Then Factor = MPtemp / OptVal(OT, PutCall, UP, Strike, r, q, T - 1 / 360, VOL(2), DIV, 0) End If If Factor > 1 Or CSize < 0 Or VOL(2) <> 0 Then Factor = 1 End If VOLa(1) = VOLmin VOLa(2) = VOL(1) VOLau(1) = VOLmin VOLau(2) = VOL(1) + VOu VOLad(1) = VOLmin VOLad(2) = VOL(1) - VOd VOLb(1) = VOLmax VOLb(2) = VOL(2) VOLbu(1) = VOLmax VOLbu(2) = VOL(2) + VOu VOLbd(1) = VOLmax VOLbd(2) = VOL(2) - VOd adjp = (UP - BV) adjt = ER / ERD VF((n + 1) / 2, 3) = OptVal(OT, PutCall, UP + adjp, Strike, r, q, T, Application.Max(VOLa), DIV, 0) * CM * CSize VF((n + 1) / 2, 4) = OptVal(OT, PutCall, UP + adjp, Strike, r, q, T - adjt, Application.Min(VOLb), DIV, 0) * CM * CSize

* Factor VF((n + 1) / 2, 5) = OptVal(OT, PutCall, UP + adjp, Strike, r, q, T, Application.Max(VOLau), DIV, 0) * CM * CSize

78

VF((n + 1) / 2, 6) = OptVal(OT, PutCall, UP + adjp, Strike, r, q, T - adjt, Application.Min(VOLbu), DIV, 0) * CM * CSize * Factor

VF((n + 1) / 2, 1) = OptVal(OT, PutCall, UP + adjp, Strike, r, q, T, Application.Max(VOLad), DIV, 0) * CM * CSize VF((n + 1) / 2, 2) = OptVal(OT, PutCall, UP + adjp, Strike, r, q, T - adjt, Application.Min(VOLbd), DIV, 0) * CM * CSize

* Factor For i = 1 To (n - 1) / 2 VF(i, 3) = OptVal(OT, PutCall, UP + (i - 16) * Vd / (0.5 * (n - 1)) + adjp, Strike, r, q, T, Application.Max(VOLa), DIV,

0) * CM * CSize VF(i, 4) = OptVal(OT, PutCall, UP + (i - 16) * Vd / (0.5 * (n - 1)) + adjp, Strike, r, q, T - adjt, Application.Min(VOLb),

DIV, 0) * CM * CSize * Factor VF(i, 5) = OptVal(OT, PutCall, UP + (i - 16) * Vd / (0.5 * (n - 1)) + adjp, Strike, r, q, T, Application.Max(VOLau),

DIV, 0) * CM * CSize VF(i, 6) = OptVal(OT, PutCall, UP + (i - 16) * Vd / (0.5 * (n - 1)) + adjp, Strike, r, q, T - adjt, Application.Min(VOLbu),

DIV, 0) * CM * CSize * Factor VF(i, 1) = OptVal(OT, PutCall, UP + (i - 16) * Vd / (0.5 * (n - 1)) + adjp, Strike, r, q, T, Application.Max(VOLad),

DIV, 0) * CM * CSize VF(i, 2) = OptVal(OT, PutCall, UP + (i - 16) * Vd / (0.5 * (n - 1)) + adjp, Strike, r, q, T - adjt, Application.Min(VOLbd),

DIV, 0) * CM * CSize * Factor Next i For i = (n + 1) / 2 + 1 To n VF(i, 3) = OptVal(OT, PutCall, UP + (i - 16) * Vu / (0.5 * (n - 1)) + adjp, Strike, r, q, T, Application.Max(VOLa), DIV,

0) * CM * CSize VF(i, 4) = OptVal(OT, PutCall, UP + (i - 16) * Vu / (0.5 * (n - 1)) + adjp, Strike, r, q, T - adjt, Application.Min(VOLb),

DIV, 0) * CM * CSize * Factor VF(i, 5) = OptVal(OT, PutCall, UP + (i - 16) * Vu / (0.5 * (n - 1)) + adjp, Strike, r, q, T, Application.Max(VOLau),

DIV, 0) * CM * CSize VF(i, 6) = OptVal(OT, PutCall, UP + (i - 16) * Vu / (0.5 * (n - 1)) + adjp, Strike, r, q, T - adjt, Application.Min(VOLbu),

DIV, 0) * CM * CSize * Factor VF(i, 1) = OptVal(OT, PutCall, UP + (i - 16) * Vu / (0.5 * (n - 1)) + adjp, Strike, r, q, T, Application.Max(VOLad),

DIV, 0) * CM * CSize VF(i, 2) = OptVal(OT, PutCall, UP + (i - 16) * Vu / (0.5 * (n - 1)) + adjp, Strike, r, q, T - adjt, Application.Min(VOLbd),

DIV, 0) * CM * CSize * Factor Next i

minval = 100 * VALmin minzl = 100 * ZL For k = 1 To n For l = 1 To 5 Step 2 If Abs(VF(k, l)) < minval Then VF(k, l) = -minval End If Next l For M = 2 To 6 Step 2 If VF(k, M) < minzl Then VF(k, M) = 0 End If Next M

79

For z = 1 To 5 Step 2 PercentCheck = Abs(VF(k, z + 1) / VF(k, z)) If PercentCheck > 0.95 Then VF(k, z + 1) = Abs(VF(k, z)) * 0.95 End If Next z Next k

For j = 1 To n If b_s = 0 Then RM(j, 1) = VF(j, 2) RM(j, 2) = VF(j, 4) RM(j, 3) = VF(j, 6) ElseIf b_s = 1 Then RM(j, 1) = VF(j, 1) RM(j, 2) = VF(j, 3) RM(j, 3) = VF(j, 5) End If Cells(j + 1, tablevar).Value = RM(j, 1) Cells(j + 1, tablevar + 1).Value = RM(j, 2) Cells(j + 1, tablevar + 2).Value = RM(j, 3) Next j OptionCalculation = RM End Function

Private Function WindowMethod(NumOfContractsCC, VectorFiles, WindowSize)

Worksheets("OMSvectorsBidAsk").Activate Dim TotalVector(n, 3) As Double Static temp(Portfolio * 3) As Double Static X As Double For i = 1 To Portfolio * 3 temp(i) = temp(i) * 0 Next i If WindowSize = 0 Then For i = 1 To n For j = 0 To NumOfContractsCC * 3 - 1 Step 3 For k = 1 To 3 TotalVector(i, k) = TotalVector(i, k) + VectorFiles(i, j + k) Next k Next j Next i

80

Else X = (1 - WindowSize / 100) * (n - 1) X = Rounding(X) X = n - X Xtemp = X / 2 Xtest = RoundingDown(Xtemp) If Xtemp = Xtest Then X = X + 1 End If For i = 1 To n For j = 1 To NumOfContractsCC * 3 Step 3 S = i - (X - 1) / 2 If S < 1 Then S = 1 End If temp(j) = VectorFiles(S, j) For k = 0 To 2 For l = i - (X - 1) / 2 To i + (X - 1) / 2 If l < 1 Then l = 1 End If If VectorFiles(l, j + k) < 0 And temp(j) < 0 And temp(j) > VectorFiles(l, j + k) Then temp(j) = VectorFiles(l, j + k) ElseIf VectorFiles(l, j + k) > 0 And temp(j) > 0 And temp(j) > VectorFiles(l, j + k) Then temp(j) = VectorFiles(l, j + k) ElseIf VectorFiles(l, j + k) < 0 And temp(j) > 0 Then temp(j) = VectorFiles(l, j + k) End If If l = n Then GoTo exitl: End If Next l exitl: Next k Next j

81

TotalVector(i, 1) = Application.Sum(temp) TotalVector(i, 2) = TotalVector(i, 1) TotalVector(i, 3) = TotalVector(i, 1) Next i

End If

WindowMethod = TotalVector End Function

SPAN function

Option Base 1

Public Function SpanCalc(CCG, CCWS, ContractType, OptionType, PutCall, P, CM, ContractMonth, CMV, MP, LP, CP, VOL, T, q, DIV, ValInt, VO_d, VO_u, SpreadCharge2, InterestRD, TableOrTier, DeltaWeights, ChargeRateSO, DeltaScaling, DeltaScalingF, MarketSide, SpreadTier, DeltaRatio, SpreadCharge, Legs, CreditRate, Tier, TierMonths, IR, DeltaSpreadRat, CreditR, ICCindikator)

Dim ContractTypeCC(Portfolio) As Integer, ContractSizeCC(Portfolio) As Integer Dim ContractMonthCC(Portfolio) As Integer, TimeToMaturityCC(Portfolio) As Double Dim PutCallCC(Portfolio) As Integer, OptionTypeCC(Portfolio) As Integer Dim FullPriceMoveCC(Portfolio) As Double, SettlementValueCC(Portfolio) As Double Dim DeltaScalingFactorCC(Portfolio) As Double, UnderlyingPriceCC(Portfolio) As Double Dim StrikePriceCC(Portfolio) As Double, VolatilityCC(Portfolio) As Double Dim VOLScanRangeCC(Portfolio) As Double, DIV_CC(Portfolio) As Double Dim qCC(Portfolio) As Double, MultiplierCC(Portfolio) As Double Dim SR(Portfolio) As Double, IMC(Portfolio) As Double Dim SOMC(Portfolio) As Double, CCRisk(Portfolio) As Double, NOV(Portfolio) As Double Dim CCRorSOMC(Portfolio) As Double, InterestRD_CC(Portfolio) As Integer Static sumSR As Double, sumIMC As Double, sumISCr As Double Static sumSOMC As Double, sumCCRorSOMC As Double, sumNOV As Double Dim UnrNetDeltaFM(Months) As Double, SpreadCharge2CC(Portfolio) As Integer Dim WFPR(Portfolio) As Double, RTD(Portfolio) As Double, RMD(Portfolio, Months) As Double sumSR = sumSR * 0 sumIMC = sumIMC * 0 sumISCr = sumISCr * 0 sumSOMC = sumSOMC * 0 sumCCRorSOMC = sumCCRorSOMC * 0 sumNOV = sumNOV * 0 For i = 1 To Portfolio WFPR(i) = WFPR(i) * 0 RTD(i) = RTD(i) * 0 For j = 1 To Months RMD(i, j) = RMD(i, j) * 0 Next j Next i Static a As Double a = 1 Static b As Double b = CCWS(1) Static stepvar As Integer stepvar = 1

82

For v = 1 To Portfolio + 1 If v > Portfolio Then GoTo jump: If CCWS(v) = b Then PortfolioCC = PortfolioCC + 1 ContractTypeCC(PortfolioCC) = ContractType(v) ContractSizeCC(PortfolioCC) = P(v) ContractMonthCC(PortfolioCC) = ContractMonth(v) FullPriceMoveCC(PortfolioCC) = ValInt(v) SettlementValueCC(PortfolioCC) = MP(v) DeltaScalingFactorCC(PortfolioCC) = DeltaScalingF(v) UnderlyingPriceCC(PortfolioCC) = CMV(v) StrikePriceCC(PortfolioCC) = LP(v) TimeToMaturityCC(PortfolioCC) = T(v) VolatilityCC(PortfolioCC) = VOL(v) VOLScanRangeCC(PortfolioCC) = VO_u(v) DIV_CC(PortfolioCC) = DIV(v) PutCallCC(PortfolioCC) = PutCall(v) OptionTypeCC(PortfolioCC) = OptionType(v) qCC(PortfolioCC) = q(v) MultiplierCC(PortfolioCC) = CM(v) InterestRD_CC(PortfolioCC) = InterestRD(v) SpreadCharge2CC(PortfolioCC) = SpreadCharge2(v) Else jump: Worksheets("SPANvectors").Activate SMatrix = SpanMatrixFunc(PortfolioCC, ContractTypeCC, FullPriceMoveCC, SettlementValueCC, ContractSizeCC,

DeltaScalingFactorCC, DeltaWeights, ContractMonthCC, UnderlyingPriceCC, StrikePriceCC, VolatilityCC, VOLScanRangeCC, DIV_CC, TimeToMaturityCC, PutCallCC, OptionTypeCC, qCC, IR, MultiplierCC, InterestRD_CC)

For i = 1 To 16 For j = 1 To PortfolioCC Cells(i + 1, j + stepvar).Value = SMatrix(i, j) Next j Next i stepvar = stepvar + PortfolioCC For k = 1 To Months UnrNetDeltaFM(k) = SMatrix(17 + k, 1) Next k SR(a) = ScanRisk(PortfolioCC, ContractTypeCC, FullPriceMoveCC, SettlementValueCC, ContractSizeCC,

DeltaScalingFactorCC, DeltaWeights, ContractMonthCC, UnderlyingPriceCC, StrikePriceCC, VolatilityCC, VOLScanRangeCC, DIV_CC, TimeToMaturityCC, PutCallCC, OptionTypeCC, qCC, IR, MultiplierCC, InterestRD_CC)(1, 1)

If TableOrTier(v - 1) = 0 Then IMC(a) = IMCharge(PortfolioCC, UnrNetDeltaFM, Legs, SpreadTier, DeltaRatio, TierMonths, SpreadCharge,

MarketSide, Tier) ElseIf TableOrTier(v - 1) = 1 Then

83

IMC(a) = IMCharge2(UnrNetDeltaFM, SpreadCharge2CC) End If WFPR(a) = InterSpreadCrParameters(PortfolioCC, UnrNetDeltaFM, ContractTypeCC, FullPriceMoveCC,

SettlementValueCC, ContractSizeCC, DeltaScalingFactorCC, DeltaWeights, ContractMonthCC, UnderlyingPriceCC, StrikePriceCC, VolatilityCC, VOLScanRangeCC, DIV_CC, TimeToMaturityCC, PutCallCC, OptionTypeCC, qCC, IR, MultiplierCC, InterestRD_CC)(1)

RTD(a) = InterSpreadCrParameters(PortfolioCC, UnrNetDeltaFM, ContractTypeCC, FullPriceMoveCC, SettlementValueCC, ContractSizeCC, DeltaScalingFactorCC, DeltaWeights, ContractMonthCC, UnderlyingPriceCC, StrikePriceCC, VolatilityCC, VOLScanRangeCC, DIV_CC, TimeToMaturityCC, PutCallCC, OptionTypeCC, qCC, IR, MultiplierCC, InterestRD_CC)(2)

For i = 1 To Months RMD(a, i) = InterSpreadCrParameters(PortfolioCC, UnrNetDeltaFM, ContractTypeCC, FullPriceMoveCC,

SettlementValueCC, ContractSizeCC, DeltaScalingFactorCC, DeltaWeights, ContractMonthCC, UnderlyingPriceCC, StrikePriceCC, VolatilityCC, VOLScanRangeCC, DIV_CC, TimeToMaturityCC, PutCallCC, OptionTypeCC, qCC, IR, MultiplierCC, InterestRD_CC)(i + 2)

Next i SOMC(a) = ShortOptionMinCharge(PortfolioCC, ContractTypeCC, ContractSizeCC, ContractMonthCC,

ChargeRateSO, DeltaScaling, a) CCRisk(a) = SR(a) + IMC(a) NOV(a) = NetOV(PortfolioCC, ContractTypeCC, ContractSizeCC, SettlementValueCC, MultiplierCC,

StrikePriceCC, InterestRD_CC) CCRorSOMC(a) = Application.Max(CCRisk(a), SOMC(a)) - NOV(a) Worksheets("SPANmargin").Activate Cells(5 + a, 1) = SR(a) Cells(5 + a, 2) = IMC(a) Cells(5 + a, 4) = SOMC(a) Cells(5 + a, 6) = CCRorSOMC(a) Cells(5 + a, 5) = NOV(a) Worksheets("SPANvectors").Activate If v > Portfolio Then GoTo exitif: PortfolioCC = PortfolioCC * 0 a = a + 1 b = CCWS(v) v = v - 1 GoTo exitif: End If b = CCWS(v) exitif: Next v '--------------------------------------------------------------------------------------------------------' Worksheets("SPANmargin").Activate ISCr = InterSpreadCr(RTD, DeltaSpreadRat, CreditR, WFPR, ICCindikator)

84

For i = 1 To a sumSR = sumSR + SR(i) sumIMC = sumIMC + IMC(i) sumSOMC = sumSOMC + SOMC(i) sumCCRorSOMC = sumCCRorSOMC + CCRorSOMC(i) sumNOV = sumNOV + NOV(i) Next i If sumCCRorSOMC < 0 Then sumCCRorSOMC = 0 End If Cells(2, 1) = sumSR Cells(2, 2) = sumIMC Cells(2, 3) = sumISCr Cells(2, 4) = sumSOMC Cells(2, 6) = sumCCRorSOMC - ISCr Cells(2, 5) = sumNOV Cells(15, 2) = ISCr End Function

Private Function SpanMatrixFunc(PortfolioCC, ContractType, FullPriceMove, SettlementValueSMF, ContractSize, DeltaScalingFactor, DeltaWeights, ContractMonth, UP, LP, VOL, VOLScanRange, DIV, T, PutCall, OT, q, r, Multiplier, IRD) 'Calculates scaning risk

ReDim SpanMatrix(17 + Months, Portfolio) As Double Dim DeltaVec(16, Portfolio) As Double, VOLu As Double, VOLd As Double Dim NetDelta(Portfolio) As Double Static UnrNetDeltaFM(Months) As Double, UnrNetDelta As Double Static CompositeDelta(Portfolio) As Double Dim i As Integer, j As Integer, k As Integer, l As Integer Dim SVal(Portfolio) As Double, Strike(Portfolio) As Double For l = 1 To PortfolioCC CompositeDelta(l) = CompositeDelta(l) * 0 SVal(l) = SVal(l) * 0 SVal(l) = SettlementValueSMF(l) Strike(l) = Strike(l) * 0 Strike(l) = LP(l) Next l For k = 1 To Months UnrNetDeltaFM(k) = UnrNetDeltaFM(k) * 0 Next k UnrNetDelta = UnrNetDelta * 0

For i = 1 To PortfolioCC

If ContractType(i) = 0 Then 'Contract type = 0 signifyes a FUTURES contract SpanMatrix(1, i) = 0 SpanMatrix(2, i) = 0 DeltaVec(1, i) = 1 DeltaVec(2, i) = 1 For j = 4 To 12 Step 4 SpanMatrix(j - 1, i) = ContractSize(i) * Multiplier(i) * -(j - (3 * j / 4)) / 3 * FullPriceMove(i) SpanMatrix(j, i) = SpanMatrix(j - 1, i) SpanMatrix(j + 1, i) = ContractSize(i) * Multiplier(i) * (j - (3 * j / 4)) / 3 * FullPriceMove(i) SpanMatrix(j + 2, i) = SpanMatrix(j + 1, i) DeltaVec(j - 1, i) = 1

85

DeltaVec(j, i) = 1 DeltaVec(j + 1, i) = 1 DeltaVec(j + 2, i) = 1 Next j SpanMatrix(15, i) = ContractSize(i) * Multiplier(i) * (-2) * FullPriceMove(i) * 0.35 SpanMatrix(16, i) = ContractSize(i) * Multiplier(i) * 2 * FullPriceMove(i) * 0.35 DeltaVec(15, i) = 1 DeltaVec(16, i) = 1 ElseIf ContractType(i) = 1 Or ContractType(i) = 2 Then VOLu = VOL(i) + VOLScanRange(i) VOLd = VOL(i) - VOLScanRange(i) If IRD(i) = 1 Then SVal(i) = (1000000 * 365 / (365 + ((100 - LP(i)) * 90 / 100)) - 1000000 * 365 / (365 + ((100 - (LP(i) - 0.01)) * 90 /

100))) * SVal(i) * 100 Strike(i) = 1000000 * 365 / (365 + ((100 - LP(i)) * 90 / 100)) End If If IRD(i) = 2 Then SVal(i) = (1000 * (6 / 2 * (1 - (1 / (1 + (100 - LP(i)) / 200)) ^ 20) / ((100 - LP(i)) / 200) + 100 * (1 / (1 + (100 -

LP(i)) / 200)) ^ 20) - 1000 * (6 / 2 * (1 - (1 / (1 + (100 - (LP(i) - 0.01)) / 200)) ^ 20) / ((100 - (LP(i) - 0.01)) / 200) + 100 * (1 / (1 + (100 - (LP(i) - 0.01)) / 200)) ^ 20)) * SVal(i) * 100

Strike(i) = 1000 * (6 / 2 * (1 - (1 / (1 + (100 - LP(i)) / 200)) ^ 20) / ((100 - LP(i)) / 200) + 100 * (1 / (1 + (100 - LP(i)) / 200)) ^ 20)

End If If IRD(i) = 3 Then SVal(i) = (1000 * (6 / 2 * (1 - (1 / (1 + (100 - LP(i)) / 200)) ^ 6) / ((100 - LP(i)) / 200) + 100 * (1 / (1 + (100 -

LP(i)) / 200)) ^ 6) - 1000 * (6 / 2 * (1 - (1 / (1 + (100 - (LP(i) - 0.01)) / 200)) ^ 6) / ((100 - (LP(i) - 0.01)) / 200) + 100 * (1 / (1 + (100 - (LP(i) - 0.01)) / 200)) ^ 6)) * SVal(i) * 100

Strike(i) = 1000 * (6 / 2 * (1 - (1 / (1 + (100 - LP(i)) / 200)) ^ 6) / ((100 - LP(i)) / 200) + 100 * (1 / (1 + (100 - LP(i)) / 200)) ^ 6)

End If SpanMatrix(1, i) = ContractSize(i) * Multiplier(i) * (SVal(i) - OptVal(OT(i), PutCall(i), UP(i), Strike(i), r, q(i), T(i),

VOLu, DIV(i), 0)) SpanMatrix(2, i) = ContractSize(i) * Multiplier(i) * (SVal(i) - OptVal(OT(i), PutCall(i), UP(i), Strike(i), r, q(i), T(i),

VOLd, DIV(i), 0)) DeltaVec(1, i) = OptVal(OT(i), PutCall(i), UP(i), Strike(i), r, q(i), T(i), VOLu, DIV(i), 1) DeltaVec(2, i) = OptVal(OT(i), PutCall(i), UP(i), Strike(i), r, q(i), T(i), VOLd, DIV(i), 1) For j = 4 To 12 Step 4 SpanMatrix(j - 1, i) = ContractSize(i) * Multiplier(i) * (SVal(i) - OptVal(OT(i), PutCall(i), UP(i) + (j - (3 * j / 4)) /

3 * FullPriceMove(i), Strike(i), r, q(i), T(i), VOLu, DIV(i), 0)) SpanMatrix(j, i) = ContractSize(i) * Multiplier(i) * (SVal(i) - OptVal(OT(i), PutCall(i), UP(i) + (j - (3 * j / 4)) / 3 *

FullPriceMove(i), Strike(i), r, q(i), T(i), VOLd, DIV(i), 0)) SpanMatrix(j + 1, i) = ContractSize(i) * Multiplier(i) * (SVal(i) - OptVal(OT(i), PutCall(i), UP(i) - (j - (3 * j / 4)) /

3 * FullPriceMove(i), Strike(i), r, q(i), T(i), VOLu, DIV(i), 0)) SpanMatrix(j + 2, i) = ContractSize(i) * Multiplier(i) * (SVal(i) - OptVal(OT(i), PutCall(i), UP(i) - (j - (3 * j / 4)) /

3 * FullPriceMove(i), Strike(i), r, q(i), T(i), VOLd, DIV(i), 0)) DeltaVec(j - 1, i) = OptVal(OT(i), PutCall(i), UP(i) + (j - (3 * j / 4)) / 3 * FullPriceMove(i), Strike(i), r, q(i), T(i),

VOLu, DIV(i), 1) DeltaVec(j, i) = OptVal(OT(i), PutCall(i), UP(i) + (j - (3 * j / 4)) / 3 * FullPriceMove(i), Strike(i), r, q(i), T(i),

VOLd, DIV(i), 1)

86

DeltaVec(j + 1, i) = OptVal(OT(i), PutCall(i), UP(i) - (j - (3 * j / 4)) / 3 * FullPriceMove(i), Strike(i), r, q(i), T(i), VOLu, DIV(i), 1)

DeltaVec(j + 2, i) = OptVal(OT(i), PutCall(i), UP(i) - (j - (3 * j / 4)) / 3 * FullPriceMove(i), Strike(i), r, q(i), T(i), VOLd, DIV(i), 1)

Next j SpanMatrix(15, i) = ContractSize(i) * Multiplier(i) * (SVal(i) - OptVal(OT(i), PutCall(i), UP(i) + 2 *

FullPriceMove(i), Strike(i), r, q(i), T(i), VOL(i), DIV(i), 0)) * 0.35

SpanMatrix(16, i) = ContractSize(i) * Multiplier(i) * (SVal(i) - OptVal(OT(i), PutCall(i), UP(i) + (-2) * FullPriceMove(i), Strike(i), r, q(i), T(i), VOL(i), DIV(i), 0)) * 0.35

DeltaVec(15, i) = OptVal(OT(i), PutCall(i), UP(i) + 2 * FullPriceMove(i), Strike(i), r, q(i), T(i), VOL(i), DIV(i), 1) DeltaVec(16, i) = OptVal(OT(i), PutCall(i), UP(i) + (-2) * FullPriceMove(i), Strike(i), r, q(i), T(i), VOL(i), DIV(i), 1) End If

For k = 1 To 16 CompositeDelta(i) = CompositeDelta(i) + DeltaVec(k, i) * DeltaWeights(k, i) Next k

NetDelta(i) = DeltaScalingFactor(i) * ContractSize(i) * CompositeDelta(i)

UnrNetDeltaFM(ContractMonth(i)) = UnrNetDeltaFM(ContractMonth(i)) + NetDelta(i)

UnrNetDelta = UnrNetDelta + NetDelta(i)

Next i

SpanMatrix(17, 1) = UnrNetDelta For i = 1 To Months SpanMatrix(17 + i, 1) = UnrNetDeltaFM(i) Next i

SpanMatrixFunc = SpanMatrix

End Function

Private Function ScanRisk(PortfolioCC, ContractType, FullPriceMove, SettlementValueSR, ContractSize, DeltaScalingFactor, DeltaWeights, ContractMonth, UP, LP, VOL, VOLScanRange, DIV, T, PutCall, OT, q, r, Multiplier, IRD)

Static ScanRiskArray(16) As Double Dim TestMax As Double, ActiveScenario As Integer, PairedScenario As Integer Dim SRisk(2, 1) As Double For M = 1 To 16 ScanRiskArray(M) = ScanRiskArray(M) * 0 Next M ActiveScenario = 1

RiskMatrix = SpanMatrixFunc(PortfolioCC, ContractType, FullPriceMove, SettlementValueSR, ContractSize, DeltaScalingFactor, DeltaWeights, ContractMonth, UP, LP, VOL, VOLScanRange, DIV, T, PutCall, OT, q, r, Multiplier, IRD) 'Calculates scaning risk

TestMax = RiskMatrix(1, 1)

87

For k = 1 To 16

For l = 1 To PortfolioCC ScanRiskArray(k) = ScanRiskArray(k) + RiskMatrix(k, l) Next l If TestMax < ScanRiskArray(k) Then TestMax = ScanRiskArray(k) 'Letar rätt på maximal förlust ActiveScenario = k 'Sparar det scenario som har störst förlust End If Next k SRisk(1, 1) = TestMax If SRisk(1, 1) < 0 Then SRisk(1, 1) = 0 End If

If ActiveScenario = 1 Or ActiveScenario = 3 Or ActiveScenario = 5 Or ActiveScenario = 7 Or ActiveScenario = 9 Or ActiveScenario = 11 Or ActiveScenario = 13 Then

PairedScenario = ActiveScenario + 1 ElseIf ActiveScenario = 15 Or 16 Then PairedScenario = ActiveScenario Else PairedScenario = ActiveScenario - 1 End If

Dim FuturesPriceRisk As Double, WFuturesPriceRisk As Double Dim VolAdjScanRisk As Double Dim TimeRisk As Double Dim RoundNetDelta As Double UnrNetDelta = RiskMatrix(17, 1)

VolAdjScanRisk = (ScanRisk + ScanRiskArray(PairedScenario)) / 2 TimeRisk = (ScanRiskArray(1) + ScanRiskArray(2)) / 2 FuturesPriceRisk = Application.Max(VolAdjScanRisk - TimeRisk, 0) RoundNetDelta = Rounding(UnrNetDelta) If RoundNetDelta = 0 Then WFuturesPriceRisk = 0 Else WFuturesPriceRisk = FuturesPriceRisk / Abs(RoundNetDelta) End If

88

SRisk(2, 1) = WFuturesPriceRisk

ScanRisk = SRisk

End Function

Private Function IMCharge(PortfolioCC, UnrNetDeltaFM, Legs, SpreadTier, DeltaRatio, TierMonths, SpreadCharge, MarketSide, Tier) 'Calculates inter-month charges

Dim i As Integer, j As Integer, k As Integer, l As Integer, n As Integer, P As Integer, d As Integer, v As Integer Dim RoundedNetDeltaFM(Months) As Double Static PosDelta(Months) As Double, NegDelta(Months) As Double Dim RemPosDelta(Months) As Double, RemNegDelta(Months) As Double Static DeltaConsumedFM(Months) As Double Dim TotalCharge(Months) As Double, TotalSpread(Months) As Double Dim SpreadFormed(Months, 2) As Double Static IMC As Double IMC = IMC * 0

For i = 1 To Months

RoundedNetDeltaFM(i) = RoundingUp(UnrNetDeltaFM(i)) Next i For j = 1 To Tiers 'UBound(Tier, 2) PosDelta(j) = PosDelta(j) * 0 NegDelta(j) = NegDelta(j) * 0 For k = Tier(j, 1) To Tier(j, 2) If RoundedNetDeltaFM(k) > 0 Then PosDelta(j) = PosDelta(j) + RoundedNetDeltaFM(k) Else NegDelta(j) = NegDelta(j) + RoundedNetDeltaFM(k) End If Next k RemPosDelta(j) = PosDelta(j) RemNegDelta(j) = NegDelta(j) Next j

'Initialiseringar för spread beräkningarna IMCharge = 0 ReDim RemNetDeltaFM(UBound(RoundedNetDeltaFM)) As Double For v = 1 To UBound(RoundedNetDeltaFM) RemNetDeltaFM(v) = RoundedNetDeltaFM(v) Next v For n = 1 To Spreads 'Antalet Spreads som finns

89

ReDim LegSpread(Legs(n)) ReDim DeltaConsumed(Legs(n)) 'Assume long-market-side is the 'A' side For l = 1 To Legs(n) 'Antalet legs som finns i en Spread If MarketSide(n, l) = 0 Then '0 = A MarketSide LegSpread(l) = RoundingDown(Abs(RemPosDelta(SpreadTier(n, l))) / DeltaRatio(n, l)) If LegSpread(l) = 0 Then GoTo Skip2: ElseIf MarketSide(n, l) = 1 Then '1 = B MarketSide LegSpread(l) = RoundingDown(Abs(RemNegDelta(SpreadTier(n, l))) / DeltaRatio(n, l)) If LegSpread(l) = 0 Then GoTo Skip2: End If Next l SpreadFormed(n, 1) = Application.Min(LegSpread) For k = 1 To Legs(n) If MarketSide(n, k) = 0 Then DeltaConsumed(k) = SpreadFormed(n, 1) * DeltaRatio(n, k) RemPosDelta(SpreadTier(n, k)) = RemPosDelta(SpreadTier(n, k)) - DeltaConsumed(k) ElseIf MarketSide(n, k) = 1 Then DeltaConsumed(k) = SpreadFormed(n, 1) * DeltaRatio(n, k) * (-1) RemNegDelta(SpreadTier(n, k)) = RemNegDelta(SpreadTier(n, k)) - DeltaConsumed(k) End If Next k Skip2: 'Assume long-market-side is the 'B' side For l = 1 To Legs(n) If MarketSide(n, l) = 0 Then LegSpread(l) = RoundingDown(Abs(RemNegDelta(SpreadTier(n, l))) / DeltaRatio(n, l)) If LegSpread(l) = 0 Then GoTo Skip4: ElseIf MarketSide(n, l) = 1 Then

90

LegSpread(l) = RoundingDown(Abs(RemPosDelta(SpreadTier(n, l))) / DeltaRatio(n, l)) If LegSpread(l) = 0 Then GoTo Skip4: End If Next l SpreadFormed(n, 2) = Application.Min(LegSpread) For j = 1 To Legs(n) If MarketSide(n, j) = 0 Then DeltaConsumed(j) = SpreadFormed(n, 2) * DeltaRatio(n, j) * (-1) RemNegDelta(SpreadTier(n, j)) = RemNegDelta(SpreadTier(n, j)) - DeltaConsumed(j) ElseIf MarketSide(n, j) = 1 Then DeltaConsumed(j) = SpreadFormed(n, 2) * DeltaRatio(n, j) RemPosDelta(SpreadTier(n, j)) = RemPosDelta(SpreadTier(n, j)) - DeltaConsumed(j) End If Next j Skip4: TotalSpread(n) = SpreadFormed(n, 1) + SpreadFormed(n, 2) TotalCharge(n) = TotalSpread(n) * SpreadCharge(n) IMC = IMC + TotalCharge(n) Next n IMCharge = IMC End Function

Private Function IMCharge2(UnrNetDeltaFM, SpreadCharge) 'Calculates inter-month charges

Dim j As Integer Static PosDelta2 As Double, NegDelta2 As Double Dim DeltaVec(2) As Integer Dim IMC As Double PosDelta2 = PosDelta2 * 0 NegDelta2 = NegDelta2 * 0 For j = 1 To Months If UnrNetDeltaFM(j) > 0 Then PosDelta2 = PosDelta2 + UnrNetDeltaFM(j) Else NegDelta2 = NegDelta2 + UnrNetDeltaFM(j)

91

End If Next j PosDelta2 = Rounding(PosDelta2) NegDelta2 = Rounding(NegDelta2) DeltaVec(1) = Abs(PosDelta2) DeltaVec(2) = Abs(NegDelta2) NoOfSpreads = Application.Min(DeltaVec)

IMC = NoOfSpreads * SpreadCharge(1) IMCharge2 = IMC End Function

Private Function InterSpreadCrParameters(PortfolioCC, UnrNetDeltaFM, ContractType, FullPriceMove, SettlementValueISC, ContractSize, DeltaScalingFactor, DeltaWeights, ContractMonth, UP, LP, VOL, VOLScanRange, DIV, T, PutCall, OT, q, r, Multiplier, IRD) 'Calculates intercommodity spread credit parameters

Dim dummy As Integer, RemMonthDelta(Months) As Double, NumLegSpreads(2) As Double Dim ISCP(Months + 2) As Double Static ICSpreadCr As Double ICSpreadCr = ICSpreadCr * 0

WFuturesPriceRisk = ScanRisk(PortfolioCC, ContractType, FullPriceMove, SettlementValueISC, ContractSize, DeltaScalingFactor, DeltaWeights, ContractMonth, UP, LP, VOL, VOLScanRange, DIV, T, PutCall, OT, q, r, Multiplier, IRD)(2, 1)

UnrNetDelta = SpanMatrixFunc(PortfolioCC, ContractType, FullPriceMove, SettlementValueISC, ContractSize, DeltaScalingFactor, DeltaWeights, ContractMonth, UP, LP, VOL, VOLScanRange, DIV, T, PutCall, OT, q, r, Multiplier, IRD)(17, 1)

RemTotDelta = RoundingDown(UnrNetDelta) For i = 1 To Months RemMonthDelta(i) = RoundingDown(UnrNetDeltaFM(i)) Next i ISCP(1) = WFuturesPriceRisk ISCP(2) = RemTotDelta For i = 3 To Months + 2 ISCP(i) = RemMonthDelta(i - 2) Next i InterSpreadCrParameters = ISCP End Function

Private Function InterSpreadCr(RemTotDelta, DeltaSpreadRatio, CreditRate, WFuturesPriceRisk, ICCI) 'Calculates intercommodity spread credit

Dim dummy(2) As Integer, NumLegSpreads(2) As Double Static ICSpreadCr As Double ICSpreadCr = ICSpreadCr * 0

92

For j = 1 To CreditSpreads If RemTotDelta(ICCI(j, 1)) > 0 Then 'MarketSide is associated with positive delta values dummy(1) = 0 dummy(2) = 1 ElseIf RemTotDelta(ICCI(j, 1)) < 0 Then 'MarketSide is associated with negative delta values dummy(1) = 1 dummy(2) = 0 ElseIf RemTotDelta(ICCI(j, 1)) = 0 Then GoTo Exit3: End If For k = 1 To 2 If dummy(k) = 0 And RemTotDelta(ICCI(j, k)) < 0 Then GoTo Exit3: If dummy(k) = 1 And RemTotDelta(ICCI(j, k)) > 0 Then GoTo Exit3: NumLegSpreads(k) = Abs(RemTotDelta(ICCI(j, k)) / DeltaSpreadRatio(j, k)) Next k SpreadsFormed = Application.Min(NumLegSpreads) For l = 1 To 2 If dummy(l) = 0 And RemTotDelta(ICCI(j, l)) < 0 Then GoTo Exit3: If dummy(l) = 1 And RemTotDelta(ICCI(j, l)) > 0 Then GoTo Exit3: DeltaConsumed = SpreadsFormed * DeltaSpreadRatio(j, l) If RemTotDelta(ICCI(j, l)) > 0 Then RemTotDelta(ICCI(j, l)) = RemTotDelta(ICCI(j, l)) - DeltaConsumed ElseIf RemTotDelta(ICCI(j, l)) < 0 Then RemTotDelta(ICCI(j, l)) = -(Abs(RemTotDelta(ICCI(j, l))) - DeltaConsumed) End If ICSpreadCr = ICSpreadCr + WFuturesPriceRisk(j) * DeltaConsumed * CreditRate(j) Next l Exit3:

Next j InterSpreadCr = ICSpreadCr End Function

Private Function ShortOptionMinCharge(PortfolioCC, ContractType, ContractSize, ContractMonth, ChargeRateSO, DeltaScaling, a) 'Compares CCR with SOM and take the largest of them

Static NumbOfWrittenOP(Months) As Integer

93

ShortOptMinCharge = ShortOptMinCharge * 0 For k = 1 To Months NumbOfWrittenOP(k) = NumbOfWrittenOP(k) * 0 Next k

For i = 1 To PortfolioCC If ContractType(i) = 1 Or ContractType(i) = 2 And ContractSize(i) < 0 Then NumbOfWrittenOP(ContractMonth(i)) = NumbOfWrittenOP(ContractMonth(i)) + ContractSize(i) End If Next i For j = 1 To Months ShortOptMinCharge = ShortOptMinCharge + NumbOfWrittenOP(j) * ChargeRateSO(j, a) * DeltaScaling(j, a) Next j ShortOptionMinCharge = ShortOptMinCharge

End FunctionPrivate Function NetOV(PortfolioCC, ContractType, ContractSize, SettlementValueNOV, Multiplier, LP, IRD) For i = 1 To PortfolioCC If ContractType(i) = 2 Then If IRD(i) = 1 Then SettlementValueNOV(i) = (1000000 * 365 / (365 + ((100 - LP(i)) * 90 / 100)) - 1000000 * 365 / (365 + ((100 -

(LP(i) - 0.01)) * 90 / 100))) * SettlementValueNOV(i) * 100 End If If IRD(i) = 2 Then SettlementValueNOV(i) = (1000 * (6 / 2 * (1 - (1 / (1 + (100 - LP(i)) / 200)) ^ 20) / ((100 - LP(i)) / 200) + 100 *

(1 / (1 + (100 - LP(i)) / 200)) ^ 20) - 1000 * (6 / 2 * (1 - (1 / (1 + (100 - (LP(i) - 0.01)) / 200)) ^ 20) / ((100 - (LP(i) - 0.01)) / 200) + 100 * (1 / (1 + (100 - (LP(i) - 0.01)) / 200)) ^ 20)) * SettlementValueNOV(i) * 100

End If If IRD(i) = 3 Then SettlementValueNOV(i) = (1000 * (6 / 2 * (1 - (1 / (1 + (100 - LP(i)) / 200)) ^ 6) / ((100 - LP(i)) / 200) + 100 * (1 /

(1 + (100 - LP(i)) / 200)) ^ 6) - 1000 * (6 / 2 * (1 - (1 / (1 + (100 - (LP(i) - 0.01)) / 200)) ^ 6) / ((100 - (LP(i) - 0.01)) / 200) + 100 * (1 / (1 + (100 - (LP(i) - 0.01)) / 200)) ^ 6)) * SettlementValueNOV(i) * 100

End If If ContractSize(i) < 0 Then ShortOptionValue = ShortOptionValue + SettlementValueNOV(i) * (-ContractSize(i)) * Multiplier(i) ElseIf ContractSize(i) > 0 Then LongOptionValue = LongOptionValue + SettlementValueNOV(i) * ContractSize(i) * Multiplier(i)

94

End If End If Next i NetOV = LongOptionValue - ShortOptionValue

End Function

TIMS function

Option Base 1

Public Function TimsCalculator(CCG, CC, ContractType, OptionType, PutCall, P, Excercised, Assigned, CM, ContractMonth, CMV, MP, LP, CP, VOL, T, q, DIV, ValInt, VO_d, VO_u, SpotSpreadRate, NonSpotSpreadRate, OptionsMinimumMargin, FuturesMinimumMargin, Offset, ShortAdjustment, InterestRD, IR)

Dim IvecCG(Portfolio) As Integer Dim CGpartOfPg(Portfolio) As Double Dim ContractTypeCG(Portfolio) As Integer Dim PC_CG(Portfolio) As Integer Static PortfolioCG As Integer Dim ContractMonthCG(Portfolio) As Integer Dim ContractSizeCG(Portfolio) As Integer Dim SpotSpreadRateC As Double, NonSpotSpreadRateC As Double Dim TheoreticalValue(10, Portfolio) As Double, TV_CG(10, Portfolio) As Double Dim StrikePriceCG(Portfolio) As Double Dim ExcercisedCQ_CG(Portfolio) As Integer Dim AssignedCQ_CG(Portfolio) As Integer Dim MultiplierCG(Portfolio) As Double Dim ClosingPriceCG(Portfolio) As Double Dim UnderlyingPriceCG(Portfolio) As Double Dim ShortOptAdjustmentCG(Portfolio) As Double Dim PGOffsetCG(Portfolio) As Double Dim MinMargRateOptCG(Portfolio) As Double, MinMargRateFutCG(Portfolio) As Double Dim MarginInt(Portfolio) As Double Dim OptionTypeCG(Portfolio) As Integer, qCG(Portfolio) As Double Dim TimeToMaturityCG(Portfolio) As Double, VolatilityCG(Portfolio) As Double Dim DividendCG(Portfolio) As Double Dim InterestRD_CG(Portfolio) As Integer Dim FSM(Portfolio) As Double Dim CPM(Portfolio) As Double Dim AMCG(10, Portfolio) As Double Dim MMCG(Portfolio) As Double Static AMPGvec(10, Portfolio) As Double, MMPG(Portfolio) As Double Static FSMPG(Portfolio) As Double, PMPG(Portfolio) As Double For j = 1 To Portfolio For i = 1 To 10 AMPGvec(i, j) = AMPGvec(i, j) * 0 Next i MMPG(j) = MMPG(j) * 0 FSMPG(j) = FSMPG(j) * 0 PMPG(j) = PMPG(j) * 0 Next j Dim AMPG(Portfolio) As Double Dim givePG(Portfolio) As Double

95

PortfolioCG = PortfolioCG * 0

Worksheets("TIMSmargin").Activate Static a As Double a = 1 Static b As Double b = CC(1) Dim PG(Portfolio) As Double Static stepvar As Integer stepvar = 1 For k = 1 To Portfolio + 1 If k > Portfolio Then GoTo jump: If CC(k) = b Then PG(a) = CC(k) PortfolioCG = PortfolioCG + 1 ContractSizeCG(PortfolioCG) = P(k) ContractMonthCG(PortfolioCG) = ContractMonth(k) SpotSpreadRateC = SpotSpreadRate(k) NonSpotSpreadRateC = NonSpotSpreadRate(k) MultiplierCG(PortfolioCG) = CM(k) ContractTypeCG(PortfolioCG) = ContractType(k) ClosingPriceCG(PortfolioCG) = MP(k) UnderlyingPriceCG(PortfolioCG) = CMV(k) StrikePriceCG(PortfolioCG) = LP(k) PC_CG(PortfolioCG) = PutCall(k) ExcercisedCQ_CG(PortfolioCG) = Excercised(k) AssignedCQ_CG(PortfolioCG) = Assigned(k) ShortOptAdjustmentCG(PortfolioCG) = ShortAdjustment(k) PGOffsetCG(PortfolioCG) = Offset(k) MinMargRateOptCG(PortfolioCG) = OptionsMinimumMargin(k) MinMargRateFutCG(PortfolioCG) = FuturesMinimumMargin(k) IvecCG(PortfolioCG) = CCG(k) MarginInt(PortfolioCG) = ValInt(k) OptionTypeCG(PortfolioCG) = OptionType(k) qCG(PortfolioCG) = q(k) TimeToMaturityCG(PortfolioCG) = T(k) VolatilityCG(PortfolioCG) = VOL(k) DividendCG(PortfolioCG) = DIV(k) InterestRD_CG(PortfolioCG) = InterestRD(k) Else jump: FSM(a) = FuturesSpreadMargin(ContractTypeCG, PortfolioCG, ContractSizeCG, ContractMonthCG,

SpotSpreadRateC, NonSpotSpreadRateC) CPM(a) = CalculatePremiumMargin(PortfolioCG, ContractTypeCG, ContractSizeCG, AssignedCQ_CG,

ExcercisedCQ_CG, ClosingPriceCG, MultiplierCG, UnderlyingPriceCG, StrikePriceCG, PC_CG, OptionTypeCG, IR, qCG, TimeToMaturityCG, VolatilityCG, DividendCG, InterestRD_CG)

Worksheets("TIMSvectors").Activate AMIP = AdditionalMarginIndPos(MarginInt, ContractSizeCG, UnderlyingPriceCG, StrikePriceCG,

AssignedCQ_CG, ExcercisedCQ_CG, PortfolioCG, MultiplierCG, PC_CG, ContractTypeCG,

96

ShortOptAdjustmentCG, ClosingPriceCG, OptionTypeCG, IR, qCG, TimeToMaturityCG, VolatilityCG, DividendCG, InterestRD_CG)

For j = 1 To PortfolioCG For M = 1 To 10 Cells(13 + M, j + stepvar).Value = AMIP(M, j) Next M Next j stepvar = stepvar + PortfolioCG Worksheets("TIMSmargin").Activate AdMCG = AdditionalMarginClassGroup(MarginInt, ContractSizeCG, UnderlyingPriceCG, StrikePriceCG,

AssignedCQ_CG, ExcercisedCQ_CG, PortfolioCG, MultiplierCG, PC_CG, ContractTypeCG, ShortOptAdjustmentCG, IvecCG, PGOffsetCG, ClosingPriceCG, OptionTypeCG, IR, qCG, TimeToMaturityCG, VolatilityCG, DividendCG, InterestRD_CG)

For j = 1 To 10 AMCG(j, a) = AdMCG(j) Next j MMCG(a) = MinimumMarginCG(ContractTypeCG, ContractSizeCG, PortfolioCG, PC_CG, MinMargRateOptCG,

MinMargRateFutCG, AssignedCQ_CG, ExcercisedCQ_CG, ClosingPriceCG, MultiplierCG, UnderlyingPriceCG, StrikePriceCG, OptionTypeCG, IR, qCG, TimeToMaturityCG, VolatilityCG, DividendCG, InterestRD_CG)

If k > Portfolio Then GoTo exitif: PortfolioCG = 0 a = a + 1 b = CC(k) k = k - 1 GoTo exitif: End If b = CC(k) exitif: Next k c = RoundingDown(PG(1)) d = 1

avar = a

If Portfolio = 1 Then avar = a - 1 End If

For l = 1 To avar ltemp = l If l > a Then ltemp = l - 1 GoTo enterif: End If If RoundingDown(PG(l)) = c Then enterif:

97

For j = 1 To 10 AMPGvec(j, d) = AMPGvec(j, d) + AMCG(j, ltemp) Next j MMPG(d) = MMPG(d) + MMCG(ltemp) FSMPG(d) = FSMPG(d) + FSM(ltemp) PMPG(d) = PMPG(d) + CPM(ltemp) Else If l > a Then GoTo exitif2: d = d + 1 c = RoundingDown(PG(l)) l = l - 1 GoTo exitif2: End If If l <= a Then givePG(d) = PG(l) End If c = RoundingDown(PG(l)) exitif2: Next l Dim temp(10) As Double For i = 1 To d For S = 1 To 10 temp(S) = AMPGvec(S, i) Next S AMPG(i) = Application.Max(temp) If MMPG(i) > AMPG(i) Then AMPG(i) = MMPG(i) End If Next i Static ATM As Double ATM = ATM * 0 For k = 1 To d Cells(1, k + 1).Value = RoundingDown(givePG(k)) Cells(2, k + 1).Value = FSMPG(k) Cells(3, k + 1).Value = PMPG(k) Cells(4, k + 1).Value = MMPG(k) Cells(5, k + 1).Value = AMPG(k) Cells(7, k + 1).Value = FSMPG(k) + PMPG(k) + AMPG(k) ATM = ATM + FSMPG(k) + PMPG(k) + AMPG(k) Next k If ATM < 0 Then ATM = 0 End If Cells(9, 2).Value = ATM

98

Worksheets("TIMSvectors").Activate For l = 1 To d For k = 1 To 10 Cells(k, l + 1) = AMPGvec(k, l) Next k Next l End Function

Private Function FuturesSpreadMargin(ContractTypeCG, PortfolioCG, ContractSizeCG, ContractMonthCG, SpotSpreadRate, NonSpotSpreadRate)

Dim i, j, k, l As Integer Static NetLong As Integer Static NetShort As Integer Dim SpreadLongQ As Integer Dim SpreadShortQ As Integer Dim TotalSpreadQ As Integer Dim SpotMonthSpreadCQ As Integer Dim NonSpotSpreadQ As Integer Dim TotalNonSpreadCQ As Integer Dim SpotSpreadMargin As Double Dim NonSpotSpreadMargin As Double Dim TotalSpreadMargin As Double NetLong = NetLong * 0 NetShort = NetShort * 0 For i = 1 To PortfolioCG If ContractTypeCG(i) = 0 Then If ContractSizeCG(i) < 0 Then NetShort = NetShort + (-ContractSizeCG(i)) Else NetLong = NetLong + ContractSizeCG(i) End If End If Next i If NetShort = 0 Then SpreadLongQ = NetLong SpreadShortQ = NetLong Else If NetShort < NetLong Or NetLong = 0 Then SpreadLongQ = NetShort SpreadShortQ = NetShort

99

Else SpreadLongQ = NetLong SpreadShortQ = NetLong End If End If TotalSpreadQ = SpreadLongQ + SpreadShortQ If ContractTypeCG(1) = 0 Then If ContractSizeCG(1) > 0 Then If ContractSizeCG(1) <= SpreadLongQ Then SpotMonthSpreadCQ = ContractSizeCG(1) Else SpotMonthSpreadCQ = SpreadLongQ End If ElseIf ContractSizeCG(1) < 0 Then If (-ContractSizeCG(1)) <= SpreadShortQ Then SpotMonthSpreadCQ = (-ContractSizeCG(1)) Else SpotMonthSpreadCQ = SpreadShortQ End If End If NonSpotSpreadQ = TotalSpreadQ - SpotMonthSpreadCQ End If SpotSpreadMargin = SpotSpreadRate * SpotMonthSpreadCQ NonSpotSpreadMargin = NonSpotSpreadRate * NonSpotSpreadQ TotalSpreadMargin = SpotSpreadMargin + NonSpotSpreadMargin If NetShort = 0 Or NetLong = 0 Then TotalSpreadMargin = 0 End If TotalNonSpreadCQ = NetShort - NetLong FuturesSpreadMargin = TotalSpreadMargin

100

End Function

Private Function DeliveryMarginFutures(ContractSizeF, DeliveryRate)

Dim DeliveryMargin As Integer DeliveryMargin = DeliveryRate * ContractSizeF End Function

Private Function CalculatePremiumMargin(PortfolioCG, ContractTypeCG, ContractSizeCG, AssignedCQ_CG, ExcercisedCQ_CG, ClosingPriceCPM, MultiplierCG, UnderlyingPriceCG, StrikePriceCG, PutCallCG, OT, r, q, T, VOL, DIV, IRD)

Dim ShortContractQ, LongContractQ As Integer Dim NetOpenPos(Portfolio) As Integer Dim NetEAQ(Portfolio) As Integer Dim PremiumMarginO(Portfolio) As Double Dim PremiumMarginEA(Portfolio) As Double Dim InTheMoneyAmount(Portfolio) As Double Static TotalPremiumMargin As Double Dim SVal(Portfolio) As Double, Strike(Portfolio) As Double For il = 1 To PortfolioCG SVal(il) = SVal(il) * 0 SVal(il) = ClosingPriceCPM(il) Strike(il) = Strike(il) * 0 Strike(il) = StrikePriceCG(il) Next il TotalPremiumMargin = TotalPremiumMargin * 0 Dim i As Integer For i = 1 To PortfolioCG If IRD(i) = 1 Then SVal(i) = (1000000 * 365 / (365 + ((100 - StrikePriceCG(i)) * 90 / 100)) - 1000000 * 365 / (365 + ((100 -

(StrikePriceCG(i) - 0.01)) * 90 / 100))) * ClosingPriceCPM(i) * 100

Strike(i) = 1000000 * 365 / (365 + ((100 - StrikePriceCG(i)) * 90 / 100)) End If If IRD(i) = 2 Then SVal(i) = (1000 * (6 / 2 * (1 - (1 / (1 + (100 - StrikePriceCG(i)) / 200)) ^ 20) / ((100 - StrikePriceCG(i)) / 200) + 100 *

(1 / (1 + (100 - StrikePriceCG(i)) / 200)) ^ 20) - 1000 * (6 / 2 * (1 - (1 / (1 + (100 - (StrikePriceCG(i) - 0.01)) / 200)) ^ 20) / ((100 - (StrikePriceCG(i) - 0.01)) / 200) + 100 * (1 / (1 + (100 - (StrikePriceCG(i) - 0.01)) / 200)) ^ 20)) * ClosingPriceCPM(i) * 100

Strike(i) = 1000 * (6 / 2 * (1 - (1 / (1 + (100 - StrikePriceCG(i)) / 200)) ^ 20) / ((100 - StrikePriceCG(i)) / 200) + 100 * (1 / (1 + (100 - StrikePriceCG(i)) / 200)) ^ 20)

End If If IRD(i) = 3 Then SVal(i) = (1000 * (6 / 2 * (1 - (1 / (1 + (100 - StrikePriceCG(i)) / 200)) ^ 6) / ((100 - StrikePriceCG(i)) / 200) + 100 *

(1 / (1 + (100 - StrikePriceCG(i)) / 200)) ^ 6) - 1000 * (6 / 2 * (1 - (1 / (1 + (100 - (StrikePriceCG(i) - 0.01)) / 200)) ^ 6) / ((100 - (StrikePriceCG(i) - 0.01)) / 200) + 100 * (1 / (1 + (100 -

101

(StrikePriceCG(i) - 0.01)) / 200)) ^ 6)) * ClosingPriceCPM(i) * 100

Strike(i) = 1000 * (6 / 2 * (1 - (1 / (1 + (100 - StrikePriceCG(i)) / 200)) ^ 6) / ((100 - StrikePriceCG(i)) / 200) + 100 * (1 / (1 + (100 - StrikePriceCG(i)) / 200)) ^ 6)

End If If ContractTypeCG(i) = 2 Then NetOpenPos(i) = -1 * ContractSizeCG(i) 'NetOpenPos(i) = ShortContractQ(i) - LongContractQ(i) NetEAQ(i) = AssignedCQ_CG(i) - ExcercisedCQ_CG(i) PremiumMarginO(i) = SVal(i) * NetOpenPos(i) * MultiplierCG(i) If PutCallCG(i) = 1 Then InTheMoneyAmount(i) = UnderlyingPriceCG(i) - Strike(i) ElseIf PutCallCG(i) = -1 Then InTheMoneyAmount(i) = Strike(i) - UnderlyingPriceCG(i)

End If

PremiumMarginEA(i) = InTheMoneyAmount(i) * NetEAQ(i) * MultiplierCG(i) End If Next i For l = 1 To PortfolioCG TotalPremiumMargin = TotalPremiumMargin + PremiumMarginO(l) + PremiumMarginEA(l) Next l CalculatePremiumMargin = TotalPremiumMargin

End Function

Private Function AdditionalMarginIndPos(MI, ContractSize, UnderlyingPrice, StrikePrice, AssignedCQ, ExcercisedCQ, PortfolioCG, Multiplier, PutCall, ContractType, ShortOptionAdj, SettlementValueAMIP, OT, r, q, T, VOL, DIV, IRD)

Dim AdditionalMargin(10, Portfolio) As Double Dim EATheoreticalValue(10, Portfolio) As Double Dim InTheMoneyAmount(Portfolio) As Double Dim EAGainLoss(10, Portfolio) As Double Dim NetOpenPos(Portfolio) As Integer Dim NetEAQ(Portfolio) As Integer Dim SVal(Portfolio) As Double, Strike(Portfolio) As Double Dim j As Integer, k As Integer, l As Integer For il = 1 To PortfolioCG SVal(il) = SVal(il) * 0 SVal(il) = SettlementValueAMIP(il) Strike(il) = Strike(il) * 0 Strike(il) = StrikePrice(il) Next il

102

For j = 1 To PortfolioCG

NetOpenPos(j) = -1 * ContractSize(j) 'NetOpenPos(j) = ShortContractQ(j) - LongContractQ(j) NetEAQ(j) = AssignedCQ(j) - ExcercisedCQ(j) If NetOpenPos(j) <> 0 Then If ContractType(j) = 0 Then For k = 1 To 5 AdditionalMargin(k, j) = NetOpenPos(j) * ((UnderlyingPrice(j) - (6 - k) / 5 * MI(j)) - UnderlyingPrice(j)) *

Multiplier(j) Next k For k = 6 To 10 AdditionalMargin(k, j) = NetOpenPos(j) * ((UnderlyingPrice(j) + (k - 5) / 5 * MI(j)) - UnderlyingPrice(j)) *

Multiplier(j) Next k ElseIf ContractType(j) = 1 Or ContractType(j) = 2 Then If IRD(j) = 1 Then SVal(j) = (1000000 * 365 / (365 + ((100 - StrikePrice(j)) * 90 / 100)) - 1000000 * 365 / (365 + ((100 -

(StrikePrice(j) - 0.01)) * 90 / 100))) * SettlementValueAMIP(j) * 100

Strike(j) = 1000000 * 365 / (365 + ((100 - StrikePrice(j)) * 90 / 100)) End If If IRD(j) = 2 Then SVal(j) = (1000 * (6 / 2 * (1 - (1 / (1 + (100 - StrikePrice(j)) / 200)) ^ 20) / ((100 - StrikePrice(j)) / 200) + 100 *

(1 / (1 + (100 - StrikePrice(j)) / 200)) ^ 20) - 1000 * (6 / 2 * (1 - (1 / (1 + (100 - (StrikePrice(j) - 0.01)) / 200)) ^ 20) / ((100 - (StrikePrice(j) - 0.01)) / 200) + 100 * (1 / (1 + (100 - (StrikePrice(j) - 0.01)) / 200)) ^ 20)) * SettlementValueAMIP(j) * 100

Strike(j) = 1000 * (6 / 2 * (1 - (1 / (1 + (100 - StrikePrice(j)) / 200)) ^ 20) / ((100 - StrikePrice(j)) / 200) + 100 * (1 / (1 + (100 - StrikePrice(j)) / 200)) ^ 20)

End If If IRD(j) = 3 Then SVal(j) = (1000 * (6 / 2 * (1 - (1 / (1 + (100 - StrikePrice(j)) / 200)) ^ 6) / ((100 - StrikePrice(j)) / 200) + 100 * (1

/ (1 + (100 - StrikePrice(j)) / 200)) ^ 6) - 1000 * (6 / 2 * (1 - (1 / (1 + (100 - (StrikePrice(j) - 0.01)) / 200)) ^ 6) / ((100 - (StrikePrice(j) - 0.01)) / 200) + 100 * (1 / (1 + (100 - (StrikePrice(j) - 0.01)) / 200)) ^ 6)) * SettlementValueAMIP(j) * 100

Strike(j) = 1000 * (6 / 2 * (1 - (1 / (1 + (100 - StrikePrice(j)) / 200)) ^ 6) / ((100 - StrikePrice(j)) / 200) + 100 * (1 / (1 + (100 - StrikePrice(j)) / 200)) ^ 6)

End If For k = 1 To 5

103

AdditionalMargin(k, j) = NetOpenPos(j) * (OptVal(OT(j), PutCall(j), (UnderlyingPrice(j) - (6 - k) / 5 * MI(j)),

Strike(j), r, q(j), T(j), VOL(j), DIV(j), 0) - SVal(j)) * Multiplier(j)

Next k For k = 6 To 10 AdditionalMargin(k, j) = NetOpenPos(j) * (OptVal(OT(j), PutCall(j), (UnderlyingPrice(j) + (k - 5) / 5 * MI(j)),

Strike(j), r, q(j), T(j), VOL(j), DIV(j), 0) - SVal(j)) * Multiplier(j)

Next k TV1 = (OptVal(OT(j), PutCall(j), (UnderlyingPrice(j) - MI(j)), Strike(j), r, q(j), T(j), VOL(j), DIV(j), 0) - SVal(j)) TV2 = (OptVal(OT(j), PutCall(j), (UnderlyingPrice(j) + MI(j)), Strike(j), r, q(j), T(j), VOL(j), DIV(j), 0) - SVal(j)) If PutCall(j) = 1 And ShortOptionAdj(j) > TV2 Then AdditionalMargin(1, j) = NetOpenPos(j) * ShortOptionAdj(j) * Multiplier(j) ElseIf PutCall(j) = -1 And ShortOptionAdj(j) > TV1 Then AdditionalMargin(10, j) = NetOpenPos(j) * ShortOptionAdj(j) * Multiplier(j) End If End If ElseIf NetEAQ(j) <> 0 Then If PutCall(j) = 1 Then InTheMoneyAmount(j) = UnderlyingPrice(j) - Strike(j) For l = 1 To 5 EATheoreticalValue(l, j) = (UnderlyingPrice(j) - (6 - k) / 5 * MI(j)) - Strike(j) EAGainLoss(l, j) = EATheoreticalValue(l, j) - InTheMoneyAmount(j) AdditionalMargin(l, j) = NetEAQ(j) * EAGainLoss(l, j) * Multiplier(j) Next l For l = 6 To 10 EATheoreticalValue(l, j) = (UnderlyingPrice(j) - (k - 5) / 5 * MI(j)) - Strike(j) EAGainLoss(l, j) = EATheoreticalValue(l, j) - InTheMoneyAmount(j) AdditionalMargin(l, j) = NetEAQ(j) * EAGainLoss(l, j) * Multiplier(j) Next l ElseIf PutCall(j) = -1 Then InTheMoneyAmount(j) = Strike(j) - UnderlyingPrice(j)

104

For l = 1 To 5 EATheoreticalValue(l, j) = Strike(j) - (UnderlyingPrice(j) - (6 - k) / 5 * MI(j)) EAGainLoss(l, j) = EATheoreticalValue(l, j) - InTheMoneyAmount(j) AdditionalMargin(l, j) = NetEAQ(j) * EAGainLoss(l, j) * Multiplier(j) Next l For l = 6 To 10 EATheoreticalValue(l, j) = Strike(j) - (UnderlyingPrice(j) - (k - 5) / 5 * MI(j)) EAGainLoss(l, j) = EATheoreticalValue(l, j) - InTheMoneyAmount(j) AdditionalMargin(l, j) = NetEAQ(j) * EAGainLoss(l, j) * Multiplier(j) Next l End If End If Next j AdditionalMarginIndPos = AdditionalMargin

End Function

Private Function AdditionalMarginClassGroup(MI, ContractSize, UnderlyingPrice, StrikePrice, AssignedCQ, ExcercisedCQ, PortfolioCG, Multiplier, PutCall, ContractType, ShortOptionAdj, CGisPG, PGOffset, ClosingPrice, OT, r, q, T, VOL, DIV, IRD)

Dim AdditionalMarginCG(10) As Double

For i = 1 To 10

For j = 1 To PortfolioCG

AdditionalMarginCG(i) = AdditionalMarginCG(i) + AdditionalMarginIndPos(MI, ContractSize, UnderlyingPrice, StrikePrice, AssignedCQ, ExcercisedCQ, PortfolioCG, Multiplier, PutCall, ContractType, ShortOptionAdj, ClosingPrice, OT, r, q, T, VOL, DIV, IRD)(i, j)

Next j Next i

If CGisPG(1) = 1 Then 'Om classgrupp är del av större produktgrupp For i = 1 To 10 If AdditionalMarginCG(i) < 0 Then AdditionalMarginCG(i) = AdditionalMarginCG(i) * PGOffset(1) End If Next i

105

End If AdditionalMarginClassGroup = AdditionalMarginCG End Function

Private Function MinimumMarginCG(ContractType, ContractSize, PortfolioCG, PutCall, MinMargRateOpt, MinMargRateFut, AssignedCQ, ExcercisedCQ, ClosingPrice, Multiplier, UnderlyingPrice, StrikePrice, OT, r, q, T, VOL, DIV, IRD)

Static NetShortC As Integer, NetShortP As Integer, NetLongC As Integer, NetLongP As Integer, NetShortF As Integer, NetLongF As Integer

Dim CGOptMinMargin As Double, CGFutMinMargin As Double NetShortC = NetShortC * 0 NetShortP = NetShortP * 0 NetShortF = NetShortF * 0 NetLongC = NetLongC * 0 NetLongP = NetLongP * 0 NetLongF = NetLongF * 0 ifut = 1 iopt = 1 For j = 1 To PortfolioCG If ContractType(j) = 0 Then ifut = j If ContractSize(j) < 0 Then NetShortF = NetShortF + Abs(ContractSize(j)) ElseIf ContractSize(j) > 0 Then NetLongF = NetLongF + Abs(ContractSize(j)) End If ElseIf ContractType(j) = 1 Or ContractType(j) = 2 Then iopt = j If PutCall(j) = 1 Then If ContractSize(j) < 0 Then NetShortC = NetShortC + Abs(ContractSize(j)) ElseIf ContractSize(j) > 0 Then NetLongC = NetLongC + Abs(ContractSize(j)) End If

106

If AssignedCQ(j) < 0 Then NetShortC = NetShortC + Abs(AssignedCQ(j)) ElseIf AssignedCQ(j) > 0 Then NetLongC = NetLongC + Abs(AssignedCQ(j)) End If If ExcercisedCQ(j) < 0 Then NetShortC = NetShortC + Abs(ExcercisedCQ(j)) ElseIf ExcercisedCQ(j) > 0 Then NetLongC = NetLongC + Abs(ExcercisedCQ(j)) End If ElseIf PutCall(j) = -1 Then If ContractSize(j) < 0 Then NetShortP = NetShortP + Abs(ContractSize(j)) ElseIf ContractSize(j) > 0 Then NetLongP = NetLongP + Abs(ContractSize(j)) End If If AssignedCQ(j) < 0 Then NetShortP = NetShortC + Abs(AssignedCQ(j)) ElseIf AssignedCQ(j) > 0 Then NetLongP = NetLongC + Abs(AssignedCQ(j)) End If If ExcercisedCQ(j) < 0 Then NetShortP = NetShortC + Abs(ExcercisedCQ(j)) ElseIf ExcercisedCQ(j) > 0 Then NetLongP = NetLongC + Abs(ExcercisedCQ(j)) End If End If

107

End If Next j CGOptMinMargin = Abs(NetLongC - NetShortC) * MinMargRateOpt(iopt) + Abs(NetLongP - NetShortP) *

MinMargRateOpt(iopt) Dim dummy As Integer dummy = 0 For z = 1 To PortfolioCG If ContractType(z) = 2 Then dummy = 2 End If Next z If dummy <> 2 Then GoTo exitnext: TotalPremiumMargin = CalculatePremiumMargin(PortfolioCG, ContractType, ContractSize, AssignedCQ, ExcercisedCQ,

ClosingPrice, Multiplier, UnderlyingPrice, StrikePrice, PutCall, OT, r, q, T, VOL, DIV, IRD)

If TotalPremiumMargin <= 0 And CGOptMinMargin > Abs(TotalPremiumMargin) Then CGOptMinMargin = Abs(TotalPremiumMargin) End If exitnext: CGFutMinMargin = Abs(NetLongF - NetShortF) * MinMargRateFut(ifut) MinimumMarginCG = CGOptMinMargin + CGFutMinMargin End Function

Option valuation function

Option Base 0Public Function OptVal(OT, PutCall, UP, LP, r, q, T, VOL, DIV, Delta)

If OT = 0 And DIV = 0 Then OptionVal = BSEuropeanOptValue(PutCall, UP, LP, r, q, T, VOL, Delta) ElseIf OT = 1 And DIV = 0 Then If PutCall = -1 Then OptionVal = BinomialFormula(UP, LP, r, q, T, VOL, Delta) ElseIf PutCall = 1 Then OptionVal = BSEuropeanOptValue(PutCall, UP, LP, r, q, T, VOL, Delta) End If ElseIf OT = 2 Then

108

OptionVal = Black76(PutCall, UP, LP, r, T, VOL, Delta) End If OptVal = OptionVal

End Function

Private Function BSEuropeanOptValue(iopt, S, X, r, q, tyr, sigma, Delta)

Dim ert, eqt Dim NDOne, NDTwo

ert = Exp(-r * tyr) eqt = Exp(-q * tyr) If sigma > 0 Then NDOne = Application.NormSDist(iopt * BSDOne(S, X, r, q, tyr, sigma)) NDTwo = Application.NormSDist(iopt * BSDTwo(S, X, r, q, tyr, sigma)) BSEuropeanOptValue = iopt * (S * eqt * NDOne - X * ert * NDTwo) ElseIf sigma = 0 Then OptionValue = iopt * (S * eqt - X * ert) If OptionValue < 0 Then BSEuropeanOptValue = 0 Else BSEuropeanOptValue = OptionValue End If End If If Delta = 1 Then If iopt = 1 Then BSEuropeanOptValue = eqt * NDOne ElseIf iopt = -1 Then BSEuropeanOptValue = eqt * (NDOne - 1) End If End If End Function

Private Function BSDOne(S, X, r, q, tyr, sigma)

BSDOne = (Log(S / X) + (r - q + 0.5 * sigma ^ 2) * tyr) / (sigma * Sqr(tyr))

End Function

Private Function BSDTwo(S, X, r, q, tyr, sigma)

BSDTwo = (Log(S / X) + (r - q - 0.5 * sigma ^ 2) * tyr) / (sigma * Sqr(tyr))

End Function

Private Function Black76(iopt, F, X, r, tyr, sigma, Delta)

109

Dim ert Dim NDOne, NDTwo ert = Exp(-r * tyr) NDOne = Application.NormSDist(iopt * B76DOne(F, X, tyr, sigma)) NDTwo = Application.NormSDist(iopt * B76DTwo(F, X, tyr, sigma)) Black76 = iopt * ert * (F * NDOne - X * NDTwo) If Delta = 1 Then If iopt = 1 Then Black76 = ert * NDOne ElseIf iopt = -1 Then Black76 = ert * (NDOne - 1) End If End If

End Function

Private Function B76DOne(F, X, tyr, sigma)

B76DOne = (Log(F / X) + (0.5 * sigma ^ 2 * tyr)) / (sigma * Sqr(tyr))

End Function

Private Function B76DTwo(F, X, tyr, sigma)

B76DTwo = (Log(F / X) - (0.5 * sigma ^ 2 * tyr)) / (sigma * Sqr(tyr))

End Function

Private Function BinomialFormula(S, X, r, q, TtM, sigma, Delta)

Static M(1) As Double Static ft(1) As Double 'Dim a As Double, b As Double, u As Double, d As Double, p As Double n = 30 Dim func(30, 30) As Double tyr = TtM / n If sigma < 0 Then sigma = 0 End If a = Exp((r - q) * tyr) b = Sqr(a ^ 2 * (Exp(sigma ^ 2 * tyr) - 1)) u = ((a ^ 2 + b ^ 2 + 1) + Sqr((a ^ 2 + b ^ 2 + 1) ^ 2 - 4 * a ^ 2)) / (2 * a) d = 1 / u P = (a - d) / (u - d) ert = Exp(-r * tyr)

For j = 0 To n M(0) = X - S * u ^ j * d ^ (n - j) M(1) = 0 func(n, j) = Application.Max(M)

110

Next j For i = n - 1 To 0 Step -1 For j = 0 To i ft(0) = ert * (P * func(i + 1, j + 1) + (1 - P) * func(i + 1, j)) ft(1) = X - S * u ^ j * d ^ (i - j) func(i, j) = Application.Max(ft) Next j Next i BinomialFormula = func(0, 0) If Delta = 1 Then BinomialFormula = (func(1, 1) - func(1, 0)) / (S * u - S * d) End If End Function

Mathematical functions

Private Function RoundingDown(RDvar)

Dim invar As Integer, RD As Integer Dim y As Double invar = RDvar

If invar > RDvar Then RD = invar - 1 ElseIf invar <= RDvar Then RD = invar End If

RoundingDown = RD

End Function

Private Function Rounding(RDvar)

Dim X As Integer, RD As Integer Dim y As Double X = RDvar

Rounding = X

End Function

Private Function RoundingUp(RDvar)

Dim X As Integer, RD As Integer Dim y As Double X = RDvar

If X < RDvar Then

111

RD = X + 1 ElseIf X >= RDvar Then RD = X End If

RoundingUp = RD

End Function

112

References[1] Standard Portfolio Analysis Of Risk, Sydney Futures Exchange Clearing House Pty Limited,

Sydney, 1998

[2] The Standard Portfolio Analysis Of risk (SPAN) Performance Bond System At The Chicago Mercantile Exchange Technical Specifications, Chicago Mercantile Exchange, Chicago, 1992

[3] PC-SPAN Performance Bond Calculation Algorithm Functional Specification PC-SPAN Release 3.10, Chicago Mercantile Exchange, Chicago, 2001

[4] SPAN Performance Bond Calculation Method, MATIF, Paris, 1993

[5] Understanding Margins, Australian Stcok Exchange, Sydney, 2000

[6] TIMS Manual - User Specifications, Cassa Di Compensazione & Garanzia, Rome, 2000

[7] OCC TIMS, The Options Clearing Corporation, Chicago

[8] TIMS – Theoretical Intermarket Margin System, The Options Clearing Corporation, Chicago

[9] Margining Methodology Guide, OM Technology AB, Stockholm, 2001

[10] Jansson, Bengt. Estimating Parameters For Underlying Instruments, OM Stockholm Exchange, Stockholm, 2000

[11] Jansson, Bengt. Estimating Windows Between Different Underlyings, OM Stockholm Exchange, Stockholm, 2000

[12] Margin Policy Document, SFE Clearing Corporation, Sydney, 2001

[13] SFE Initial Margin Rates & SPAN Parameters, Sydney Futures Exchange, Sydney, 2001

[14] Hull, John C. Options, Futures, & Other Derivatives, 4:th Ed. Prentice Hall, 1999

[15] Wilmott, Paul. Derivatives – The Theory And Practice Of Financial Engineering, University Ed. Wiley, 1998

[16] Alexander, Carol. The Handbook of Risk Management and Analysis, Wiley, 1996

[17] Jackson, Mary. Advanced Modelling In Finance Using Excel And VBA, Wiley Finance, 2001

113


Recommended