never executed always true always false
1 -- GENERATED by C->Haskell Compiler, version 0.28.8 Switcheroo, 25 November 2017 (Haskell)
2 -- Edit the ORIGNAL .chs file instead!
3
4
5 {-# LANGUAGE FlexibleInstances #-}
6 module QuantLib.Instrument.Option
7 (
8 Option
9 , asOption
10 , asOneAssetOption
11 , CdsOption
12 , BarrierOption
13 , DoubleBarrierOption
14 , MargrabeOption
15 , MultiAssetOption
16 , OneAssetOption
17 , QuantoBarrierOption
18 , QuantoDoubleBarrierOption
19 , QuantoForwardVanillaOption
20 , QuantoVanillaOption
21 , SoftBarrierOption
22 , VanillaOption
23
24 , ExerciseType(..)
25 , Exercise(..)
26 , EuropeanExercise(..)
27 , BermudanExercise(..)
28 , SwingExercise(..)
29
30 , OptionType(..)
31 , PositionType(..)
32
33 , StrikedPayoff(..)
34 , PlainVanillaPayoff(..)
35 , PercentageStrikePayoff(..)
36 , BasketPayoff(..)
37 , Payoff(..)
38 , TypePayoff(..)
39
40 , strikedPayoff
41 , plainVanillaPayoff
42 , percentageStrikePayoff
43 , withCustomPayoff
44 , withCustomStrikedPayoff
45 , withCustomBasketPayoff
46 , swingExercise
47
48 , barrierOption
49 , partialTimeBarrierOption
50 , doubleBarrierOption
51 , doubleBarrierOptionImpliedVolatility
52 , softBarrierOption
53 , softBarrierOptionImpliedVolatility
54 , forwardVanillaOption
55 , compoundOption
56 , delta1
57 , delta2
58 , gamma1
59 , gamma2
60 , margrabeOption
61 , simpleChooserOption
62 , twoAssetCorrelationOption
63 , writerExtensibleOption
64
65 , multiAssetOption
66 , deltaForward
67 , elasticity
68 , itmCashProbability
69 , oneAssetOption
70 , strikeSensitivity
71 , thetaPerDay
72 , quantoBarrierOption
73 , quantoDoubleBarrierOption
74 , quantoForwardVanillaOption
75 , quantoVanillaOption
76 , twoAssetBarrierOption
77 , vanillaOption
78 , basketOption
79 , himalayaOption
80 , pagodaOption
81 , cliquetOption
82 , continuousAveragingAsianOption
83 , continuousFixedLookbackOption
84 , continuousFloatingLookbackOption
85 , discreteAveragingAsianOption
86 , vanillaStorageOption
87 , vanillaSwingOption
88 , europeanOption
89
90 , HasImpliedVol(..)
91 , HasQuanto(..)
92 , HasGreeks(..)
93 ) where
94 import qualified Foreign.C.Types as C2HSImp
95 import qualified Foreign.ForeignPtr as C2HSImp
96 import qualified Foreign.Ptr as C2HSImp
97
98
99
100
101
102
103
104
105 import QuantLib.Internal
106 import QuantLib.Instrument(AverageType, BarrierType, DoubleBarrierType, PartialBarrierRange)
107 import QuantLib.Internal.Type
108 import QuantLib.Internal.Common
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163 -- |Quanto version of a forward-starting (strike-resetting) vanilla option.
164 quantoForwardVanillaOption :: (Double) -- ^moneyness
165 -> (Day) -- ^resetDate
166 -> (StrikedPayoff) -> (Exercise) -> IO ((QuantoForwardVanillaOption))
167 quantoForwardVanillaOption a1 a2 a3 a4 =
168 let {a1' = realToFrac a1} in
169 withDay a2 $ \a2' ->
170 withStrikedPayoff a3 $ \a3' ->
171 withExercise a4 $ \a4' ->
172 preErrorCheck $ \a5' ->
173 quantoForwardVanillaOption'_ a1' a2' a3' a4' a5' >>= \res ->
174 peekQuantoForwardVanillaOption res >>= \res' ->
175 errorCheck a5'>>
176 return (res')
177
178
179
180 -- |Quanto version of a vanilla option on a single asset.
181 quantoVanillaOption :: (StrikedPayoff) -> (Exercise) -> IO ((QuantoVanillaOption))
182 quantoVanillaOption a1 a2 =
183 withStrikedPayoff a1 $ \a1' ->
184 withExercise a2 $ \a2' ->
185 preErrorCheck $ \a3' ->
186 quantoVanillaOption'_ a1' a2' a3' >>= \res ->
187 peekQuantoVanillaOption res >>= \res' ->
188 errorCheck a3'>>
189 return (res')
190
191
192
193 -- |Vanilla option (no discrete dividends, no barriers) on a single asset.
194 vanillaOption :: (StrikedPayoff) -> (Exercise) -> IO ((VanillaOption))
195 vanillaOption a1 a2 =
196 withStrikedPayoff a1 $ \a1' ->
197 withExercise a2 $ \a2' ->
198 preErrorCheck $ \a3' ->
199 vanillaOption'_ a1' a2' a3' >>= \res ->
200 peekVanillaOption res >>= \res' ->
201 errorCheck a3'>>
202 return (res')
203
204
205
206 -- |Barrier option on a single asset.
207 barrierOption :: (BarrierType) -> (Double) -- ^barrier
208 -> (Double) -- ^rebate
209 -> (StrikedPayoff) -> (Exercise) -> IO ((BarrierOption))
210 barrierOption a1 a2 a3 a4 a5 =
211 let {a1' = (fromIntegral . fromEnum) a1} in
212 let {a2' = realToFrac a2} in
213 let {a3' = realToFrac a3} in
214 withStrikedPayoff a4 $ \a4' ->
215 withExercise a5 $ \a5' ->
216 preErrorCheck $ \a6' ->
217 barrierOption'_ a1' a2' a3' a4' a5' a6' >>= \res ->
218 peekBarrierOption res >>= \res' ->
219 errorCheck a6'>>
220 return (res')
221
222
223
224 -- |Barrier option on a single asset that is only monitored for part of its life (a partial-time barrier).
225 partialTimeBarrierOption :: (BarrierType) -> (PartialBarrierRange) -> (Double) -- ^barrier
226 -> (Double) -- ^rebate
227 -> (Day) -- ^coverEventDate
228 -> (StrikedPayoff) -> (Exercise) -> IO ((OneAssetOption))
229 partialTimeBarrierOption a1 a2 a3 a4 a5 a6 a7 =
230 let {a1' = (fromIntegral . fromEnum) a1} in
231 let {a2' = (fromIntegral . fromEnum) a2} in
232 let {a3' = realToFrac a3} in
233 let {a4' = realToFrac a4} in
234 withDay a5 $ \a5' ->
235 withStrikedPayoff a6 $ \a6' ->
236 withExercise a7 $ \a7' ->
237 preErrorCheck $ \a8' ->
238 partialTimeBarrierOption'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
239 peekOneAssetOption res >>= \res' ->
240 errorCheck a8'>>
241 return (res')
242
243
244
245 -- |Double-barrier option on a single asset, with a lower and an upper barrier.
246 doubleBarrierOption :: (DoubleBarrierType) -> (Double) -- ^barrierLo
247 -> (Double) -- ^barrierHi
248 -> (Double) -- ^rebate
249 -> (StrikedPayoff) -> (Exercise) -> IO ((DoubleBarrierOption))
250 doubleBarrierOption a1 a2 a3 a4 a5 a6 =
251 let {a1' = (fromIntegral . fromEnum) a1} in
252 let {a2' = realToFrac a2} in
253 let {a3' = realToFrac a3} in
254 let {a4' = realToFrac a4} in
255 withStrikedPayoff a5 $ \a5' ->
256 withExercise a6 $ \a6' ->
257 preErrorCheck $ \a7' ->
258 doubleBarrierOption'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
259 peekDoubleBarrierOption res >>= \res' ->
260 errorCheck a7'>>
261 return (res')
262
263
264
265 -- |Soft barrier option on a single asset: knocked in/out proportionally over a barrier range [barrierLo, barrierHi], rather than in full at a single hard barrier. European exercise only.
266 softBarrierOption :: (BarrierType) -> (Double) -- ^barrierLo
267 -> (Double) -- ^barrierHi
268 -> (StrikedPayoff) -> (Exercise) -> IO ((SoftBarrierOption))
269 softBarrierOption a1 a2 a3 a4 a5 =
270 let {a1' = (fromIntegral . fromEnum) a1} in
271 let {a2' = realToFrac a2} in
272 let {a3' = realToFrac a3} in
273 withStrikedPayoff a4 $ \a4' ->
274 withExercise a5 $ \a5' ->
275 preErrorCheck $ \a6' ->
276 softBarrierOption'_ a1' a2' a3' a4' a5' a6' >>= \res ->
277 peekSoftBarrierOption res >>= \res' ->
278 errorCheck a6'>>
279 return (res')
280
281
282
283 -- |Implied Black-Scholes volatility that reproduces the given price for a SoftBarrierOption; see VanillaOption's implied-volatility for the caveats on reliability.
284 softBarrierOptionImpliedVolatility :: (SoftBarrierOption) -> (Double) -- ^price
285 -> (GenGeneralizedBlackScholesProcess gbs) -> (Double) -- ^accuracy
286 -> (Word) -- ^maxEvaluations
287 -> (Double) -- ^minVol
288 -> (Double) -- ^maxVol
289 -> IO ((Double))
290 softBarrierOptionImpliedVolatility a1 a2 a3 a4 a5 a6 a7 =
291 withSoftBarrierOption a1 $ \a1' ->
292 let {a2' = realToFrac a2} in
293 withGeneralizedBlackScholesProcess a3 $ \a3' ->
294 let {a4' = realToFrac a4} in
295 let {a5' = fromIntegral a5} in
296 let {a6' = realToFrac a6} in
297 let {a7' = realToFrac a7} in
298 preErrorCheck $ \a8' ->
299 softBarrierOptionImpliedVolatility'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
300 let {res' = realToFrac res} in
301 errorCheck a8'>>
302 return (res')
303
304
305
306 -- |Forward-starting (strike-resetting) version of a vanilla option.
307 forwardVanillaOption :: (Double) -- ^moneyness
308 -> (Day) -- ^resetDate
309 -> (StrikedPayoff) -> (Exercise) -> IO ((OneAssetOption))
310 forwardVanillaOption a1 a2 a3 a4 =
311 let {a1' = realToFrac a1} in
312 withDay a2 $ \a2' ->
313 withStrikedPayoff a3 $ \a3' ->
314 withExercise a4 $ \a4' ->
315 preErrorCheck $ \a5' ->
316 forwardVanillaOption'_ a1' a2' a3' a4' a5' >>= \res ->
317 peekOneAssetOption res >>= \res' ->
318 errorCheck a5'>>
319 return (res')
320
321
322
323 -- |Compound option (an option on another option) on a single asset. The mother option is the compound option itself; the daughter option is its underlying.
324 compoundOption :: (StrikedPayoff) -- ^motherPayoff
325 -> (Exercise) -- ^motherExercise
326 -> (StrikedPayoff) -- ^daughterPayoff
327 -> (Exercise) -- ^daughterExercise
328 -> IO ((OneAssetOption))
329 compoundOption a1 a2 a3 a4 =
330 withStrikedPayoff a1 $ \a1' ->
331 withExercise a2 $ \a2' ->
332 withStrikedPayoff a3 $ \a3' ->
333 withExercise a4 $ \a4' ->
334 preErrorCheck $ \a5' ->
335 compoundOption'_ a1' a2' a3' a4' a5' >>= \res ->
336 peekOneAssetOption res >>= \res' ->
337 errorCheck a5'>>
338 return (res')
339
340
341
342 -- |Simple chooser option on a single asset: the holder chooses, on the choosing date, whether the option is a call or a put; both share the same strike and exercise date.
343 simpleChooserOption :: (Day) -- ^choosingDate
344 -> (Double) -- ^strike
345 -> (Exercise) -> IO ((OneAssetOption))
346 simpleChooserOption a1 a2 a3 =
347 withDay a1 $ \a1' ->
348 let {a2' = realToFrac a2} in
349 withExercise a3 $ \a3' ->
350 preErrorCheck $ \a4' ->
351 simpleChooserOption'_ a1' a2' a3' a4' >>= \res ->
352 peekOneAssetOption res >>= \res' ->
353 errorCheck a4'>>
354 return (res')
355
356
357
358 -- |Writer-extensible option on a single asset: if out of the money at the first exercise, it is extended to a second exercise with an amended payoff.
359 writerExtensibleOption :: (PlainVanillaPayoff) -- ^payoff1
360 -> (Exercise) -- ^exercise1
361 -> (PlainVanillaPayoff) -- ^payoff2
362 -> (Exercise) -- ^exercise2
363 -> IO ((OneAssetOption))
364 writerExtensibleOption a1 a2 a3 a4 =
365 withPlainVanillaPayoff a1 $ \a1' ->
366 withExercise a2 $ \a2' ->
367 withPlainVanillaPayoff a3 $ \a3' ->
368 withExercise a4 $ \a4' ->
369 preErrorCheck $ \a5' ->
370 writerExtensibleOption'_ a1' a2' a3' a4' a5' >>= \res ->
371 peekOneAssetOption res >>= \res' ->
372 errorCheck a5'>>
373 return (res')
374
375
376
377 -- |Sensitivity of a MargrabeOption's value to the price of the first asset.
378 delta1 :: (MargrabeOption) -> IO ((Double))
379 delta1 a1 =
380 withMargrabeOption a1 $ \a1' ->
381 preErrorCheck $ \a2' ->
382 delta1'_ a1' a2' >>= \res ->
383 let {res' = realToFrac res} in
384 errorCheck a2'>>
385 return (res')
386
387
388
389 -- |Sensitivity of a MargrabeOption's value to the price of the second asset.
390 delta2 :: (MargrabeOption) -> IO ((Double))
391 delta2 a1 =
392 withMargrabeOption a1 $ \a1' ->
393 preErrorCheck $ \a2' ->
394 delta2'_ a1' a2' >>= \res ->
395 let {res' = realToFrac res} in
396 errorCheck a2'>>
397 return (res')
398
399
400
401 -- |Second derivative of a MargrabeOption's value with respect to the price of the first asset.
402 gamma1 :: (MargrabeOption) -> IO ((Double))
403 gamma1 a1 =
404 withMargrabeOption a1 $ \a1' ->
405 preErrorCheck $ \a2' ->
406 gamma1'_ a1' a2' >>= \res ->
407 let {res' = realToFrac res} in
408 errorCheck a2'>>
409 return (res')
410
411
412
413 -- |Second derivative of a MargrabeOption's value with respect to the price of the second asset.
414 gamma2 :: (MargrabeOption) -> IO ((Double))
415 gamma2 a1 =
416 withMargrabeOption a1 $ \a1' ->
417 preErrorCheck $ \a2' ->
418 gamma2'_ a1' a2' >>= \res ->
419 let {res' = realToFrac res} in
420 errorCheck a2'>>
421 return (res')
422
423
424
425 -- |Sensitivity of the option's value to the forward price of the underlying.
426 deltaForward :: (GenOneAssetOption oo) -> IO ((Double))
427 deltaForward a1 =
428 withOneAssetOption a1 $ \a1' ->
429 preErrorCheck $ \a2' ->
430 deltaForward'_ a1' a2' >>= \res ->
431 let {res' = realToFrac res} in
432 errorCheck a2'>>
433 return (res')
434
435
436
437 -- |Percentage change in the option's value per percentage change in the underlying price.
438 elasticity :: (GenOneAssetOption oo) -> IO ((Double))
439 elasticity a1 =
440 withOneAssetOption a1 $ \a1' ->
441 preErrorCheck $ \a2' ->
442 elasticity'_ a1' a2' >>= \res ->
443 let {res' = realToFrac res} in
444 errorCheck a2'>>
445 return (res')
446
447
448
449 -- |Sensitivity of the option's value to the strike price.
450 strikeSensitivity :: (GenOneAssetOption oo) -> IO ((Double))
451 strikeSensitivity a1 =
452 withOneAssetOption a1 $ \a1' ->
453 preErrorCheck $ \a2' ->
454 strikeSensitivity'_ a1' a2' >>= \res ->
455 let {res' = realToFrac res} in
456 errorCheck a2'>>
457 return (res')
458
459
460
461 -- |Theta divided by the number of days elapsed per day (as opposed to per year).
462 thetaPerDay :: (GenOneAssetOption oo) -> IO ((Double))
463 thetaPerDay a1 =
464 withOneAssetOption a1 $ \a1' ->
465 preErrorCheck $ \a2' ->
466 thetaPerDay'_ a1' a2' >>= \res ->
467 let {res' = realToFrac res} in
468 errorCheck a2'>>
469 return (res')
470
471
472
473 -- |Margrabe option on two assets: the right to exchange Q2 units of the second asset for Q1 units of the first at expiration.
474 margrabeOption :: (Int) -- ^Q1
475 -> (Int) -- ^Q2
476 -> (Exercise) -> IO ((MargrabeOption))
477 margrabeOption a1 a2 a3 =
478 let {a1' = fromIntegral a1} in
479 let {a2' = fromIntegral a2} in
480 withExercise a3 $ \a3' ->
481 preErrorCheck $ \a4' ->
482 margrabeOption'_ a1' a2' a3' a4' >>= \res ->
483 peekMargrabeOption res >>= \res' ->
484 errorCheck a4'>>
485 return (res')
486
487
488
489 -- |Barrier option on two assets: the first asset's value is compared to the strike to determine the payoff, while the second asset's value is monitored against the barrier.
490 twoAssetBarrierOption :: (BarrierType) -> (Double) -- ^barrier
491 -> (StrikedPayoff) -> (Exercise) -> IO ((Instrument))
492 twoAssetBarrierOption a1 a2 a3 a4 =
493 let {a1' = (fromIntegral . fromEnum) a1} in
494 let {a2' = realToFrac a2} in
495 withStrikedPayoff a3 $ \a3' ->
496 withExercise a4 $ \a4' ->
497 preErrorCheck $ \a5' ->
498 twoAssetBarrierOption'_ a1' a2' a3' a4' a5' >>= \res ->
499 peekInstrument res >>= \res' ->
500 errorCheck a5'>>
501 return (res')
502
503
504
505 -- |Base construction for an option on multiple assets.
506 multiAssetOption :: (Payoff) -> (Exercise) -> IO ((MultiAssetOption))
507 multiAssetOption a1 a2 =
508 withPayoff a1 $ \a1' ->
509 withExercise a2 $ \a2' ->
510 preErrorCheck $ \a3' ->
511 multiAssetOption'_ a1' a2' a3' >>= \res ->
512 peekMultiAssetOption res >>= \res' ->
513 errorCheck a3'>>
514 return (res')
515
516
517
518 -- |Two-asset correlation option: pays a payoff based on the second asset's value against strike2 at exercise, but only if the first asset is also in the money against strike1; otherwise pays 0.
519 twoAssetCorrelationOption :: (OptionType) -- ^type
520 -> (Double) -- ^strike1
521 -> (Double) -- ^strike2
522 -> (Exercise) -> IO ((MultiAssetOption))
523 twoAssetCorrelationOption a1 a2 a3 a4 =
524 let {a1' = fromEnumC a1} in
525 let {a2' = realToFrac a2} in
526 let {a3' = realToFrac a3} in
527 withExercise a4 $ \a4' ->
528 preErrorCheck $ \a5' ->
529 twoAssetCorrelationOption'_ a1' a2' a3' a4' a5' >>= \res ->
530 peekMultiAssetOption res >>= \res' ->
531 errorCheck a5'>>
532 return (res')
533
534
535
536 -- |Probability of the option expiring in-the-money in a cash-or-nothing sense.
537 itmCashProbability :: (GenOneAssetOption oo) -> IO ((Double))
538 itmCashProbability a1 =
539 withOneAssetOption a1 $ \a1' ->
540 preErrorCheck $ \a2' ->
541 itmCashProbability'_ a1' a2' >>= \res ->
542 let {res' = realToFrac res} in
543 errorCheck a2'>>
544 return (res')
545
546
547
548 -- |Base construction for an option on a single asset.
549 oneAssetOption :: (Payoff) -> (Exercise) -> IO ((OneAssetOption))
550 oneAssetOption a1 a2 =
551 withPayoff a1 $ \a1' ->
552 withExercise a2 $ \a2' ->
553 preErrorCheck $ \a3' ->
554 oneAssetOption'_ a1' a2' a3' >>= \res ->
555 peekOneAssetOption res >>= \res' ->
556 errorCheck a3'>>
557 return (res')
558
559
560
561 -- |Quanto version of a barrier option on a single asset.
562 quantoBarrierOption :: (BarrierType) -> (Double) -- ^barrier
563 -> (Double) -- ^rebate
564 -> (StrikedPayoff) -> (Exercise) -> IO ((QuantoBarrierOption))
565 quantoBarrierOption a1 a2 a3 a4 a5 =
566 let {a1' = (fromIntegral . fromEnum) a1} in
567 let {a2' = realToFrac a2} in
568 let {a3' = realToFrac a3} in
569 withStrikedPayoff a4 $ \a4' ->
570 withExercise a5 $ \a5' ->
571 preErrorCheck $ \a6' ->
572 quantoBarrierOption'_ a1' a2' a3' a4' a5' a6' >>= \res ->
573 peekQuantoBarrierOption res >>= \res' ->
574 errorCheck a6'>>
575 return (res')
576
577
578
579 -- |Quanto version of a double-barrier option on a single asset, with a lower and an upper barrier.
580 quantoDoubleBarrierOption :: (DoubleBarrierType) -> (Double) -- ^barrierLo
581 -> (Double) -- ^barrierHi
582 -> (Double) -- ^rebate
583 -> (StrikedPayoff) -> (Exercise) -> IO ((QuantoDoubleBarrierOption))
584 quantoDoubleBarrierOption a1 a2 a3 a4 a5 a6 =
585 let {a1' = (fromIntegral . fromEnum) a1} in
586 let {a2' = realToFrac a2} in
587 let {a3' = realToFrac a3} in
588 let {a4' = realToFrac a4} in
589 withStrikedPayoff a5 $ \a5' ->
590 withExercise a6 $ \a6' ->
591 preErrorCheck $ \a7' ->
592 quantoDoubleBarrierOption'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
593 peekQuantoDoubleBarrierOption res >>= \res' ->
594 errorCheck a7'>>
595 return (res')
596
597
598
599 -- |Basket option on a number of assets, combined by the given basket payoff (e.g. min/max/spread/average).
600 basketOption :: (BasketPayoff) -> (Exercise) -> IO ((MultiAssetOption))
601 basketOption a1 a2 =
602 withBasketPayoff a1 $ \a1' ->
603 withExercise a2 $ \a2' ->
604 preErrorCheck $ \a3' ->
605 basketOption'_ a1' a2' a3' >>= \res ->
606 peekMultiAssetOption res >>= \res' ->
607 errorCheck a3'>>
608 return (res')
609
610
611
612 -- |Himalaya option: at the end of each of a series of periods, the best-performing asset in the basket is added to the average and dropped from the basket; the payoff is the max of the strike and the final average of best performers.
613 himalayaOption :: ([Day]) -- ^fixingDates
614 -> (Double) -- ^strike
615 -> IO ((MultiAssetOption))
616 himalayaOption a1 a2 =
617 withDayArray a1 $ \(a1'1, a1'2) ->
618 let {a2' = realToFrac a2} in
619 preErrorCheck $ \a3' ->
620 himalayaOption'_ a1'1 a1'2 a2' a3' >>= \res ->
621 peekMultiAssetOption res >>= \res' ->
622 errorCheck a3'>>
623 return (res')
624
625
626
627 -- |Roofed Asian option on a number of assets: pays the given fraction of the minimum of the roof and the positive portfolio performance, or nothing if the performance is negative.
628 pagodaOption :: ([Day]) -- ^fixingDates
629 -> (Double) -- ^roof
630 -> (Double) -- ^fraction
631 -> IO ((MultiAssetOption))
632 pagodaOption a1 a2 a3 =
633 withDayArray a1 $ \(a1'1, a1'2) ->
634 let {a2' = realToFrac a2} in
635 let {a3' = realToFrac a3} in
636 preErrorCheck $ \a4' ->
637 pagodaOption'_ a1'1 a1'2 a2' a3' a4' >>= \res ->
638 peekMultiAssetOption res >>= \res' ->
639 errorCheck a4'>>
640 return (res')
641
642
643
644 -- |Cliquet (ratchet) option: a series of forward-starting options where each period's strike is set to a fixed percentage of the spot price at the start of that period.
645 cliquetOption :: (PercentageStrikePayoff) -> (EuropeanExercise) -- ^maturity
646 -> ([Day]) -- ^resetDates
647 -> IO ((OneAssetOption))
648 cliquetOption a1 a2 a3 =
649 withPercentageStrikePayoff a1 $ \a1' ->
650 withEuropeanExercise a2 $ \a2' ->
651 withDayArray a3 $ \(a3'1, a3'2) ->
652 preErrorCheck $ \a4' ->
653 cliquetOption'_ a1' a2' a3'1 a3'2 a4' >>= \res ->
654 peekOneAssetOption res >>= \res' ->
655 errorCheck a4'>>
656 return (res')
657
658
659
660 -- |Continuous-averaging Asian option on a single asset, for an unseasoned (fresh) option where averaging has not yet started.
661 continuousAveragingAsianOption :: (AverageType) -> (StrikedPayoff) -> (Exercise) -> IO ((OneAssetOption))
662 continuousAveragingAsianOption a1 a2 a3 =
663 let {a1' = (fromIntegral . fromEnum) a1} in
664 withStrikedPayoff a2 $ \a2' ->
665 withExercise a3 $ \a3' ->
666 preErrorCheck $ \a4' ->
667 continuousAveragingAsianOption'_ a1' a2' a3' a4' >>= \res ->
668 peekOneAssetOption res >>= \res' ->
669 errorCheck a4'>>
670 return (res')
671
672
673
674 -- |Continuous-fixed lookback option: the payoff uses the fixed strike against the minimum/maximum price observed over the option's life.
675 continuousFixedLookbackOption :: (Double) -- ^currentMinmax
676 -> (StrikedPayoff) -> (Exercise) -> IO ((OneAssetOption))
677 continuousFixedLookbackOption a1 a2 a3 =
678 let {a1' = realToFrac a1} in
679 withStrikedPayoff a2 $ \a2' ->
680 withExercise a3 $ \a3' ->
681 preErrorCheck $ \a4' ->
682 continuousFixedLookbackOption'_ a1' a2' a3' a4' >>= \res ->
683 peekOneAssetOption res >>= \res' ->
684 errorCheck a4'>>
685 return (res')
686
687
688
689 -- |Continuous-floating lookback option: the strike is set to the minimum/maximum price observed over the option's life.
690 continuousFloatingLookbackOption :: (Double) -- ^currentMinmax
691 -> (TypePayoff) -> (Exercise) -> IO ((OneAssetOption))
692 continuousFloatingLookbackOption a1 a2 a3 =
693 let {a1' = realToFrac a1} in
694 withTypePayoff a2 $ \a2' ->
695 withExercise a3 $ \a3' ->
696 preErrorCheck $ \a4' ->
697 continuousFloatingLookbackOption'_ a1' a2' a3' a4' >>= \res ->
698 peekOneAssetOption res >>= \res' ->
699 errorCheck a4'>>
700 return (res')
701
702
703
704 -- |Discrete-averaging Asian option on a single asset, taking the running sum/product of past fixings plus a list of future fixing dates.
705 discreteAveragingAsianOption :: (AverageType) -> (Double) -- ^runningAccumulator, the running sum or products of past fixings
706 -> (Word) -- ^pastFixings
707 -> ([Day]) -- ^fixingDates
708 -> (StrikedPayoff) -> (Exercise) -> IO ((OneAssetOption))
709 discreteAveragingAsianOption a1 a2 a3 a4 a5 a6 =
710 let {a1' = (fromIntegral . fromEnum) a1} in
711 let {a2' = realToFrac a2} in
712 let {a3' = fromIntegral a3} in
713 withDayArray a4 $ \(a4'1, a4'2) ->
714 withStrikedPayoff a5 $ \a5' ->
715 withExercise a6 $ \a6' ->
716 preErrorCheck $ \a7' ->
717 discreteAveragingAsianOption'_ a1' a2' a3' a4'1 a4'2 a5' a6' a7' >>= \res ->
718 peekOneAssetOption res >>= \res' ->
719 errorCheck a7'>>
720 return (res')
721
722
723
724 -- |Storage option (e.g. a gas storage facility): a payoff-free instrument exercisable on a Bermudan schedule, with a maximum capacity, load/withdrawal rate, and per-period rate of change.
725 vanillaStorageOption :: (BermudanExercise) -> (Double) -- capacity
726 -> (Double) -- ^load
727 -> (Double) -- ^changeRate
728 -> IO ((OneAssetOption))
729 vanillaStorageOption a1 a2 a3 a4 =
730 withBermudanExercise a1 $ \a1' ->
731 let {a2' = realToFrac a2} in
732 let {a3' = realToFrac a3} in
733 let {a4' = realToFrac a4} in
734 preErrorCheck $ \a5' ->
735 vanillaStorageOption'_ a1' a2' a3' a4' a5' >>= \res ->
736 peekOneAssetOption res >>= \res' ->
737 errorCheck a5'>>
738 return (res')
739
740
741
742 -- |Swing option: a payoff exercisable a bounded number of times (between minExerciseRights and maxExerciseRights) at the dates of a SwingExercise.
743 vanillaSwingOption :: (StrikedPayoff) -> (SwingExercise) -> (Word) -- ^minExerciseRights
744 -> (Word) -- ^maxExerciseRights
745 -> IO ((OneAssetOption))
746 vanillaSwingOption a1 a2 a3 a4 =
747 withStrikedPayoff a1 $ \a1' ->
748 withSwingExercise a2 $ \a2' ->
749 let {a3' = fromIntegral a3} in
750 let {a4' = fromIntegral a4} in
751 preErrorCheck $ \a5' ->
752 vanillaSwingOption'_ a1' a2' a3' a4' a5' >>= \res ->
753 peekOneAssetOption res >>= \res' ->
754 errorCheck a5'>>
755 return (res')
756
757
758
759 -- |European (single-exercise-date) vanilla option on a single asset.
760 europeanOption :: (StrikedPayoff) -> (Exercise) -> IO ((VanillaOption))
761 europeanOption a1 a2 =
762 withStrikedPayoff a1 $ \a1' ->
763 withExercise a2 $ \a2' ->
764 preErrorCheck $ \a3' ->
765 europeanOption'_ a1' a2' a3' >>= \res ->
766 peekVanillaOption res >>= \res' ->
767 errorCheck a3'>>
768 return (res')
769
770
771
772 class HasGreeks a where
773 delta :: a -> IO Double
774 gamma :: a -> IO Double
775 rho :: a -> IO Double
776 theta :: a -> IO Double
777 vega :: a -> IO Double
778 dividendRho :: a -> IO Double
779
780 instance HasGreeks MultiAssetOption where
781 delta = qlMultiAssetOptionDelta
782 gamma = qlMultiAssetOptionGamma
783 rho = qlMultiAssetOptionRho
784 theta = qlMultiAssetOptionTheta
785 vega = qlMultiAssetOptionVega
786 dividendRho = qlMultiAssetOptionDividendRho
787
788 instance HasGreeks OneAssetOption where
789 delta = qlOneAssetOptionDelta
790 gamma = qlOneAssetOptionGamma
791 rho = qlOneAssetOptionRho
792 theta = qlOneAssetOptionTheta
793 vega = qlOneAssetOptionVega
794 dividendRho = qlOneAssetOptionDividendRho
795
796 -- |Sensitivity of a multi-asset option's value to the price of its underlying assets.
797 qlMultiAssetOptionDelta :: (GenMultiAssetOption mo) -> IO ((Double))
798 qlMultiAssetOptionDelta a1 =
799 withMultiAssetOption a1 $ \a1' ->
800 preErrorCheck $ \a2' ->
801 qlMultiAssetOptionDelta'_ a1' a2' >>= \res ->
802 let {res' = realToFrac res} in
803 errorCheck a2'>>
804 return (res')
805
806
807
808 -- |Sensitivity of a multi-asset option's value to the dividend yield of its underlying assets.
809 qlMultiAssetOptionDividendRho :: (GenMultiAssetOption mo) -> IO ((Double))
810 qlMultiAssetOptionDividendRho a1 =
811 withMultiAssetOption a1 $ \a1' ->
812 preErrorCheck $ \a2' ->
813 qlMultiAssetOptionDividendRho'_ a1' a2' >>= \res ->
814 let {res' = realToFrac res} in
815 errorCheck a2'>>
816 return (res')
817
818
819
820 -- |Second derivative of a multi-asset option's value with respect to the price of its underlying assets.
821 qlMultiAssetOptionGamma :: (GenMultiAssetOption mo) -> IO ((Double))
822 qlMultiAssetOptionGamma a1 =
823 withMultiAssetOption a1 $ \a1' ->
824 preErrorCheck $ \a2' ->
825 qlMultiAssetOptionGamma'_ a1' a2' >>= \res ->
826 let {res' = realToFrac res} in
827 errorCheck a2'>>
828 return (res')
829
830
831
832 -- |Sensitivity of a multi-asset option's value to the risk-free interest rate.
833 qlMultiAssetOptionRho :: (GenMultiAssetOption mo) -> IO ((Double))
834 qlMultiAssetOptionRho a1 =
835 withMultiAssetOption a1 $ \a1' ->
836 preErrorCheck $ \a2' ->
837 qlMultiAssetOptionRho'_ a1' a2' >>= \res ->
838 let {res' = realToFrac res} in
839 errorCheck a2'>>
840 return (res')
841
842
843
844 -- |Sensitivity of a multi-asset option's value to the passage of time.
845 qlMultiAssetOptionTheta :: (GenMultiAssetOption mo) -> IO ((Double))
846 qlMultiAssetOptionTheta a1 =
847 withMultiAssetOption a1 $ \a1' ->
848 preErrorCheck $ \a2' ->
849 qlMultiAssetOptionTheta'_ a1' a2' >>= \res ->
850 let {res' = realToFrac res} in
851 errorCheck a2'>>
852 return (res')
853
854
855
856 -- |Sensitivity of a multi-asset option's value to the volatility of its underlying assets.
857 qlMultiAssetOptionVega :: (GenMultiAssetOption mo) -> IO ((Double))
858 qlMultiAssetOptionVega a1 =
859 withMultiAssetOption a1 $ \a1' ->
860 preErrorCheck $ \a2' ->
861 qlMultiAssetOptionVega'_ a1' a2' >>= \res ->
862 let {res' = realToFrac res} in
863 errorCheck a2'>>
864 return (res')
865
866
867
868 -- |Sensitivity of a single-asset option's value to the price of its underlying.
869 qlOneAssetOptionDelta :: (GenOneAssetOption oo) -> IO ((Double))
870 qlOneAssetOptionDelta a1 =
871 withOneAssetOption a1 $ \a1' ->
872 preErrorCheck $ \a2' ->
873 qlOneAssetOptionDelta'_ a1' a2' >>= \res ->
874 let {res' = realToFrac res} in
875 errorCheck a2'>>
876 return (res')
877
878
879
880 -- |Sensitivity of a single-asset option's value to the dividend yield of its underlying.
881 qlOneAssetOptionDividendRho :: (GenOneAssetOption oo) -> IO ((Double))
882 qlOneAssetOptionDividendRho a1 =
883 withOneAssetOption a1 $ \a1' ->
884 preErrorCheck $ \a2' ->
885 qlOneAssetOptionDividendRho'_ a1' a2' >>= \res ->
886 let {res' = realToFrac res} in
887 errorCheck a2'>>
888 return (res')
889
890
891
892 -- |Second derivative of a single-asset option's value with respect to the price of its underlying.
893 qlOneAssetOptionGamma :: (GenOneAssetOption oo) -> IO ((Double))
894 qlOneAssetOptionGamma a1 =
895 withOneAssetOption a1 $ \a1' ->
896 preErrorCheck $ \a2' ->
897 qlOneAssetOptionGamma'_ a1' a2' >>= \res ->
898 let {res' = realToFrac res} in
899 errorCheck a2'>>
900 return (res')
901
902
903
904 -- |Sensitivity of a single-asset option's value to the risk-free interest rate.
905 qlOneAssetOptionRho :: (GenOneAssetOption oo) -> IO ((Double))
906 qlOneAssetOptionRho a1 =
907 withOneAssetOption a1 $ \a1' ->
908 preErrorCheck $ \a2' ->
909 qlOneAssetOptionRho'_ a1' a2' >>= \res ->
910 let {res' = realToFrac res} in
911 errorCheck a2'>>
912 return (res')
913
914
915
916 -- |Sensitivity of a single-asset option's value to the passage of time.
917 qlOneAssetOptionTheta :: (GenOneAssetOption oo) -> IO ((Double))
918 qlOneAssetOptionTheta a1 =
919 withOneAssetOption a1 $ \a1' ->
920 preErrorCheck $ \a2' ->
921 qlOneAssetOptionTheta'_ a1' a2' >>= \res ->
922 let {res' = realToFrac res} in
923 errorCheck a2'>>
924 return (res')
925
926
927
928 -- |Sensitivity of a single-asset option's value to the volatility of its underlying.
929 qlOneAssetOptionVega :: (GenOneAssetOption oo) -> IO ((Double))
930 qlOneAssetOptionVega a1 =
931 withOneAssetOption a1 $ \a1' ->
932 preErrorCheck $ \a2' ->
933 qlOneAssetOptionVega'_ a1' a2' >>= \res ->
934 let {res' = realToFrac res} in
935 errorCheck a2'>>
936 return (res')
937
938
939
940 class HasQuanto a where
941 qrho :: a -> IO Double
942 qvega :: a -> IO Double
943 qlambda :: a -> IO Double
944 instance HasQuanto QuantoBarrierOption where
945 qrho = qlQuantoBarrierOptionQrho
946 qvega = qlQuantoBarrierOptionQvega
947 qlambda = qlQuantoBarrierOptionQlambda
948 instance HasQuanto QuantoDoubleBarrierOption where
949 qrho = qlQuantoDoubleBarrierOptionQrho
950 qvega = qlQuantoDoubleBarrierOptionQvega
951 qlambda = qlQuantoDoubleBarrierOptionQlambda
952 instance HasQuanto QuantoForwardVanillaOption where
953 qrho = qlQuantoForwardVanillaOptionQrho
954 qvega = qlQuantoForwardVanillaOptionQvega
955 qlambda = qlQuantoForwardVanillaOptionQlambda
956 instance HasQuanto QuantoVanillaOption where
957 qrho = qlQuantoVanillaOptionQrho
958 qvega = qlQuantoVanillaOptionQvega
959 qlambda = qlQuantoVanillaOptionQlambda
960
961 class HasImpliedVol a where
962 -- /Warning/ currently, this method returns the Black-Scholes implied volatility using analytic formulas for European options and a finite-difference method for American and Bermudan options. It will give unconsistent results if the pricing was performed with any other methods (such as jump-diffusion models.)Warningoptions with a gamma that changes sign (e.g., binary options) have values that are not monotonic in the volatility. In these cases, the calculation can fail and the result (if any) is almost meaningless. Another possible source of failure is to have a target value that is not attainable with any volatility, e.g., a target value lower than the intrinsic value in the case of American options.
963 impliedVolatility :: a
964 -> Double -- ^price
965 -> GeneralizedBlackScholesProcess -- ^process
966 -> [Dividend] -- ^dividends
967 -> Double -- ^accuracy
968 -> Word -- ^maxEvaluations
969 -> Double -- ^minVol
970 -> Double -- ^maxVol
971 -> IO Double
972 instance HasImpliedVol VanillaOption where
973 impliedVolatility = qlVanillaOptionImpliedVolatility
974 instance HasImpliedVol BarrierOption where
975 impliedVolatility = qlBarrierOptionImpliedVolatility
976
977 -- |Sensitivity of a QuantoBarrierOption's value to the correlation-driven quanto adjustment's foreign rate.
978 qlQuantoBarrierOptionQrho :: (QuantoBarrierOption) -> IO ((Double))
979 qlQuantoBarrierOptionQrho a1 =
980 withQuantoBarrierOption a1 $ \a1' ->
981 preErrorCheck $ \a2' ->
982 qlQuantoBarrierOptionQrho'_ a1' a2' >>= \res ->
983 let {res' = realToFrac res} in
984 errorCheck a2'>>
985 return (res')
986
987
988
989 -- |Sensitivity of a QuantoBarrierOption's value to the exchange-rate volatility.
990 qlQuantoBarrierOptionQvega :: (QuantoBarrierOption) -> IO ((Double))
991 qlQuantoBarrierOptionQvega a1 =
992 withQuantoBarrierOption a1 $ \a1' ->
993 preErrorCheck $ \a2' ->
994 qlQuantoBarrierOptionQvega'_ a1' a2' >>= \res ->
995 let {res' = realToFrac res} in
996 errorCheck a2'>>
997 return (res')
998
999
1000
1001 -- |Sensitivity of a QuantoBarrierOption's value to the correlation between the underlying and the exchange rate.
1002 qlQuantoBarrierOptionQlambda :: (QuantoBarrierOption) -> IO ((Double))
1003 qlQuantoBarrierOptionQlambda a1 =
1004 withQuantoBarrierOption a1 $ \a1' ->
1005 preErrorCheck $ \a2' ->
1006 qlQuantoBarrierOptionQlambda'_ a1' a2' >>= \res ->
1007 let {res' = realToFrac res} in
1008 errorCheck a2'>>
1009 return (res')
1010
1011
1012
1013 -- |Sensitivity of a QuantoDoubleBarrierOption's value to the correlation-driven quanto adjustment's foreign rate.
1014 qlQuantoDoubleBarrierOptionQrho :: (QuantoDoubleBarrierOption) -> IO ((Double))
1015 qlQuantoDoubleBarrierOptionQrho a1 =
1016 withQuantoDoubleBarrierOption a1 $ \a1' ->
1017 preErrorCheck $ \a2' ->
1018 qlQuantoDoubleBarrierOptionQrho'_ a1' a2' >>= \res ->
1019 let {res' = realToFrac res} in
1020 errorCheck a2'>>
1021 return (res')
1022
1023
1024
1025 -- |Sensitivity of a QuantoDoubleBarrierOption's value to the exchange-rate volatility.
1026 qlQuantoDoubleBarrierOptionQvega :: (QuantoDoubleBarrierOption) -> IO ((Double))
1027 qlQuantoDoubleBarrierOptionQvega a1 =
1028 withQuantoDoubleBarrierOption a1 $ \a1' ->
1029 preErrorCheck $ \a2' ->
1030 qlQuantoDoubleBarrierOptionQvega'_ a1' a2' >>= \res ->
1031 let {res' = realToFrac res} in
1032 errorCheck a2'>>
1033 return (res')
1034
1035
1036
1037 -- |Sensitivity of a QuantoDoubleBarrierOption's value to the correlation between the underlying and the exchange rate.
1038 qlQuantoDoubleBarrierOptionQlambda :: (QuantoDoubleBarrierOption) -> IO ((Double))
1039 qlQuantoDoubleBarrierOptionQlambda a1 =
1040 withQuantoDoubleBarrierOption a1 $ \a1' ->
1041 preErrorCheck $ \a2' ->
1042 qlQuantoDoubleBarrierOptionQlambda'_ a1' a2' >>= \res ->
1043 let {res' = realToFrac res} in
1044 errorCheck a2'>>
1045 return (res')
1046
1047
1048
1049 -- |Sensitivity of a QuantoForwardVanillaOption's value to the correlation-driven quanto adjustment's foreign rate.
1050 qlQuantoForwardVanillaOptionQrho :: (QuantoForwardVanillaOption) -> IO ((Double))
1051 qlQuantoForwardVanillaOptionQrho a1 =
1052 withQuantoForwardVanillaOption a1 $ \a1' ->
1053 preErrorCheck $ \a2' ->
1054 qlQuantoForwardVanillaOptionQrho'_ a1' a2' >>= \res ->
1055 let {res' = realToFrac res} in
1056 errorCheck a2'>>
1057 return (res')
1058
1059
1060
1061 -- |Sensitivity of a QuantoForwardVanillaOption's value to the exchange-rate volatility.
1062 qlQuantoForwardVanillaOptionQvega :: (QuantoForwardVanillaOption) -> IO ((Double))
1063 qlQuantoForwardVanillaOptionQvega a1 =
1064 withQuantoForwardVanillaOption a1 $ \a1' ->
1065 preErrorCheck $ \a2' ->
1066 qlQuantoForwardVanillaOptionQvega'_ a1' a2' >>= \res ->
1067 let {res' = realToFrac res} in
1068 errorCheck a2'>>
1069 return (res')
1070
1071
1072
1073 -- |Sensitivity of a QuantoForwardVanillaOption's value to the correlation between the underlying and the exchange rate.
1074 qlQuantoForwardVanillaOptionQlambda :: (QuantoForwardVanillaOption) -> IO ((Double))
1075 qlQuantoForwardVanillaOptionQlambda a1 =
1076 withQuantoForwardVanillaOption a1 $ \a1' ->
1077 preErrorCheck $ \a2' ->
1078 qlQuantoForwardVanillaOptionQlambda'_ a1' a2' >>= \res ->
1079 let {res' = realToFrac res} in
1080 errorCheck a2'>>
1081 return (res')
1082
1083
1084
1085 -- |Sensitivity of a QuantoVanillaOption's value to the correlation-driven quanto adjustment's foreign rate.
1086 qlQuantoVanillaOptionQrho :: (QuantoVanillaOption) -> IO ((Double))
1087 qlQuantoVanillaOptionQrho a1 =
1088 withQuantoVanillaOption a1 $ \a1' ->
1089 preErrorCheck $ \a2' ->
1090 qlQuantoVanillaOptionQrho'_ a1' a2' >>= \res ->
1091 let {res' = realToFrac res} in
1092 errorCheck a2'>>
1093 return (res')
1094
1095
1096
1097 -- |Sensitivity of a QuantoVanillaOption's value to the exchange-rate volatility.
1098 qlQuantoVanillaOptionQvega :: (QuantoVanillaOption) -> IO ((Double))
1099 qlQuantoVanillaOptionQvega a1 =
1100 withQuantoVanillaOption a1 $ \a1' ->
1101 preErrorCheck $ \a2' ->
1102 qlQuantoVanillaOptionQvega'_ a1' a2' >>= \res ->
1103 let {res' = realToFrac res} in
1104 errorCheck a2'>>
1105 return (res')
1106
1107
1108
1109 -- |Sensitivity of a QuantoVanillaOption's value to the correlation between the underlying and the exchange rate.
1110 qlQuantoVanillaOptionQlambda :: (QuantoVanillaOption) -> IO ((Double))
1111 qlQuantoVanillaOptionQlambda a1 =
1112 withQuantoVanillaOption a1 $ \a1' ->
1113 preErrorCheck $ \a2' ->
1114 qlQuantoVanillaOptionQlambda'_ a1' a2' >>= \res ->
1115 let {res' = realToFrac res} in
1116 errorCheck a2'>>
1117 return (res')
1118
1119
1120
1121 -- |Implied Black-Scholes volatility that reproduces the given price for a VanillaOption, computed analytically for European exercise and by finite differences for American/Bermudan; may be unreliable for a gamma that changes sign or a price unattainable at any volatility.
1122 qlVanillaOptionImpliedVolatility :: (VanillaOption) -> (Double) -- ^price
1123 -> (GenGeneralizedBlackScholesProcess gbs) -> ([Dividend]) -- ^dividends
1124 -> (Double) -- ^accuracy
1125 -> (Word) -- ^maxEvaluations
1126 -> (Double) -- ^minVol
1127 -> (Double) -- ^maxVol
1128 -> IO ((Double))
1129 qlVanillaOptionImpliedVolatility a1 a2 a3 a4 a5 a6 a7 a8 =
1130 withVanillaOption a1 $ \a1' ->
1131 let {a2' = realToFrac a2} in
1132 withGeneralizedBlackScholesProcess a3 $ \a3' ->
1133 withDividendArray a4 $ \(a4'1, a4'2) ->
1134 let {a5' = realToFrac a5} in
1135 let {a6' = fromIntegral a6} in
1136 let {a7' = realToFrac a7} in
1137 let {a8' = realToFrac a8} in
1138 preErrorCheck $ \a9' ->
1139 qlVanillaOptionImpliedVolatility'_ a1' a2' a3' a4'1 a4'2 a5' a6' a7' a8' a9' >>= \res ->
1140 let {res' = realToFrac res} in
1141 errorCheck a9'>>
1142 return (res')
1143
1144
1145
1146 -- |Implied Black-Scholes volatility that reproduces the given price for a BarrierOption; see VanillaOption's implied-volatility for the caveats on reliability.
1147 qlBarrierOptionImpliedVolatility :: (BarrierOption) -> (Double) -- ^price
1148 -> (GenGeneralizedBlackScholesProcess gbs) -> ([Dividend]) -- ^dividends
1149 -> (Double) -- ^accuracy
1150 -> (Word) -- ^maxEvaluations
1151 -> (Double) -- ^minVol
1152 -> (Double) -- ^maxVol
1153 -> IO ((Double))
1154 qlBarrierOptionImpliedVolatility a1 a2 a3 a4 a5 a6 a7 a8 =
1155 withBarrierOption a1 $ \a1' ->
1156 let {a2' = realToFrac a2} in
1157 withGeneralizedBlackScholesProcess a3 $ \a3' ->
1158 withDividendArray a4 $ \(a4'1, a4'2) ->
1159 let {a5' = realToFrac a5} in
1160 let {a6' = fromIntegral a6} in
1161 let {a7' = realToFrac a7} in
1162 let {a8' = realToFrac a8} in
1163 preErrorCheck $ \a9' ->
1164 qlBarrierOptionImpliedVolatility'_ a1' a2' a3' a4'1 a4'2 a5' a6' a7' a8' a9' >>= \res ->
1165 let {res' = realToFrac res} in
1166 errorCheck a9'>>
1167 return (res')
1168
1169
1170
1171 -- |Implied Black-Scholes volatility that reproduces the given price for a DoubleBarrierOption; see VanillaOption's implied-volatility for the caveats on reliability.
1172 doubleBarrierOptionImpliedVolatility :: (DoubleBarrierOption) -> (Double) -- ^price
1173 -> (GenGeneralizedBlackScholesProcess gbs) -> (Double) -- ^accuracy
1174 -> (Word) -- ^maxEvaluations
1175 -> (Double) -- ^minVol
1176 -> (Double) -- ^maxVol
1177 -> IO ((Double))
1178 doubleBarrierOptionImpliedVolatility a1 a2 a3 a4 a5 a6 a7 =
1179 withDoubleBarrierOption a1 $ \a1' ->
1180 let {a2' = realToFrac a2} in
1181 withGeneralizedBlackScholesProcess a3 $ \a3' ->
1182 let {a4' = realToFrac a4} in
1183 let {a5' = fromIntegral a5} in
1184 let {a6' = realToFrac a6} in
1185 let {a7' = realToFrac a7} in
1186 preErrorCheck $ \a8' ->
1187 doubleBarrierOptionImpliedVolatility'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
1188 let {res' = realToFrac res} in
1189 errorCheck a8'>>
1190 return (res')
1191
1192
1193
1194 -- vim: set ff=unix ts=8 sts=2 sw=2 et:
1195
1196 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoForwardVanillaOption"
1197 quantoForwardVanillaOption'_ :: (C2HSImp.CDouble -> (C2HSImp.CInt -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CQuantoForwardVanillaOption'))))))))
1198
1199 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoVanillaOption"
1200 quantoVanillaOption'_ :: ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CQuantoVanillaOption'))))))
1201
1202 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlVanillaOption"
1203 vanillaOption'_ :: ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CVanillaOption'))))))
1204
1205 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlBarrierOption"
1206 barrierOption'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CBarrierOption')))))))))
1207
1208 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlPartialTimeBarrierOption"
1209 partialTimeBarrierOption'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption')))))))))))
1210
1211 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlDoubleBarrierOption"
1212 doubleBarrierOption'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CDoubleBarrierOption'))))))))))
1213
1214 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlSoftBarrierOption"
1215 softBarrierOption'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CSoftBarrierOption')))))))))
1216
1217 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlSoftBarrierOptionImpliedVolatility"
1218 softBarrierOptionImpliedVolatility'_ :: ((C2HSImp.Ptr (CSoftBarrierOption')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))))))
1219
1220 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlForwardVanillaOption"
1221 forwardVanillaOption'_ :: (C2HSImp.CDouble -> (C2HSImp.CInt -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption'))))))))
1222
1223 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlCompoundOption"
1224 compoundOption'_ :: ((QlStrikedTypePayoff) -> ((QlExercise) -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption'))))))))
1225
1226 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlSimpleChooserOption"
1227 simpleChooserOption'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption')))))))
1228
1229 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlWriterExtensibleOption"
1230 writerExtensibleOption'_ :: ((QlPlainVanillaPayoff) -> ((QlExercise) -> ((QlPlainVanillaPayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption'))))))))
1231
1232 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMargrabeOptionDelta1"
1233 delta1'_ :: ((C2HSImp.Ptr (CMargrabeOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1234
1235 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMargrabeOptionDelta2"
1236 delta2'_ :: ((C2HSImp.Ptr (CMargrabeOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1237
1238 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMargrabeOptionGamma1"
1239 gamma1'_ :: ((C2HSImp.Ptr (CMargrabeOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1240
1241 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMargrabeOptionGamma2"
1242 gamma2'_ :: ((C2HSImp.Ptr (CMargrabeOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1243
1244 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionDeltaForward"
1245 deltaForward'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1246
1247 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionElasticity"
1248 elasticity'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1249
1250 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionStrikeSensitivity"
1251 strikeSensitivity'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1252
1253 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionThetaPerDay"
1254 thetaPerDay'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1255
1256 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMargrabeOption"
1257 margrabeOption'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CMargrabeOption')))))))
1258
1259 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlTwoAssetBarrierOption"
1260 twoAssetBarrierOption'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CInstrument'))))))))
1261
1262 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMultiAssetOption"
1263 multiAssetOption'_ :: ((QlPayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CMultiAssetOption'))))))
1264
1265 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlTwoAssetCorrelationOption"
1266 twoAssetCorrelationOption'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CMultiAssetOption'))))))))
1267
1268 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionItmCashProbability"
1269 itmCashProbability'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1270
1271 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOption"
1272 oneAssetOption'_ :: ((QlPayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption'))))))
1273
1274 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoBarrierOption"
1275 quantoBarrierOption'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CQuantoBarrierOption')))))))))
1276
1277 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoDoubleBarrierOption"
1278 quantoDoubleBarrierOption'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CQuantoDoubleBarrierOption'))))))))))
1279
1280 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlBasketOption"
1281 basketOption'_ :: ((QlBasketPayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CMultiAssetOption'))))))
1282
1283 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlHimalayaOption"
1284 himalayaOption'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CMultiAssetOption')))))))
1285
1286 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlPagodaOption"
1287 pagodaOption'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CMultiAssetOption'))))))))
1288
1289 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlCliquetOption"
1290 cliquetOption'_ :: ((QlPercentageStrikePayoff) -> ((QlEuropeanExercise) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption'))))))))
1291
1292 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlContinuousAveragingAsianOption"
1293 continuousAveragingAsianOption'_ :: (C2HSImp.CInt -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption')))))))
1294
1295 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlContinuousFixedLookbackOption"
1296 continuousFixedLookbackOption'_ :: (C2HSImp.CDouble -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption')))))))
1297
1298 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlContinuousFloatingLookbackOption"
1299 continuousFloatingLookbackOption'_ :: (C2HSImp.CDouble -> ((QlTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption')))))))
1300
1301 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlDiscreteAveragingAsianOption"
1302 discreteAveragingAsianOption'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption')))))))))))
1303
1304 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlVanillaStorageOption"
1305 vanillaStorageOption'_ :: ((QlBermudanExercise) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption'))))))))
1306
1307 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlVanillaSwingOption"
1308 vanillaSwingOption'_ :: ((QlStrikedTypePayoff) -> ((QlSwingExercise) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COneAssetOption'))))))))
1309
1310 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlEuropeanOption"
1311 europeanOption'_ :: ((QlStrikedTypePayoff) -> ((QlExercise) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CVanillaOption'))))))
1312
1313 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMultiAssetOptionDelta"
1314 qlMultiAssetOptionDelta'_ :: ((C2HSImp.Ptr (CMultiAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1315
1316 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMultiAssetOptionDividendRho"
1317 qlMultiAssetOptionDividendRho'_ :: ((C2HSImp.Ptr (CMultiAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1318
1319 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMultiAssetOptionGamma"
1320 qlMultiAssetOptionGamma'_ :: ((C2HSImp.Ptr (CMultiAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1321
1322 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMultiAssetOptionRho"
1323 qlMultiAssetOptionRho'_ :: ((C2HSImp.Ptr (CMultiAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1324
1325 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMultiAssetOptionTheta"
1326 qlMultiAssetOptionTheta'_ :: ((C2HSImp.Ptr (CMultiAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1327
1328 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlMultiAssetOptionVega"
1329 qlMultiAssetOptionVega'_ :: ((C2HSImp.Ptr (CMultiAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1330
1331 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionDelta"
1332 qlOneAssetOptionDelta'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1333
1334 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionDividendRho"
1335 qlOneAssetOptionDividendRho'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1336
1337 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionGamma"
1338 qlOneAssetOptionGamma'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1339
1340 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionRho"
1341 qlOneAssetOptionRho'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1342
1343 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionTheta"
1344 qlOneAssetOptionTheta'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1345
1346 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlOneAssetOptionVega"
1347 qlOneAssetOptionVega'_ :: ((C2HSImp.Ptr (COneAssetOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1348
1349 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoBarrierOptionQrho"
1350 qlQuantoBarrierOptionQrho'_ :: ((C2HSImp.Ptr (CQuantoBarrierOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1351
1352 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoBarrierOptionQvega"
1353 qlQuantoBarrierOptionQvega'_ :: ((C2HSImp.Ptr (CQuantoBarrierOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1354
1355 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoBarrierOptionQlambda"
1356 qlQuantoBarrierOptionQlambda'_ :: ((C2HSImp.Ptr (CQuantoBarrierOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1357
1358 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoDoubleBarrierOptionQrho"
1359 qlQuantoDoubleBarrierOptionQrho'_ :: ((C2HSImp.Ptr (CQuantoDoubleBarrierOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1360
1361 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoDoubleBarrierOptionQvega"
1362 qlQuantoDoubleBarrierOptionQvega'_ :: ((C2HSImp.Ptr (CQuantoDoubleBarrierOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1363
1364 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoDoubleBarrierOptionQlambda"
1365 qlQuantoDoubleBarrierOptionQlambda'_ :: ((C2HSImp.Ptr (CQuantoDoubleBarrierOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1366
1367 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoForwardVanillaOptionQrho"
1368 qlQuantoForwardVanillaOptionQrho'_ :: ((C2HSImp.Ptr (CQuantoForwardVanillaOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1369
1370 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoForwardVanillaOptionQvega"
1371 qlQuantoForwardVanillaOptionQvega'_ :: ((C2HSImp.Ptr (CQuantoForwardVanillaOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1372
1373 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoForwardVanillaOptionQlambda"
1374 qlQuantoForwardVanillaOptionQlambda'_ :: ((C2HSImp.Ptr (CQuantoForwardVanillaOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1375
1376 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoVanillaOptionQrho"
1377 qlQuantoVanillaOptionQrho'_ :: ((C2HSImp.Ptr (CQuantoVanillaOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1378
1379 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoVanillaOptionQvega"
1380 qlQuantoVanillaOptionQvega'_ :: ((C2HSImp.Ptr (CQuantoVanillaOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1381
1382 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlQuantoVanillaOptionQlambda"
1383 qlQuantoVanillaOptionQlambda'_ :: ((C2HSImp.Ptr (CQuantoVanillaOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
1384
1385 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlVanillaOptionImpliedVolatility"
1386 qlVanillaOptionImpliedVolatility'_ :: ((C2HSImp.Ptr (CVanillaOption')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CDividend))) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))))))))
1387
1388 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlBarrierOptionImpliedVolatility"
1389 qlBarrierOptionImpliedVolatility'_ :: ((C2HSImp.Ptr (CBarrierOption')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CDividend))) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))))))))
1390
1391 foreign import ccall safe "QuantLib/Instrument/Option.chs.h qlDoubleBarrierOptionImpliedVolatility"
1392 doubleBarrierOptionImpliedVolatility'_ :: ((C2HSImp.Ptr (CDoubleBarrierOption')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))))))