CalculateOpenInterestHedgedViaCalendarSpread ->
Arg Open_interest : &Integer
    Records : Array : OptionRecord
    Target : String

- RollOverRecords >Open_interest< Records Target

/

CalculateSyntheticPositionRemainder ->
Arg Open_interest_to_release : &Integer
    Records : Array : OptionRecord
    Target : String
    NearExp_price : Float

- RollOverRecords >Open_interest_to_release< Records Target NearExp_price ( Target Strike Price : 
                                                                                                  1 [ !OptionIsInMoney Target Strike Price ] | 0
                                                                          )

/

CalculateInMoneyOptionPositions ->
Arg Open_interest_in_money : &Integer
    Records : Array : OptionRecord
    Target : String
    NearExp_price : Float

- RollOverRecords >Open_interest_in_money< Records Target NearExp_price ( Target Strike Price : 
                                                                                                1 [ OptionIsInMoney Target Strike Price ] | 0
                                                                        )

/

RollOverRecords Calculate% ->
Arg Open_interest : &Integer
    Records : Array : OptionRecord
    Target : String

Do Open_interest += Record.[Target].Open_interest
With Record from Records

/

RollOverRecords Calculate% ->
Arg Open_interest : &Integer
    Records : Array : OptionRecord
    Target : String
    Price : Float
    TakeIntoAccount : < String, Float, Float > : < 1 | 0 >

Do Open_interest += Record.[Target].Open_interest
   [ TakeIntoAccount Target Record.Strike Price ]
With Record from Records

/

OptionIsInMoney Calculate%, Call%, Put% ->
Arg Target : String
    Option_strike, Price : Float
    [ Target = 'Call' ]

1 [ Option_strike <= Price .- ] | 0

/

OptionIsInMoney Calculate%, Call%, Put% ->
Arg Target : String
    Option_strike, Price : Float
    [ Target = 'Put' ]

1 [ Option_strike >= Price .- ] | 0

/
