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 module QuantLib.Process
6 (
7 ProcessDiscretization(..)
8 , ExtendedBlackScholesMertonProcessDiscretization(..)
9 , HestonProcessDiscretization(..)
10 , GJRGARCHProcessDiscretization(..)
11 , HybridHestonHullWhiteProcessDiscretization(..)
12
13 , GeneralizedBlackScholesProcess
14 , StochasticProcess1D
15 , GenStochasticProcess1D
16 , StochasticProcess
17 , GenStochasticProcess
18 , BlackProcess
19 , ExtOUWithJumpsProcess
20 , ExtendedOrnsteinUhlenbeckProcess
21 , GJRGARCHProcess
22 , HestonProcess
23 , GenHestonProcess
24 , BatesProcess
25 , G2Process
26 , G2ForwardProcess
27 , HybridHestonHullWhiteProcess
28 , KlugeExtOUProcess
29 , LiborForwardModelProcess
30 , StochasticProcessArray
31 , VarianceGammaProcess
32 , Merton76Process
33 , HullWhiteProcess
34 , HullWhiteForwardProcess
35
36 , asStochasticProcess
37 , asStochasticProcess1D
38 , asGeneralizedBlackScholesProcess
39 , asHestonProcess
40
41 , blackProcess
42 , blackScholesMertonProcess
43 , blackScholesProcess
44 , extendedBlackScholesMertonProcess
45 , garmanKohlagenProcess
46 , generalizedBlackScholesProcess
47 , squareRootProcess
48 , vegaStressedBlackScholesProcess
49
50 , batesProcess
51 , diffusion
52 , drift
53 , expectation
54 , extOUWithJumpsProcess
55 , factors
56 , initialValues
57 , g2ForwardProcess
58 , g2Process
59 , gemanRoncoroniProcess
60 , geometricBrownianMotionProcess
61 , gjrGARCHProcess
62 , hestonProcess
63 , hullWhiteForwardProcess
64 , hullWhiteProcess
65 , hybridHestonHullWhiteProcess
66 , klugeExtOUProcess
67 , liborForwardModelProcess
68 , liborForwardModelProcessFixingDates
69 , liborForwardModelProcessFixingTimes
70 , liborForwardModelProcessCashFlows
71 , liborForwardModelProcessIndex
72 , merton76Process
73 , ornsteinUhlenbeckProcess
74 , varianceGammaProcess
75 , stochasticProcessArray
76
77 , g2Phi
78 , g2ShortRate
79 , g2ForwardPhi
80 , g2ForwardShortRate
81 , setForwardMeasureTime
82
83 , blackScholesTheta
84 ) where
85 import qualified Foreign.C.Types as C2HSImp
86 import qualified Foreign.ForeignPtr as C2HSImp
87 import qualified Foreign.Marshal.Utils as C2HSImp
88 import qualified Foreign.Ptr as C2HSImp
89 import qualified System.IO.Unsafe as C2HSImp
90
91
92
93
94
95
96
97 import QuantLib.Internal
98 import QuantLib.Internal.Type
99
100 data ProcessDiscretization = EulerDiscretization
101 | EndEulerDiscretization
102 deriving (Show,Eq,Read)
103 instance Enum ProcessDiscretization where
104 succ EulerDiscretization = EndEulerDiscretization
105 succ EndEulerDiscretization = error "ProcessDiscretization.succ: EndEulerDiscretization has no successor"
106
107 pred EndEulerDiscretization = EulerDiscretization
108 pred EulerDiscretization = error "ProcessDiscretization.pred: EulerDiscretization has no predecessor"
109
110 enumFromTo from to = go from
111 where
112 end = fromEnum to
113 go v = case compare (fromEnum v) end of
114 LT -> v : go (succ v)
115 EQ -> [v]
116 GT -> []
117
118 enumFrom from = enumFromTo from EndEulerDiscretization
119
120 fromEnum EulerDiscretization = 0
121 fromEnum EndEulerDiscretization = 1
122
123 toEnum 0 = EulerDiscretization
124 toEnum 1 = EndEulerDiscretization
125 toEnum unmatched = error ("ProcessDiscretization.toEnum: Cannot match " ++ show unmatched)
126
127
128 data ExtendedBlackScholesMertonProcessDiscretization = ExtendedBSMEuler
129 | Milstein
130 | PredictorCorrector
131 deriving (Enum,Show,Eq,Read)
132
133
134 data HestonProcessDiscretization = HestonPartialTruncation
135 | HestonFullTruncation
136 | HestonReflection
137 | NonCentralChiSquareVariance
138 | QuadraticExponential
139 | QuadraticExponentialMartingale
140 | BroadieKayaExactSchemeLobatto
141 | BroadieKayaExactSchemeLaguerre
142 | BroadieKayaExactSchemeTrapezoidal
143 deriving (Enum,Show,Eq,Read)
144
145
146 data GJRGARCHProcessDiscretization = GJRGARCHPartialTruncation
147 | GJRGARCHFullTruncation
148 | GJRGARCHReflection
149 deriving (Enum,Show,Eq,Read)
150
151
152 data HybridHestonHullWhiteProcessDiscretization = HybridHestonHullWhiteEuler
153 | BSMHullWhite
154 deriving (Enum,Show,Eq,Read)
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208 -- |Black (1976) process for a forward or futures contract: d(ln S) = -sigma^2\/2 dt + sigma dW.
209 blackProcess :: (GenQuote q) -- ^x0
210 -> (GenYieldTermStructure y) -- ^riskFreeTS
211 -> (GenBlackVolTermStructure bv) -- ^blackVolTS
212 -> (ProcessDiscretization) -> (Bool) -- ^forceDiscretization
213 -> IO ((BlackProcess))
214 blackProcess a1 a2 a3 a4 a5 =
215 withQuote a1 $ \a1' ->
216 withYieldTermStructure a2 $ \a2' ->
217 withBlackVolTermStructure a3 $ \a3' ->
218 let {a4' = (fromIntegral . fromEnum) a4} in
219 let {a5' = C2HSImp.fromBool a5} in
220 preErrorCheck $ \a6' ->
221 blackProcess'_ a1' a2' a3' a4' a5' a6' >>= \res ->
222 peekBlackProcess res >>= \res' ->
223 errorCheck a6'>>
224 return (res')
225
226
227
228 -- |Merton (1973) extension of Black-Scholes for a continuous-dividend-paying stock:
229 -- d(ln S) = (r - q - sigma^2\/2) dt + sigma dW.
230 blackScholesMertonProcess :: (GenQuote q) -- ^x0
231 -> (GenYieldTermStructure y1) -- ^dividendTS
232 -> (GenYieldTermStructure y2) -- ^riskFreeTS
233 -> (GenBlackVolTermStructure bv) -- ^blackVolTS
234 -> (ProcessDiscretization) -> (Bool) -- ^forceDiscretization
235 -> IO ((GeneralizedBlackScholesProcess))
236 blackScholesMertonProcess a1 a2 a3 a4 a5 a6 =
237 withQuote a1 $ \a1' ->
238 withYieldTermStructure a2 $ \a2' ->
239 withYieldTermStructure a3 $ \a3' ->
240 withBlackVolTermStructure a4 $ \a4' ->
241 let {a5' = (fromIntegral . fromEnum) a5} in
242 let {a6' = C2HSImp.fromBool a6} in
243 preErrorCheck $ \a7' ->
244 blackScholesMertonProcess'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
245 peekGeneralizedBlackScholesProcess res >>= \res' ->
246 errorCheck a7'>>
247 return (res')
248
249
250
251 -- |Black-Scholes (1973) process for a stock: d(ln S) = (r - sigma^2\/2) dt + sigma dW.
252 blackScholesProcess :: (GenQuote q) -- ^x0
253 -> (GenYieldTermStructure y) -- ^riskFreeTS
254 -> (GenBlackVolTermStructure bv) -- ^blackVolTS
255 -> (ProcessDiscretization) -> (Bool) -- ^forceDiscretization
256 -> IO ((GeneralizedBlackScholesProcess))
257 blackScholesProcess a1 a2 a3 a4 a5 =
258 withQuote a1 $ \a1' ->
259 withYieldTermStructure a2 $ \a2' ->
260 withBlackVolTermStructure a3 $ \a3' ->
261 let {a4' = (fromIntegral . fromEnum) a4} in
262 let {a5' = C2HSImp.fromBool a5} in
263 preErrorCheck $ \a6' ->
264 blackScholesProcess'_ a1' a2' a3' a4' a5' a6' >>= \res ->
265 peekGeneralizedBlackScholesProcess res >>= \res' ->
266 errorCheck a6'>>
267 return (res')
268
269
270
271 -- |'blackScholesMertonProcess' with a choice of evolution scheme (Euler\/Milstein\/predictor-corrector)
272 -- on top of the discretization argument.
273 extendedBlackScholesMertonProcess :: (GenQuote q) -- ^x0
274 -> (GenYieldTermStructure y1) -- ^dividendTS
275 -> (GenYieldTermStructure y2) -- ^riskFreeTS
276 -> (GenBlackVolTermStructure bv) -- ^blackVolTS
277 -> (ProcessDiscretization) -> (ExtendedBlackScholesMertonProcessDiscretization) -> IO ((GeneralizedBlackScholesProcess))
278 extendedBlackScholesMertonProcess a1 a2 a3 a4 a5 a6 =
279 withQuote a1 $ \a1' ->
280 withYieldTermStructure a2 $ \a2' ->
281 withYieldTermStructure a3 $ \a3' ->
282 withBlackVolTermStructure a4 $ \a4' ->
283 let {a5' = (fromIntegral . fromEnum) a5} in
284 let {a6' = (fromIntegral . fromEnum) a6} in
285 preErrorCheck $ \a7' ->
286 extendedBlackScholesMertonProcess'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
287 peekGeneralizedBlackScholesProcess res >>= \res' ->
288 errorCheck a7'>>
289 return (res')
290
291
292
293 -- |Garman-Kohlhagen (1983) process for an exchange rate: d(ln S) = (r - r_f - sigma^2\/2) dt + sigma dW.
294 garmanKohlagenProcess :: (GenQuote q) -- ^x0
295 -> (GenYieldTermStructure y1) -- ^foreignRiskFreeTS
296 -> (GenYieldTermStructure y2) -- ^domesticRiskFreeTS
297 -> (GenBlackVolTermStructure bv) -- ^blackVolTS
298 -> (ProcessDiscretization) -> (Bool) -- ^forceDiscretization
299 -> IO ((GeneralizedBlackScholesProcess))
300 garmanKohlagenProcess a1 a2 a3 a4 a5 a6 =
301 withQuote a1 $ \a1' ->
302 withYieldTermStructure a2 $ \a2' ->
303 withYieldTermStructure a3 $ \a3' ->
304 withBlackVolTermStructure a4 $ \a4' ->
305 let {a5' = (fromIntegral . fromEnum) a5} in
306 let {a6' = C2HSImp.fromBool a6} in
307 preErrorCheck $ \a7' ->
308 garmanKohlagenProcess'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
309 peekGeneralizedBlackScholesProcess res >>= \res' ->
310 errorCheck a7'>>
311 return (res')
312
313
314
315 -- |Generalized Black-Scholes process with separate dividend and risk-free curves:
316 -- d(ln S) = (r - q - sigma^2\/2) dt + sigma dW.
317 generalizedBlackScholesProcess :: (GenQuote q) -- ^x0
318 -> (GenYieldTermStructure y1) -- ^dividendTS
319 -> (GenYieldTermStructure y2) -- ^riskFreeTS
320 -> (GenBlackVolTermStructure bv) -- ^blackVolTS
321 -> (ProcessDiscretization) -> (Bool) -- ^forceDiscretization
322 -> IO ((GeneralizedBlackScholesProcess))
323 generalizedBlackScholesProcess a1 a2 a3 a4 a5 a6 =
324 withQuote a1 $ \a1' ->
325 withYieldTermStructure a2 $ \a2' ->
326 withYieldTermStructure a3 $ \a3' ->
327 withBlackVolTermStructure a4 $ \a4' ->
328 let {a5' = (fromIntegral . fromEnum) a5} in
329 let {a6' = C2HSImp.fromBool a6} in
330 preErrorCheck $ \a7' ->
331 generalizedBlackScholesProcess'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
332 peekGeneralizedBlackScholesProcess res >>= \res' ->
333 errorCheck a7'>>
334 return (res')
335
336
337
338 -- |square-root process: dx = a (b - x) dt + sigma sqrt(x) dW.
339 squareRootProcess :: (Double) -- ^b
340 -> (Double) -- ^a
341 -> (Double) -- ^sigma
342 -> (Double) -- ^x0
343 -> (ProcessDiscretization) -> IO ((StochasticProcess1D))
344 squareRootProcess a1 a2 a3 a4 a5 =
345 let {a1' = realToFrac a1} in
346 let {a2' = realToFrac a2} in
347 let {a3' = realToFrac a3} in
348 let {a4' = realToFrac a4} in
349 let {a5' = (fromIntegral . fromEnum) a5} in
350 preErrorCheck $ \a6' ->
351 squareRootProcess'_ a1' a2' a3' a4' a5' a6' >>= \res ->
352 peekStochasticProcess1D res >>= \res' ->
353 errorCheck a6'>>
354 return (res')
355
356
357
358 -- |'blackScholesMertonProcess' variant supporting local vega stress tests over a given
359 -- time\/asset border and stress level.
360 vegaStressedBlackScholesProcess :: (GenQuote q) -- ^x0
361 -> (GenYieldTermStructure y1) -- ^dividendTS
362 -> (GenYieldTermStructure y2) -- ^riskFreeTS
363 -> (GenBlackVolTermStructure bv) -- ^blackVolTS
364 -> (Double) -- ^lowerTimeBorderForStressTest
365 -> (Double) -- ^upperTimeBorderForStressTest
366 -> (Double) -- ^lowerAssetBorderForStressTest
367 -> (Double) -- ^upperAssetBorderForStressTest
368 -> (Double) -- ^stressLevel
369 -> (ProcessDiscretization) -> IO ((GeneralizedBlackScholesProcess))
370 vegaStressedBlackScholesProcess a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
371 withQuote a1 $ \a1' ->
372 withYieldTermStructure a2 $ \a2' ->
373 withYieldTermStructure a3 $ \a3' ->
374 withBlackVolTermStructure a4 $ \a4' ->
375 let {a5' = realToFrac a5} in
376 let {a6' = realToFrac a6} in
377 let {a7' = realToFrac a7} in
378 let {a8' = realToFrac a8} in
379 let {a9' = realToFrac a9} in
380 let {a10' = (fromIntegral . fromEnum) a10} in
381 preErrorCheck $ \a11' ->
382 vegaStressedBlackScholesProcess'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' >>= \res ->
383 peekGeneralizedBlackScholesProcess res >>= \res' ->
384 errorCheck a11'>>
385 return (res')
386
387
388
389 -- |square-root stochastic-volatility Bates process: a Heston process plus a compound Poisson
390 -- jump component with log-normally distributed jump size.
391 batesProcess :: (GenYieldTermStructure y1) -- ^riskFreeTS
392 -> (GenYieldTermStructure y2) -- ^dividendYield
393 -> (GenQuote q) -- ^s0
394 -> (Double) -- ^v0
395 -> (Double) -- ^kappa
396 -> (Double) -- ^theta
397 -> (Double) -- ^sigma
398 -> (Double) -- ^rho
399 -> (Double) -- ^lambda
400 -> (Double) -- ^nu
401 -> (Double) -- ^delta
402 -> (HestonProcessDiscretization) -> IO ((BatesProcess))
403 batesProcess a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 =
404 withYieldTermStructure a1 $ \a1' ->
405 withYieldTermStructure a2 $ \a2' ->
406 withQuote a3 $ \a3' ->
407 let {a4' = realToFrac a4} in
408 let {a5' = realToFrac a5} in
409 let {a6' = realToFrac a6} in
410 let {a7' = realToFrac a7} in
411 let {a8' = realToFrac a8} in
412 let {a9' = realToFrac a9} in
413 let {a10' = realToFrac a10} in
414 let {a11' = realToFrac a11} in
415 let {a12' = (fromIntegral . fromEnum) a12} in
416 preErrorCheck $ \a13' ->
417 batesProcess'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' >>= \res ->
418 peekBatesProcess res >>= \res' ->
419 errorCheck a13'>>
420 return (res')
421
422
423
424 -- |Kluge model: an extended Ornstein-Uhlenbeck process plus an exponential-jump component,
425 -- S = exp(X + Y) with dX = alpha (mu(t) - X) dt + sigma dW and dY = -beta Y dt + J dN.
426 extOUWithJumpsProcess :: (ExtendedOrnsteinUhlenbeckProcess) -> (Double) -- ^Y0
427 -> (Double) -- ^beta
428 -> (Double) -- ^jumpIntensity
429 -> (Double) -- ^eta
430 -> IO ((ExtOUWithJumpsProcess))
431 extOUWithJumpsProcess a1 a2 a3 a4 a5 =
432 withGenStochasticProcess1D a1 $ \a1' ->
433 let {a2' = realToFrac a2} in
434 let {a3' = realToFrac a3} in
435 let {a4' = realToFrac a4} in
436 let {a5' = realToFrac a5} in
437 preErrorCheck $ \a6' ->
438 extOUWithJumpsProcess'_ a1' a2' a3' a4' a5' a6' >>= \res ->
439 peekExtOUWithJumpsProcess res >>= \res' ->
440 errorCheck a6'>>
441 return (res')
442
443
444
445 -- |T-forward-measure counterpart of 'g2Process': the two-factor G2++ short-rate model, with
446 -- the simulated state again shifted so its components sum to the short rate.
447 g2ForwardProcess :: (Double) -- ^a
448 -> (Double) -- ^sigma
449 -> (Double) -- ^b
450 -> (Double) -- ^eta
451 -> (Double) -- ^rho
452 -> (Maybe (GenYieldTermStructure y)) -- ^termStructure
453 -> IO ((G2ForwardProcess))
454 g2ForwardProcess a1 a2 a3 a4 a5 a6 =
455 let {a1' = realToFrac a1} in
456 let {a2' = realToFrac a2} in
457 let {a3' = realToFrac a3} in
458 let {a4' = realToFrac a4} in
459 let {a5' = realToFrac a5} in
460 withMaybeYieldTermStructure a6 $ \a6' ->
461 preErrorCheck $ \a7' ->
462 g2ForwardProcess'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
463 peekG2ForwardProcess res >>= \res' ->
464 errorCheck a7'>>
465 return (res')
466
467
468
469 -- |two-factor G2++ short-rate process, state shifted so its two OU components sum to the
470 -- short rate; degenerates to a pair of zero-mean OU processes if no term structure is given.
471 g2Process :: (Double) -- ^a
472 -> (Double) -- ^sigma
473 -> (Double) -- ^b
474 -> (Double) -- ^eta
475 -> (Double) -- ^rho
476 -> (Maybe (GenYieldTermStructure y)) -- ^termStructure
477 -> IO ((G2Process))
478 g2Process a1 a2 a3 a4 a5 a6 =
479 let {a1' = realToFrac a1} in
480 let {a2' = realToFrac a2} in
481 let {a3' = realToFrac a3} in
482 let {a4' = realToFrac a4} in
483 let {a5' = realToFrac a5} in
484 withMaybeYieldTermStructure a6 $ \a6' ->
485 preErrorCheck $ \a7' ->
486 g2Process'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
487 peekG2Process res >>= \res' ->
488 errorCheck a7'>>
489 return (res')
490
491
492
493 -- |the deterministic offset phi(t) that fits 'g2Process''s initial term structure -- throws if
494 -- the process was constructed with no term structure.
495 g2Phi :: (G2Process) -> (Double) -- ^t
496 -> IO ((Double))
497 g2Phi a1 a2 =
498 withGenStochasticProcess a1 $ \a1' ->
499 let {a2' = realToFrac a2} in
500 preErrorCheck $ \a3' ->
501 g2Phi'_ a1' a2' a3' >>= \res ->
502 let {res' = realToFrac res} in
503 errorCheck a3'>>
504 return (res')
505
506
507
508 -- |the short rate implied by a simulated 'g2Process' state @(z1, z2)@ at time /t/: just
509 -- @z1 + z2@, since 'g2Phi''s offset is already baked into the first simulated component.
510 g2ShortRate :: (G2Process) -> (Double) -- ^t
511 -> (Double) -- ^z1
512 -> (Double) -- ^z2
513 -> (Double)
514 g2ShortRate a1 a2 a3 a4 =
515 C2HSImp.unsafePerformIO $
516 withGenStochasticProcess a1 $ \a1' ->
517 let {a2' = realToFrac a2} in
518 let {a3' = realToFrac a3} in
519 let {a4' = realToFrac a4} in
520 g2ShortRate'_ a1' a2' a3' a4' >>= \res ->
521 let {res' = realToFrac res} in
522 return (res')
523
524
525
526 -- |the deterministic offset phi(t) that fits 'g2ForwardProcess''s initial term structure --
527 -- throws if the process was constructed with no term structure.
528 g2ForwardPhi :: (G2ForwardProcess) -> (Double) -- ^t
529 -> IO ((Double))
530 g2ForwardPhi a1 a2 =
531 withGenStochasticProcess a1 $ \a1' ->
532 let {a2' = realToFrac a2} in
533 preErrorCheck $ \a3' ->
534 g2ForwardPhi'_ a1' a2' a3' >>= \res ->
535 let {res' = realToFrac res} in
536 errorCheck a3'>>
537 return (res')
538
539
540
541 -- |the short rate implied by a simulated 'g2ForwardProcess' state @(z1, z2)@ at time /t/: just
542 -- @z1 + z2@, since 'g2ForwardPhi''s offset is already baked into the first simulated component.
543 g2ForwardShortRate :: (G2ForwardProcess) -> (Double) -- ^t
544 -> (Double) -- ^z1
545 -> (Double) -- ^z2
546 -> (Double)
547 g2ForwardShortRate a1 a2 a3 a4 =
548 C2HSImp.unsafePerformIO $
549 withGenStochasticProcess a1 $ \a1' ->
550 let {a2' = realToFrac a2} in
551 let {a3' = realToFrac a3} in
552 let {a4' = realToFrac a4} in
553 g2ForwardShortRate'_ a1' a2' a3' a4' >>= \res ->
554 let {res' = realToFrac res} in
555 return (res')
556
557
558
559 -- |the number of independent Brownian factors driving a stochastic process -- e.g. 2 for
560 -- 'g2Process', matching its state size; used to size a 'QuantLib.Method.pathGenerator''s
561 -- underlying sequence generator (@process->factors() * steps@, mirroring upstream's own usage).
562 factors :: (GenStochasticProcess p) -> IO ((Word))
563 factors a1 =
564 withStochasticProcess a1 $ \a1' ->
565 preErrorCheck $ \a2' ->
566 factors'_ a1' a2' >>= \res ->
567 let {res' = fromIntegral res} in
568 errorCheck a2'>>
569 return (res')
570
571
572
573 -- |the process's state at time 0, e.g. @(0, 0)@ for a curveless 'g2Process' or
574 -- @(phi(0), 0)@ once a term structure is given.
575 initialValues :: (GenStochasticProcess p) -> IO (([Double]))
576 initialValues a1 =
577 withStochasticProcess a1 $ \a1' ->
578 preArray $ \(a2'1, a2'2) ->
579 preErrorCheck $ \a3' ->
580 initialValues'_ a1' a2'1 a2'2 a3' >>
581 peekDoubleArray a2'1 a2'2>>= \a2'' ->
582 errorCheck a3'>>
583 return (a2'')
584
585
586
587 -- |the drift part of the process's SDE at state /x/ and time /t/, i.e. @mu(t, x_t)@ in
588 -- @dx_t = mu(t, x_t) dt + sigma(t, x_t) dW_t@.
589 drift :: (GenStochasticProcess p) -> (Double) -- ^t
590 -> ([Double]) -- ^x
591 -> IO (([Double]))
592 drift a1 a2 a3 =
593 withStochasticProcess a1 $ \a1' ->
594 let {a2' = realToFrac a2} in
595 withDoubleArray a3 $ \(a3'1, a3'2) ->
596 preArray $ \(a4'1, a4'2) ->
597 preErrorCheck $ \a5' ->
598 drift'_ a1' a2' a3'1 a3'2 a4'1 a4'2 a5' >>
599 peekDoubleArray a4'1 a4'2>>= \a4'' ->
600 errorCheck a5'>>
601 return (a4'')
602
603
604
605 toMatrixDouble :: (Word, Word, [Double]) -> Matrix Double
606 toMatrixDouble (r, c, d) = Matrix r c d
607
608 -- |the diffusion part of the process's SDE at state /x/ and time /t/, i.e. @sigma(t, x_t)@ in
609 -- @dx_t = mu(t, x_t) dt + sigma(t, x_t) dW_t@.
610 diffusion :: GenStochasticProcess p -> Double -> [Double] -> IO (Matrix Double)
611 diffusion p t x = toMatrixDouble <$> qlStochasticProcessDiffusion p t x
612 qlStochasticProcessDiffusion :: (GenStochasticProcess p) -> (Double) -- ^t
613 -> ([Double]) -- ^x
614 -> IO ((Word), (Word), ([Double]))
615 qlStochasticProcessDiffusion a1 a2 a3 =
616 withStochasticProcess a1 $ \a1' ->
617 let {a2' = realToFrac a2} in
618 withDoubleArray a3 $ \(a3'1, a3'2) ->
619 prePtr $ \a4' ->
620 prePtr $ \a5' ->
621 preArray $ \(a6'1, a6'2) ->
622 preErrorCheck $ \a7' ->
623 qlStochasticProcessDiffusion'_ a1' a2' a3'1 a3'2 a4' a5' a6'1 a6'2 a7' >>
624 peekWord a4'>>= \a4'' ->
625 peekWord a5'>>= \a5'' ->
626 peekDoubleArray a6'1 a6'2>>= \a6'' ->
627 errorCheck a7'>>
628 return (a4'', a5'', a6'')
629
630
631
632 -- |E[x_(t0+dt) | x_t0 = x0], the expected state at /t0+dt/ given state /x0/ at time /t0/.
633 expectation :: (GenStochasticProcess p) -> (Double) -- ^t0
634 -> ([Double]) -- ^x0
635 -> (Double) -- ^dt
636 -> IO (([Double]))
637 expectation a1 a2 a3 a4 =
638 withStochasticProcess a1 $ \a1' ->
639 let {a2' = realToFrac a2} in
640 withDoubleArray a3 $ \(a3'1, a3'2) ->
641 let {a4' = realToFrac a4} in
642 preArray $ \(a5'1, a5'2) ->
643 preErrorCheck $ \a6' ->
644 expectation'_ a1' a2' a3'1 a3'2 a4' a5'1 a5'2 a6' >>
645 peekDoubleArray a5'1 a5'2>>= \a5'' ->
646 errorCheck a6'>>
647 return (a5'')
648
649
650
651 -- |Geman-Roncoroni process, a mean-reverting jump-diffusion model for electricity spot prices
652 -- with a seasonal deterministic mean and an asymmetric jump term.
653 gemanRoncoroniProcess :: (Double) -- ^x0
654 -> (Double) -- ^alpha
655 -> (Double) -- ^beta
656 -> (Double) -- ^gamma
657 -> (Double) -- ^delta
658 -> (Double) -- ^eps
659 -> (Double) -- ^zeta
660 -> (Double) -- ^d
661 -> (Double) -- ^k
662 -> (Double) -- ^tau
663 -> (Double) -- ^sig2
664 -> (Double) -- ^a
665 -> (Double) -- ^b
666 -> (Double) -- ^theta1
667 -> (Double) -- ^theta2
668 -> (Double) -- ^theta3
669 -> (Double) -- ^psi
670 -> IO ((StochasticProcess1D))
671 gemanRoncoroniProcess a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 =
672 let {a1' = realToFrac a1} in
673 let {a2' = realToFrac a2} in
674 let {a3' = realToFrac a3} in
675 let {a4' = realToFrac a4} in
676 let {a5' = realToFrac a5} in
677 let {a6' = realToFrac a6} in
678 let {a7' = realToFrac a7} in
679 let {a8' = realToFrac a8} in
680 let {a9' = realToFrac a9} in
681 let {a10' = realToFrac a10} in
682 let {a11' = realToFrac a11} in
683 let {a12' = realToFrac a12} in
684 let {a13' = realToFrac a13} in
685 let {a14' = realToFrac a14} in
686 let {a15' = realToFrac a15} in
687 let {a16' = realToFrac a16} in
688 let {a17' = realToFrac a17} in
689 preErrorCheck $ \a18' ->
690 gemanRoncoroniProcess'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' a17' a18' >>= \res ->
691 peekStochasticProcess1D res >>= \res' ->
692 errorCheck a18'>>
693 return (res')
694
695
696
697 -- |geometric Brownian motion process: dS = mue S dt + sigma S dW.
698 geometricBrownianMotionProcess :: (Double) -- ^initialValue
699 -> (Double) -- ^mue
700 -> (Double) -- ^sigma
701 -> IO ((StochasticProcess1D))
702 geometricBrownianMotionProcess a1 a2 a3 =
703 let {a1' = realToFrac a1} in
704 let {a2' = realToFrac a2} in
705 let {a3' = realToFrac a3} in
706 preErrorCheck $ \a4' ->
707 geometricBrownianMotionProcess'_ a1' a2' a3' a4' >>= \res ->
708 peekStochasticProcess1D res >>= \res' ->
709 errorCheck a4'>>
710 return (res')
711
712
713
714 -- |stochastic-volatility GJR-GARCH(1,1) process; parameters are supplied as daily constants
715 -- and annualized internally via daysPerYear.
716 gjrGARCHProcess :: (GenYieldTermStructure y1) -- ^riskFreeRate
717 -> (GenYieldTermStructure y2) -- ^dividendYield
718 -> (GenQuote q) -- ^s0
719 -> (Double) -- ^v0
720 -> (Double) -- ^omega
721 -> (Double) -- ^alpha
722 -> (Double) -- ^beta
723 -> (Double) -- ^gamma
724 -> (Double) -- ^lambda
725 -> (Double) -- ^daysPerYear
726 -> (GJRGARCHProcessDiscretization) -> IO ((GJRGARCHProcess))
727 gjrGARCHProcess a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
728 withYieldTermStructure a1 $ \a1' ->
729 withYieldTermStructure a2 $ \a2' ->
730 withQuote a3 $ \a3' ->
731 let {a4' = realToFrac a4} in
732 let {a5' = realToFrac a5} in
733 let {a6' = realToFrac a6} in
734 let {a7' = realToFrac a7} in
735 let {a8' = realToFrac a8} in
736 let {a9' = realToFrac a9} in
737 let {a10' = realToFrac a10} in
738 let {a11' = (fromIntegral . fromEnum) a11} in
739 preErrorCheck $ \a12' ->
740 gjrGARCHProcess'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
741 peekGJRGARCHProcess res >>= \res' ->
742 errorCheck a12'>>
743 return (res')
744
745
746
747 -- |/dividendYield/ may be 'Nothing' (an empty term-structure handle) -- required e.g. by
748 -- 'QuantLib.PricingEngine.integralHestonVarianceOptionEngine', which rejects a process with a
749 -- non-empty dividend handle.
750 hestonProcess :: (GenYieldTermStructure y1) -- ^riskFreeRate
751 -> (Maybe (GenYieldTermStructure y2)) -- ^dividendYield
752 -> (GenQuote q) -- ^s0
753 -> (Double) -- ^v0
754 -> (Double) -- ^kappa
755 -> (Double) -- ^theta
756 -> (Double) -- ^sigma
757 -> (Double) -- ^rho
758 -> (HestonProcessDiscretization) -> IO ((HestonProcess))
759 hestonProcess a1 a2 a3 a4 a5 a6 a7 a8 a9 =
760 withYieldTermStructure a1 $ \a1' ->
761 withMaybeYieldTermStructure a2 $ \a2' ->
762 withQuote a3 $ \a3' ->
763 let {a4' = realToFrac a4} in
764 let {a5' = realToFrac a5} in
765 let {a6' = realToFrac a6} in
766 let {a7' = realToFrac a7} in
767 let {a8' = realToFrac a8} in
768 let {a9' = (fromIntegral . fromEnum) a9} in
769 preErrorCheck $ \a10' ->
770 hestonProcess'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
771 peekHestonProcess res >>= \res' ->
772 errorCheck a10'>>
773 return (res')
774
775
776
777 -- |T-forward-measure counterpart of 'hullWhiteProcess'.
778 hullWhiteForwardProcess :: (GenYieldTermStructure y) -- ^h
779 -> (Double) -- ^y
780 -> (Double) -- ^sigma
781 -> IO ((HullWhiteForwardProcess))
782 hullWhiteForwardProcess a1 a2 a3 =
783 withYieldTermStructure a1 $ \a1' ->
784 let {a2' = realToFrac a2} in
785 let {a3' = realToFrac a3} in
786 preErrorCheck $ \a4' ->
787 hullWhiteForwardProcess'_ a1' a2' a3' a4' >>= \res ->
788 peekHullWhiteForwardProcess res >>= \res' ->
789 errorCheck a4'>>
790 return (res')
791
792
793
794 -- |sets the T-forward measure's maturity time: a required post-construction call before a
795 -- 'hullWhiteForwardProcess' can be used for forward-measure pricing (e.g. as the short-rate leg
796 -- of 'hybridHestonHullWhiteProcess') -- upstream calls it immediately after construction, once
797 -- the pricing horizon is known.
798 setForwardMeasureTime :: (HullWhiteForwardProcess) -> (Double) -- ^t
799 -> IO ()
800 setForwardMeasureTime a1 a2 =
801 withGenStochasticProcess1D a1 $ \a1' ->
802 let {a2' = realToFrac a2} in
803 preErrorCheck $ \a3' ->
804 setForwardMeasureTime'_ a1' a2' a3' >>
805 errorCheck a3'>>
806 return ()
807
808
809
810 -- |Hull-White one-factor short-rate process, fitted to the given initial term structure.
811 hullWhiteProcess :: (GenYieldTermStructure y) -- ^h
812 -> (Double) -- ^y
813 -> (Double) -- ^sigma
814 -> IO ((HullWhiteProcess))
815 hullWhiteProcess a1 a2 a3 =
816 withYieldTermStructure a1 $ \a1' ->
817 let {a2' = realToFrac a2} in
818 let {a3' = realToFrac a3} in
819 preErrorCheck $ \a4' ->
820 hullWhiteProcess'_ a1' a2' a3' a4' >>= \res ->
821 peekHullWhiteProcess res >>= \res' ->
822 errorCheck a4'>>
823 return (res')
824
825
826
827 -- |three-factor hybrid model combining a Heston equity process with a Hull-White short-rate
828 -- process, correlated via corrEquityShortRate.
829 hybridHestonHullWhiteProcess :: (GenHestonProcess hp) -> (HullWhiteForwardProcess) -> (Double) -- ^corrEquityShortRate
830 -> (HybridHestonHullWhiteProcessDiscretization) -> IO ((HybridHestonHullWhiteProcess))
831 hybridHestonHullWhiteProcess a1 a2 a3 a4 =
832 withHestonProcess a1 $ \a1' ->
833 withGenStochasticProcess1D a2 $ \a2' ->
834 let {a3' = realToFrac a3} in
835 let {a4' = (fromIntegral . fromEnum) a4} in
836 preErrorCheck $ \a5' ->
837 hybridHestonHullWhiteProcess'_ a1' a2' a3' a4' a5' >>= \res ->
838 peekHybridHestonHullWhiteProcess res >>= \res' ->
839 errorCheck a5'>>
840 return (res')
841
842
843
844 -- |joint correlated Kluge ('extOUWithJumpsProcess') and extended Ornstein-Uhlenbeck process.
845 klugeExtOUProcess :: (Double) -- ^rho
846 -> (ExtOUWithJumpsProcess) -> (ExtendedOrnsteinUhlenbeckProcess) -> IO ((KlugeExtOUProcess))
847 klugeExtOUProcess a1 a2 a3 =
848 let {a1' = realToFrac a1} in
849 withGenStochasticProcess a2 $ \a2' ->
850 withGenStochasticProcess1D a3 $ \a3' ->
851 preErrorCheck $ \a4' ->
852 klugeExtOUProcess'_ a1' a2' a3' a4' >>= \res ->
853 peekKlugeExtOUProcess res >>= \res' ->
854 errorCheck a4'>>
855 return (res')
856
857
858
859 -- |Libor market model process, evolving /size/ forward rates of /index/ under the rolling
860 -- forward measure with a predictor-corrector step.
861 liborForwardModelProcess :: (Word) -- ^size
862 -> (GenIborIndex ibor) -> IO ((LiborForwardModelProcess))
863 liborForwardModelProcess a1 a2 =
864 let {a1' = fromIntegral a1} in
865 withIborIndex a2 $ \a2' ->
866 preErrorCheck $ \a3' ->
867 liborForwardModelProcess'_ a1' a2' a3' >>= \res ->
868 peekLiborForwardModelProcess res >>= \res' ->
869 errorCheck a3'>>
870 return (res')
871
872
873
874 -- |the reset (fixing) dates of the forward rates this process evolves
875 liborForwardModelProcessFixingDates :: (LiborForwardModelProcess) -> IO (([Day]))
876 liborForwardModelProcessFixingDates a1 =
877 withGenStochasticProcess a1 $ \a1' ->
878 preArray $ \(a2'1, a2'2) ->
879 preErrorCheck $ \a3' ->
880 liborForwardModelProcessFixingDates'_ a1' a2'1 a2'2 a3' >>
881 peekDayArray a2'1 a2'2>>= \a2'' ->
882 errorCheck a3'>>
883 return (a2'')
884
885
886
887 -- |the reset (fixing) times of the forward rates this process evolves, in the process's own
888 -- day count fraction from the evaluation date
889 liborForwardModelProcessFixingTimes :: (LiborForwardModelProcess) -> IO (([Double]))
890 liborForwardModelProcessFixingTimes a1 =
891 withGenStochasticProcess a1 $ \a1' ->
892 preArray $ \(a2'1, a2'2) ->
893 preErrorCheck $ \a3' ->
894 liborForwardModelProcessFixingTimes'_ a1' a2'1 a2'2 a3' >>
895 peekDoubleArray a2'1 a2'2>>= \a2'' ->
896 errorCheck a3'>>
897 return (a2'')
898
899
900
901 -- |the leg of Ibor coupons (notional @amount@ each) this process's forward rates reset -- used
902 -- e.g. to build the 'QuantLib.Instrument.CapFloor.cap' this process prices via 'liborForwardModel'
903 liborForwardModelProcessCashFlows :: (LiborForwardModelProcess) -> (Double) -- ^amount
904 -> IO ((Leg))
905 liborForwardModelProcessCashFlows a1 a2 =
906 withGenStochasticProcess a1 $ \a1' ->
907 let {a2' = realToFrac a2} in
908 preErrorCheck $ \a3' ->
909 liborForwardModelProcessCashFlows'_ a1' a2' a3' >>= \res ->
910 peekLeg res >>= \res' ->
911 errorCheck a3'>>
912 return (res')
913
914
915
916 -- |the underlying 'IborIndex' this process was constructed with
917 liborForwardModelProcessIndex :: (LiborForwardModelProcess) -> IO ((IborIndex))
918 liborForwardModelProcessIndex a1 =
919 withGenStochasticProcess a1 $ \a1' ->
920 preErrorCheck $ \a2' ->
921 liborForwardModelProcessIndex'_ a1' a2' >>= \res ->
922 peekIborIndex res >>= \res' ->
923 errorCheck a2'>>
924 return (res')
925
926
927
928 -- |Merton (1976) jump-diffusion process: a Black-Scholes process plus a log-normal jump
929 -- component with Poisson jump intensity jumpInt.
930 merton76Process :: (GenQuote q1) -- ^stateVariable
931 -> (GenYieldTermStructure y1) -- ^dividendTS
932 -> (GenYieldTermStructure y2) -- ^riskFreeTS
933 -> (GenBlackVolTermStructure bv) -- ^blackVolTS
934 -> (GenQuote q2) -- ^jumpInt
935 -> (GenQuote q3) -- ^logJMean
936 -> (GenQuote q4) -- ^logJVol
937 -> (ProcessDiscretization) -> IO ((Merton76Process))
938 merton76Process a1 a2 a3 a4 a5 a6 a7 a8 =
939 withQuote a1 $ \a1' ->
940 withYieldTermStructure a2 $ \a2' ->
941 withYieldTermStructure a3 $ \a3' ->
942 withBlackVolTermStructure a4 $ \a4' ->
943 withQuote a5 $ \a5' ->
944 withQuote a6 $ \a6' ->
945 withQuote a7 $ \a7' ->
946 let {a8' = (fromIntegral . fromEnum) a8} in
947 preErrorCheck $ \a9' ->
948 merton76Process'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' >>= \res ->
949 peekMerton76Process res >>= \res' ->
950 errorCheck a9'>>
951 return (res')
952
953
954
955 -- |Ornstein-Uhlenbeck process: dx = a (level - x) dt + sigma dW.
956 ornsteinUhlenbeckProcess :: (Double) -- ^speed
957 -> (Double) -- ^vol
958 -> (Double) -- ^x0
959 -> (Double) -- ^level
960 -> IO ((StochasticProcess1D))
961 ornsteinUhlenbeckProcess a1 a2 a3 a4 =
962 let {a1' = realToFrac a1} in
963 let {a2' = realToFrac a2} in
964 let {a3' = realToFrac a3} in
965 let {a4' = realToFrac a4} in
966 preErrorCheck $ \a5' ->
967 ornsteinUhlenbeckProcess'_ a1' a2' a3' a4' a5' >>= \res ->
968 peekStochasticProcess1D res >>= \res' ->
969 errorCheck a5'>>
970 return (res')
971
972
973
974 -- |Variance Gamma process: a Brownian motion db = theta dt + sigma dW time-changed by an
975 -- independent Gamma process with mean 1 and variance rate nu.
976 varianceGammaProcess :: (GenQuote q) -- ^s0
977 -> (GenYieldTermStructure y1) -- ^dividendYield
978 -> (GenYieldTermStructure y2) -- ^riskFreeRate
979 -> (Double) -- ^sigma
980 -> (Double) -- ^nu
981 -> (Double) -- ^theta
982 -> IO ((VarianceGammaProcess))
983 varianceGammaProcess a1 a2 a3 a4 a5 a6 =
984 withQuote a1 $ \a1' ->
985 withYieldTermStructure a2 $ \a2' ->
986 withYieldTermStructure a3 $ \a3' ->
987 let {a4' = realToFrac a4} in
988 let {a5' = realToFrac a5} in
989 let {a6' = realToFrac a6} in
990 preErrorCheck $ \a7' ->
991 varianceGammaProcess'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
992 peekVarianceGammaProcess res >>= \res' ->
993 errorCheck a7'>>
994 return (res')
995
996
997
998 -- |array of correlated 1-D stochastic processes, driven by a joint correlation matrix.
999 stochasticProcessArray :: [GenStochasticProcess1D p1d] -> Matrix Double -- ^correlation
1000 -> IO StochasticProcessArray
1001 stochasticProcessArray a (Matrix mr mc md) = qlStochasticProcessArray a mr mc md
1002 qlStochasticProcessArray :: ([GenStochasticProcess1D p1d]) -> (Word) -> (Word) -> ([Double]) -> IO ((StochasticProcessArray))
1003 qlStochasticProcessArray a1 a2 a3 a4 =
1004 withStochasticProcess1DArray a1 $ \(a1'1, a1'2) ->
1005 let {a2' = fromIntegral a2} in
1006 let {a3' = fromIntegral a3} in
1007 withDoubleArrayRaw a4 $ \a4' ->
1008 preErrorCheck $ \a5' ->
1009 qlStochasticProcessArray'_ a1'1 a1'2 a2' a3' a4' a5' >>= \res ->
1010 peekStochasticProcessArray res >>= \res' ->
1011 errorCheck a5'>>
1012 return (res')
1013
1014
1015
1016 -- |default theta calculation for Black-Scholes options
1017 blackScholesTheta :: (GeneralizedBlackScholesProcess) -> (Double) -- ^value
1018 -> (Double) -- ^delta
1019 -> (Double) -- ^gamma
1020 -> IO ((Double))
1021 blackScholesTheta a1 a2 a3 a4 =
1022 withGeneralizedBlackScholesProcess a1 $ \a1' ->
1023 let {a2' = realToFrac a2} in
1024 let {a3' = realToFrac a3} in
1025 let {a4' = realToFrac a4} in
1026 preErrorCheck $ \a5' ->
1027 blackScholesTheta'_ a1' a2' a3' a4' a5' >>= \res ->
1028 let {res' = realToFrac res} in
1029 errorCheck a5'>>
1030 return (res')
1031
1032
1033
1034 -- vim: set ff=unix ts=8 sts=2 sw=2 et:
1035
1036 foreign import ccall safe "QuantLib/Process.chs.h qlBlackProcess"
1037 blackProcess'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CBlackProcess')))))))))
1038
1039 foreign import ccall safe "QuantLib/Process.chs.h qlBlackScholesMertonProcess"
1040 blackScholesMertonProcess'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CGeneralizedBlackScholesProcess'))))))))))
1041
1042 foreign import ccall safe "QuantLib/Process.chs.h qlBlackScholesProcess"
1043 blackScholesProcess'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CGeneralizedBlackScholesProcess')))))))))
1044
1045 foreign import ccall safe "QuantLib/Process.chs.h qlExtendedBlackScholesMertonProcess"
1046 extendedBlackScholesMertonProcess'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CGeneralizedBlackScholesProcess'))))))))))
1047
1048 foreign import ccall safe "QuantLib/Process.chs.h qlGarmanKohlagenProcess"
1049 garmanKohlagenProcess'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CGeneralizedBlackScholesProcess'))))))))))
1050
1051 foreign import ccall safe "QuantLib/Process.chs.h qlGeneralizedBlackScholesProcess"
1052 generalizedBlackScholesProcess'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CGeneralizedBlackScholesProcess'))))))))))
1053
1054 foreign import ccall safe "QuantLib/Process.chs.h qlSquareRootProcess"
1055 squareRootProcess'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CStochasticProcess1D')))))))))
1056
1057 foreign import ccall safe "QuantLib/Process.chs.h qlVegaStressedBlackScholesProcess"
1058 vegaStressedBlackScholesProcess'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CGeneralizedBlackScholesProcess'))))))))))))))
1059
1060 foreign import ccall safe "QuantLib/Process.chs.h qlBatesProcess"
1061 batesProcess'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CBatesProcess'))))))))))))))))
1062
1063 foreign import ccall safe "QuantLib/Process.chs.h qlExtOUWithJumpsProcess"
1064 extOUWithJumpsProcess'_ :: ((C2HSImp.Ptr (CExtendedOrnsteinUhlenbeckProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CExtOUWithJumpsProcess')))))))))
1065
1066 foreign import ccall safe "QuantLib/Process.chs.h qlG2ForwardProcess"
1067 g2ForwardProcess'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CG2ForwardProcess'))))))))))
1068
1069 foreign import ccall safe "QuantLib/Process.chs.h qlG2Process"
1070 g2Process'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CG2Process'))))))))))
1071
1072 foreign import ccall safe "QuantLib/Process.chs.h qlG2ProcessPhi"
1073 g2Phi'_ :: ((C2HSImp.Ptr (CG2Process')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))
1074
1075 foreign import ccall safe "QuantLib/Process.chs.h qlG2ProcessShortRate"
1076 g2ShortRate'_ :: ((C2HSImp.Ptr (CG2Process')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (IO C2HSImp.CDouble)))))
1077
1078 foreign import ccall safe "QuantLib/Process.chs.h qlG2ForwardProcessPhi"
1079 g2ForwardPhi'_ :: ((C2HSImp.Ptr (CG2ForwardProcess')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))
1080
1081 foreign import ccall safe "QuantLib/Process.chs.h qlG2ForwardProcessShortRate"
1082 g2ForwardShortRate'_ :: ((C2HSImp.Ptr (CG2ForwardProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (IO C2HSImp.CDouble)))))
1083
1084 foreign import ccall safe "QuantLib/Process.chs.h qlStochasticProcessFactors"
1085 factors'_ :: ((C2HSImp.Ptr (CStochasticProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CUInt)))
1086
1087 foreign import ccall safe "QuantLib/Process.chs.h qlStochasticProcessInitialValues"
1088 initialValues'_ :: ((C2HSImp.Ptr (CStochasticProcess')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))
1089
1090 foreign import ccall safe "QuantLib/Process.chs.h qlStochasticProcessDrift"
1091 drift'_ :: ((C2HSImp.Ptr (CStochasticProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))))
1092
1093 foreign import ccall safe "QuantLib/Process.chs.h qlStochasticProcessDiffusion"
1094 qlStochasticProcessDiffusion'_ :: ((C2HSImp.Ptr (CStochasticProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))))))
1095
1096 foreign import ccall safe "QuantLib/Process.chs.h qlStochasticProcessExpectation"
1097 expectation'_ :: ((C2HSImp.Ptr (CStochasticProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))))))
1098
1099 foreign import ccall safe "QuantLib/Process.chs.h qlGemanRoncoroniProcess"
1100 gemanRoncoroniProcess'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CStochasticProcess1D')))))))))))))))))))))
1101
1102 foreign import ccall safe "QuantLib/Process.chs.h qlGeometricBrownianMotionProcess"
1103 geometricBrownianMotionProcess'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CStochasticProcess1D')))))))
1104
1105 foreign import ccall safe "QuantLib/Process.chs.h qlGJRGARCHProcess"
1106 gjrGARCHProcess'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CGJRGARCHProcess')))))))))))))))
1107
1108 foreign import ccall safe "QuantLib/Process.chs.h qlHestonProcess"
1109 hestonProcess'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CHestonProcess')))))))))))))
1110
1111 foreign import ccall safe "QuantLib/Process.chs.h qlHullWhiteForwardProcess"
1112 hullWhiteForwardProcess'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CHullWhiteForwardProcess')))))))
1113
1114 foreign import ccall safe "QuantLib/Process.chs.h qlHullWhiteForwardProcessSetForwardMeasureTime"
1115 setForwardMeasureTime'_ :: ((C2HSImp.Ptr (CHullWhiteForwardProcess')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))
1116
1117 foreign import ccall safe "QuantLib/Process.chs.h qlHullWhiteProcess"
1118 hullWhiteProcess'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CHullWhiteProcess')))))))
1119
1120 foreign import ccall safe "QuantLib/Process.chs.h qlHybridHestonHullWhiteProcess"
1121 hybridHestonHullWhiteProcess'_ :: ((C2HSImp.Ptr (CHestonProcess')) -> ((C2HSImp.Ptr (CHullWhiteForwardProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CHybridHestonHullWhiteProcess'))))))))
1122
1123 foreign import ccall safe "QuantLib/Process.chs.h qlKlugeExtOUProcess"
1124 klugeExtOUProcess'_ :: (C2HSImp.CDouble -> ((C2HSImp.Ptr (CExtOUWithJumpsProcess')) -> ((C2HSImp.Ptr (CExtendedOrnsteinUhlenbeckProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CKlugeExtOUProcess')))))))
1125
1126 foreign import ccall safe "QuantLib/Process.chs.h qlLiborForwardModelProcess"
1127 liborForwardModelProcess'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CLiborForwardModelProcess'))))))
1128
1129 foreign import ccall safe "QuantLib/Process.chs.h qlLiborForwardModelProcessFixingDates"
1130 liborForwardModelProcessFixingDates'_ :: ((C2HSImp.Ptr (CLiborForwardModelProcess')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CInt)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))
1131
1132 foreign import ccall safe "QuantLib/Process.chs.h qlLiborForwardModelProcessFixingTimes"
1133 liborForwardModelProcessFixingTimes'_ :: ((C2HSImp.Ptr (CLiborForwardModelProcess')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))
1134
1135 foreign import ccall safe "QuantLib/Process.chs.h qlLiborForwardModelProcessCashFlows"
1136 liborForwardModelProcessCashFlows'_ :: ((C2HSImp.Ptr (CLiborForwardModelProcess')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CLeg'))))))
1137
1138 foreign import ccall safe "QuantLib/Process.chs.h qlLiborForwardModelProcessIndex"
1139 liborForwardModelProcessIndex'_ :: ((C2HSImp.Ptr (CLiborForwardModelProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CIborIndex')))))
1140
1141 foreign import ccall safe "QuantLib/Process.chs.h qlMerton76Process"
1142 merton76Process'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CMerton76Process'))))))))))))
1143
1144 foreign import ccall safe "QuantLib/Process.chs.h qlOrnsteinUhlenbeckProcess"
1145 ornsteinUhlenbeckProcess'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CStochasticProcess1D'))))))))
1146
1147 foreign import ccall safe "QuantLib/Process.chs.h qlVarianceGammaProcess"
1148 varianceGammaProcess'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CVarianceGammaProcess'))))))))))
1149
1150 foreign import ccall safe "QuantLib/Process.chs.h qlStochasticProcessArray"
1151 qlStochasticProcessArray'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CStochasticProcess1D'))) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CStochasticProcessArray')))))))))
1152
1153 foreign import ccall safe "QuantLib/Process.chs.h qlQuantLibBlackScholesTheta"
1154 blackScholesTheta'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))))