updated fx call option example

This commit is contained in:
Sofus Mortensen 2016-11-28 15:11:33 +01:00
parent 7b2eb651be
commit cd1fa99b43

View File

@ -1130,41 +1130,27 @@ language. To avoid linguistic confusion it refers to the combined code/data bund
than a contract. A European FX option expressed in this language looks like this: than a contract. A European FX option expressed in this language looks like this:
\begin{kotlincode} \begin{kotlincode}
fun fx_swap(expiry: String, notional: BigDecimal, val european_fx_option = arrange {
strike: BigDecimal, foreignCurrency: Currency, actions {
domesticCurrency: Currency, acmeCorp.may {
partyA: Party, partyB: Party) = "exercise".anytime {
actions {
arrange { (acmeCorp or highStreetBank).may {
actions { "execute".givenThat(after("2017-09-01")) {
(partyA or partyB) may { highStreetBank.owes(acmeCorp, 1.M, EUR)
"execute".givenThat(after(expiry)) { acmeCorp.owes(highStreetBank, 1200.K, USD)
swap( }
partyA, notional * strike, }
domesticCurrency, partyB,
notional, foreignCurrency
)
} }
} }
} }
} highStreetBank.may {
"expire".givenThat(after("2017-09-01")) {
arrange { zero
actions { }
acmeCorp may {
"exercise".givenThat(before("2017-09-01")) {
fx_swap("2017-09-01", 1.M, 1.2.bd, EUR, USD,
acmeCorp, highStreetBank)
}
}
(acmeCorp or highStreetBank) may {
"expire".anytime {
zero
} }
} }
} }
}
\end{kotlincode} \end{kotlincode}
The programmer may define arbitrary `actions' along with constraints on when the actions may be invoked. The The programmer may define arbitrary `actions' along with constraints on when the actions may be invoked. The