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.Index
    6   (
    7     Index
    8   , GenIndex
    9 
   10   , addFixing
   11   , fixingCalendar
   12   , fixing
   13   , hasHistoricalFixing
   14   , isValidFixingDate
   15   , addFixings
   16   , clearFixings
   17   , asIndex
   18 
   19   , HistoricalIndexAnalysis
   20   , historicalIndexAnalysis
   21   , historicalIndexAnalysisSkippedDates
   22   , historicalIndexAnalysisSkippedDatesErrorMessage
   23   , historicalIndexAnalysisMean
   24   , historicalIndexAnalysisStandardDeviation
   25   , historicalIndexAnalysisSkewness
   26   , historicalIndexAnalysisKurtosis
   27   , historicalIndexAnalysisMin
   28   , historicalIndexAnalysisMax
   29   , historicalIndexAnalysisSemiVariance
   30   , historicalIndexAnalysisSemiDeviation
   31   , historicalIndexAnalysisDownsideVariance
   32   , historicalIndexAnalysisDownsideDeviation
   33   , historicalIndexAnalysisPercentile
   34   , historicalIndexAnalysisGaussianPercentile
   35   , historicalIndexAnalysisValueAtRisk
   36   , historicalIndexAnalysisGaussianValueAtRisk
   37   , historicalIndexAnalysisExpectedShortfall
   38   , historicalIndexAnalysisGaussianExpectedShortfall
   39   , historicalIndexAnalysisCovariance
   40   , historicalIndexAnalysisCorrelation
   41   ) where
   42 import qualified Foreign.C.Types as C2HSImp
   43 import qualified Foreign.ForeignPtr as C2HSImp
   44 import qualified Foreign.Marshal.Utils as C2HSImp
   45 import qualified Foreign.Ptr as C2HSImp
   46 
   47 
   48 import QuantLib.Internal
   49 import QuantLib.Internal.Common
   50 import QuantLib.Internal.Type
   51 
   52 
   53 
   54 
   55 
   56 
   57 
   58 
   59 
   60 
   61 
   62 
   63 -- |stores the historical fixing at the given date; the date must be the actual calendar date of the fixing, not a settlement date
   64 addFixing :: (GenIndex idx) -> (Day) -> (Double) -- ^fixing
   65  -> (Bool) -- ^forceOverwrite
   66  -> IO ()
   67 addFixing a1 a2 a3 a4 =
   68   withIndex a1 $ \a1' -> 
   69   withDay a2 $ \a2' -> 
   70   let {a3' = realToFrac a3} in 
   71   let {a4' = C2HSImp.fromBool a4} in 
   72   preErrorCheck $ \a5' -> 
   73   addFixing'_ a1' a2' a3' a4' a5' >>
   74   errorCheck  a5'>>
   75   return ()
   76 
   77 
   78 
   79 -- |returns the calendar defining valid fixing dates
   80 fixingCalendar :: (GenIndex idx) -> IO ((Calendar))
   81 fixingCalendar a1 =
   82   withIndex a1 $ \a1' -> 
   83   preErrorCheck $ \a2' -> 
   84   fixingCalendar'_ a1' a2' >>= \res ->
   85   peekCalendar res >>= \res' ->
   86   errorCheck  a2'>>
   87   return (res')
   88 
   89 
   90 
   91 -- |returns the fixing at the given date, forecasting it if not available and /forecastTodaysFixing/ is true
   92 fixing :: (GenIndex idx) -> (Day) -> (Bool) -- ^forecastTodaysFixing
   93  -> IO ((Double))
   94 fixing a1 a2 a3 =
   95   withIndex a1 $ \a1' -> 
   96   withDay a2 $ \a2' -> 
   97   let {a3' = C2HSImp.fromBool a3} in 
   98   preErrorCheck $ \a4' -> 
   99   fixing'_ a1' a2' a3' a4' >>= \res ->
  100   let {res' = realToFrac res} in
  101   errorCheck  a4'>>
  102   return (res')
  103 
  104 
  105 
  106 -- |whether a historical fixing has been stored for the given date
  107 hasHistoricalFixing :: (GenIndex idx) -> (Day) -> IO ((Bool))
  108 hasHistoricalFixing a1 a2 =
  109   withIndex a1 $ \a1' -> 
  110   withDay a2 $ \a2' -> 
  111   preErrorCheck $ \a3' -> 
  112   hasHistoricalFixing'_ a1' a2' a3' >>= \res ->
  113   let {res' = C2HSImp.toBool res} in
  114   errorCheck  a3'>>
  115   return (res')
  116 
  117 
  118 
  119 -- |whether the given date is a valid fixing date for this index
  120 isValidFixingDate :: (GenIndex idx) -> (Day) -> IO ((Bool))
  121 isValidFixingDate a1 a2 =
  122   withIndex a1 $ \a1' -> 
  123   withDay a2 $ \a2' -> 
  124   preErrorCheck $ \a3' -> 
  125   isValidFixingDate'_ a1' a2' a3' >>= \res ->
  126   let {res' = C2HSImp.toBool res} in
  127   errorCheck  a3'>>
  128   return (res')
  129 
  130 
  131 
  132 -- |stores historical fixings at the given dates; the date and value lists must have equal length
  133 addFixings :: (GenIndex idx) -> ([Day]) -> ([Double]) -> (Bool) -- ^forceOverwrite
  134  -> IO ()
  135 addFixings a1 a2 a3 a4 =
  136   withIndex a1 $ \a1' -> 
  137   withDayArray a2 $ \(a2'1, a2'2) -> 
  138   withDoubleArrayRaw a3 $ \a3' -> 
  139   let {a4' = C2HSImp.fromBool a4} in 
  140   preErrorCheck $ \a5' -> 
  141   addFixings'_ a1' a2'1  a2'2 a3' a4' a5' >>
  142   errorCheck  a5'>>
  143   return ()
  144 
  145 
  146 
  147 -- |clears all stored historical fixings for this index
  148 clearFixings :: (GenIndex idx) -> IO ()
  149 clearFixings a1 =
  150   withIndex a1 $ \a1' -> 
  151   preErrorCheck $ \a2' -> 
  152   clearFixings'_ a1' a2' >>
  153   errorCheck  a2'>>
  154   return ()
  155 
  156 
  157 
  158 
  159 
  160 
  161 -- |Computes 'SequenceStatistics' (mean\/standard deviation\/skewness\/kurtosis\/min\/max\/semi-
  162 -- and downside-variance and -deviation\/percentiles\/value-at-risk\/expected shortfall,
  163 -- empirical and gaussian-assumption\/covariance\/correlation) over historical fixings of the
  164 -- given indexes, sampled every @step@ between @startDate@ and @endDate@. A date/index pair whose
  165 -- fixing is unavailable is recorded in 'historicalIndexAnalysisSkippedDates'\/
  166 -- 'historicalIndexAnalysisSkippedDatesErrorMessage' rather than failing the whole analysis.
  167 -- 'SequenceStatistics' itself isn't given a dedicated Haskell type: it's only ever the
  168 -- accumulator this constructor fills internally, with no other use in hasquant, so its full
  169 -- risk-statistics surface is exposed directly as accessors here (see CLAUDE.md's \"don't mirror
  170 -- the C++ hierarchy 1:1\").
  171 historicalIndexAnalysis :: (Day) -- ^startDate
  172  -> (Day) -- ^endDate
  173  -> ((Int,TimeUnit)) -- ^step
  174  -> ([Index]) -> IO ((HistoricalIndexAnalysis))
  175 historicalIndexAnalysis a1 a2 a3 a4 =
  176   withDay a1 $ \a1' -> 
  177   withDay a2 $ \a2' -> 
  178   let {(a3'1, a3'2) = fromEnumQuantity a3} in 
  179   withIndexArray a4 $ \(a4'1, a4'2) -> 
  180   preErrorCheck $ \a5' -> 
  181   historicalIndexAnalysis'_ a1' a2' a3'1  a3'2 a4'1  a4'2 a5' >>= \res ->
  182   peekHistoricalIndexAnalysis res >>= \res' ->
  183   errorCheck  a5'>>
  184   return (res')
  185 
  186 
  187 
  188 -- |Fixing dates skipped because no historical fixing was available for at least one index.
  189 historicalIndexAnalysisSkippedDates :: (HistoricalIndexAnalysis) -> IO (([Day]))
  190 historicalIndexAnalysisSkippedDates a1 =
  191   withHistoricalIndexAnalysis a1 $ \a1' -> 
  192   preArray $ \(a2'1, a2'2) -> 
  193   historicalIndexAnalysisSkippedDates'_ a1' a2'1  a2'2 >>
  194   peekDayArray  a2'1  a2'2>>= \a2'' -> 
  195   return (a2'')
  196 
  197 
  198 
  199 -- |The error message recorded for each date in 'historicalIndexAnalysisSkippedDates', in the same order.
  200 historicalIndexAnalysisSkippedDatesErrorMessage :: (HistoricalIndexAnalysis) -> IO (([String]))
  201 historicalIndexAnalysisSkippedDatesErrorMessage a1 =
  202   withHistoricalIndexAnalysis a1 $ \a1' -> 
  203   preArray $ \(a2'1, a2'2) -> 
  204   historicalIndexAnalysisSkippedDatesErrorMessage'_ a1' a2'1  a2'2 >>
  205   peekCStringArray  a2'1  a2'2>>= \a2'' -> 
  206   return (a2'')
  207 
  208 
  209 
  210 -- |Per-index mean of the historical relative returns actually sampled.
  211 historicalIndexAnalysisMean :: (HistoricalIndexAnalysis) -> IO (([Double]))
  212 historicalIndexAnalysisMean a1 =
  213   withHistoricalIndexAnalysis a1 $ \a1' -> 
  214   preArray $ \(a2'1, a2'2) -> 
  215   preErrorCheck $ \a3' -> 
  216   historicalIndexAnalysisMean'_ a1' a2'1  a2'2 a3' >>
  217   peekDoubleArray  a2'1  a2'2>>= \a2'' -> 
  218   errorCheck  a3'>>
  219   return (a2'')
  220 
  221 
  222 
  223 -- |Per-index standard deviation of the historical relative returns actually sampled.
  224 historicalIndexAnalysisStandardDeviation :: (HistoricalIndexAnalysis) -> IO (([Double]))
  225 historicalIndexAnalysisStandardDeviation a1 =
  226   withHistoricalIndexAnalysis a1 $ \a1' -> 
  227   preArray $ \(a2'1, a2'2) -> 
  228   preErrorCheck $ \a3' -> 
  229   historicalIndexAnalysisStandardDeviation'_ a1' a2'1  a2'2 a3' >>
  230   peekDoubleArray  a2'1  a2'2>>= \a2'' -> 
  231   errorCheck  a3'>>
  232   return (a2'')
  233 
  234 
  235 
  236 -- |Per-index skewness of the historical relative returns actually sampled.
  237 historicalIndexAnalysisSkewness :: (HistoricalIndexAnalysis) -> IO (([Double]))
  238 historicalIndexAnalysisSkewness a1 =
  239   withHistoricalIndexAnalysis a1 $ \a1' -> 
  240   preArray $ \(a2'1, a2'2) -> 
  241   preErrorCheck $ \a3' -> 
  242   historicalIndexAnalysisSkewness'_ a1' a2'1  a2'2 a3' >>
  243   peekDoubleArray  a2'1  a2'2>>= \a2'' -> 
  244   errorCheck  a3'>>
  245   return (a2'')
  246 
  247 
  248 
  249 -- |Per-index (excess) kurtosis of the historical relative returns actually sampled.
  250 historicalIndexAnalysisKurtosis :: (HistoricalIndexAnalysis) -> IO (([Double]))
  251 historicalIndexAnalysisKurtosis a1 =
  252   withHistoricalIndexAnalysis a1 $ \a1' -> 
  253   preArray $ \(a2'1, a2'2) -> 
  254   preErrorCheck $ \a3' -> 
  255   historicalIndexAnalysisKurtosis'_ a1' a2'1  a2'2 a3' >>
  256   peekDoubleArray  a2'1  a2'2>>= \a2'' -> 
  257   errorCheck  a3'>>
  258   return (a2'')
  259 
  260 
  261 
  262 -- |Per-index minimum of the historical relative returns actually sampled.
  263 historicalIndexAnalysisMin :: (HistoricalIndexAnalysis) -> IO (([Double]))
  264 historicalIndexAnalysisMin a1 =
  265   withHistoricalIndexAnalysis a1 $ \a1' -> 
  266   preArray $ \(a2'1, a2'2) -> 
  267   preErrorCheck $ \a3' -> 
  268   historicalIndexAnalysisMin'_ a1' a2'1  a2'2 a3' >>
  269   peekDoubleArray  a2'1  a2'2>>= \a2'' -> 
  270   errorCheck  a3'>>
  271   return (a2'')
  272 
  273 
  274 
  275 -- |Per-index maximum of the historical relative returns actually sampled.
  276 historicalIndexAnalysisMax :: (HistoricalIndexAnalysis) -> IO (([Double]))
  277 historicalIndexAnalysisMax a1 =
  278   withHistoricalIndexAnalysis a1 $ \a1' -> 
  279   preArray $ \(a2'1, a2'2) -> 
  280   preErrorCheck $ \a3' -> 
  281   historicalIndexAnalysisMax'_ a1' a2'1  a2'2 a3' >>
  282   peekDoubleArray  a2'1  a2'2>>= \a2'' -> 
  283   errorCheck  a3'>>
  284   return (a2'')
  285 
  286 
  287 
  288 -- |Per-index variance of the historical relative returns falling below the mean.
  289 historicalIndexAnalysisSemiVariance :: (HistoricalIndexAnalysis) -> IO (([Double]))
  290 historicalIndexAnalysisSemiVariance a1 =
  291   withHistoricalIndexAnalysis a1 $ \a1' -> 
  292   preArray $ \(a2'1, a2'2) -> 
  293   preErrorCheck $ \a3' -> 
  294   historicalIndexAnalysisSemiVariance'_ a1' a2'1  a2'2 a3' >>
  295   peekDoubleArray  a2'1  a2'2>>= \a2'' -> 
  296   errorCheck  a3'>>
  297   return (a2'')
  298 
  299 
  300 
  301 -- |Per-index square root of 'historicalIndexAnalysisSemiVariance'.
  302 historicalIndexAnalysisSemiDeviation :: (HistoricalIndexAnalysis) -> IO (([Double]))
  303 historicalIndexAnalysisSemiDeviation a1 =
  304   withHistoricalIndexAnalysis a1 $ \a1' -> 
  305   preArray $ \(a2'1, a2'2) -> 
  306   preErrorCheck $ \a3' -> 
  307   historicalIndexAnalysisSemiDeviation'_ a1' a2'1  a2'2 a3' >>
  308   peekDoubleArray  a2'1  a2'2>>= \a2'' -> 
  309   errorCheck  a3'>>
  310   return (a2'')
  311 
  312 
  313 
  314 -- |Per-index variance of the historical relative returns falling below zero.
  315 historicalIndexAnalysisDownsideVariance :: (HistoricalIndexAnalysis) -> IO (([Double]))
  316 historicalIndexAnalysisDownsideVariance a1 =
  317   withHistoricalIndexAnalysis a1 $ \a1' -> 
  318   preArray $ \(a2'1, a2'2) -> 
  319   preErrorCheck $ \a3' -> 
  320   historicalIndexAnalysisDownsideVariance'_ a1' a2'1  a2'2 a3' >>
  321   peekDoubleArray  a2'1  a2'2>>= \a2'' -> 
  322   errorCheck  a3'>>
  323   return (a2'')
  324 
  325 
  326 
  327 -- |Per-index square root of 'historicalIndexAnalysisDownsideVariance'.
  328 historicalIndexAnalysisDownsideDeviation :: (HistoricalIndexAnalysis) -> IO (([Double]))
  329 historicalIndexAnalysisDownsideDeviation a1 =
  330   withHistoricalIndexAnalysis a1 $ \a1' -> 
  331   preArray $ \(a2'1, a2'2) -> 
  332   preErrorCheck $ \a3' -> 
  333   historicalIndexAnalysisDownsideDeviation'_ a1' a2'1  a2'2 a3' >>
  334   peekDoubleArray  a2'1  a2'2>>= \a2'' -> 
  335   errorCheck  a3'>>
  336   return (a2'')
  337 
  338 
  339 
  340 -- |Per-index empirical @y@-th percentile of the historical relative returns actually sampled;
  341 -- @y@ must lie in @[0.9, 1.0)@.
  342 historicalIndexAnalysisPercentile :: (HistoricalIndexAnalysis) -> (Double) -- ^y
  343  -> IO (([Double]))
  344 historicalIndexAnalysisPercentile a1 a2 =
  345   withHistoricalIndexAnalysis a1 $ \a1' -> 
  346   let {a2' = realToFrac a2} in 
  347   preArray $ \(a3'1, a3'2) -> 
  348   preErrorCheck $ \a4' -> 
  349   historicalIndexAnalysisPercentile'_ a1' a2' a3'1  a3'2 a4' >>
  350   peekDoubleArray  a3'1  a3'2>>= \a3'' -> 
  351   errorCheck  a4'>>
  352   return (a3'')
  353 
  354 
  355 
  356 -- |Per-index @y@-th percentile assuming the historical relative returns are gaussian; @y@ must lie in @[0.9, 1.0)@.
  357 historicalIndexAnalysisGaussianPercentile :: (HistoricalIndexAnalysis) -> (Double) -- ^y
  358  -> IO (([Double]))
  359 historicalIndexAnalysisGaussianPercentile a1 a2 =
  360   withHistoricalIndexAnalysis a1 $ \a1' -> 
  361   let {a2' = realToFrac a2} in 
  362   preArray $ \(a3'1, a3'2) -> 
  363   preErrorCheck $ \a4' -> 
  364   historicalIndexAnalysisGaussianPercentile'_ a1' a2' a3'1  a3'2 a4' >>
  365   peekDoubleArray  a3'1  a3'2>>= \a3'' -> 
  366   errorCheck  a4'>>
  367   return (a3'')
  368 
  369 
  370 
  371 -- |Per-index empirical value-at-risk at the given @centile@, which must lie in @[0.9, 1.0)@.
  372 historicalIndexAnalysisValueAtRisk :: (HistoricalIndexAnalysis) -> (Double) -- ^centile
  373  -> IO (([Double]))
  374 historicalIndexAnalysisValueAtRisk a1 a2 =
  375   withHistoricalIndexAnalysis a1 $ \a1' -> 
  376   let {a2' = realToFrac a2} in 
  377   preArray $ \(a3'1, a3'2) -> 
  378   preErrorCheck $ \a4' -> 
  379   historicalIndexAnalysisValueAtRisk'_ a1' a2' a3'1  a3'2 a4' >>
  380   peekDoubleArray  a3'1  a3'2>>= \a3'' -> 
  381   errorCheck  a4'>>
  382   return (a3'')
  383 
  384 
  385 
  386 -- |Per-index value-at-risk at the given @centile@ assuming the historical relative returns are gaussian; @centile@ must lie in @[0.9, 1.0)@.
  387 historicalIndexAnalysisGaussianValueAtRisk :: (HistoricalIndexAnalysis) -> (Double) -- ^centile
  388  -> IO (([Double]))
  389 historicalIndexAnalysisGaussianValueAtRisk a1 a2 =
  390   withHistoricalIndexAnalysis a1 $ \a1' -> 
  391   let {a2' = realToFrac a2} in 
  392   preArray $ \(a3'1, a3'2) -> 
  393   preErrorCheck $ \a4' -> 
  394   historicalIndexAnalysisGaussianValueAtRisk'_ a1' a2' a3'1  a3'2 a4' >>
  395   peekDoubleArray  a3'1  a3'2>>= \a3'' -> 
  396   errorCheck  a4'>>
  397   return (a3'')
  398 
  399 
  400 
  401 -- |Per-index empirical expected shortfall at the given @centile@, which must lie in @[0.9, 1.0)@.
  402 -- Throws if no sampled return falls below the value-at-risk threshold.
  403 historicalIndexAnalysisExpectedShortfall :: (HistoricalIndexAnalysis) -> (Double) -- ^centile
  404  -> IO (([Double]))
  405 historicalIndexAnalysisExpectedShortfall a1 a2 =
  406   withHistoricalIndexAnalysis a1 $ \a1' -> 
  407   let {a2' = realToFrac a2} in 
  408   preArray $ \(a3'1, a3'2) -> 
  409   preErrorCheck $ \a4' -> 
  410   historicalIndexAnalysisExpectedShortfall'_ a1' a2' a3'1  a3'2 a4' >>
  411   peekDoubleArray  a3'1  a3'2>>= \a3'' -> 
  412   errorCheck  a4'>>
  413   return (a3'')
  414 
  415 
  416 
  417 -- |Per-index expected shortfall at the given @centile@ assuming the historical relative returns
  418 -- are gaussian; @centile@ must lie in @[0.9, 1.0)@.
  419 historicalIndexAnalysisGaussianExpectedShortfall :: (HistoricalIndexAnalysis) -> (Double) -- ^centile
  420  -> IO (([Double]))
  421 historicalIndexAnalysisGaussianExpectedShortfall a1 a2 =
  422   withHistoricalIndexAnalysis a1 $ \a1' -> 
  423   let {a2' = realToFrac a2} in 
  424   preArray $ \(a3'1, a3'2) -> 
  425   preErrorCheck $ \a4' -> 
  426   historicalIndexAnalysisGaussianExpectedShortfall'_ a1' a2' a3'1  a3'2 a4' >>
  427   peekDoubleArray  a3'1  a3'2>>= \a3'' -> 
  428   errorCheck  a4'>>
  429   return (a3'')
  430 
  431 
  432 
  433 toMatrixDouble :: (Word, Word, [Double]) -> Matrix Double
  434 toMatrixDouble (r, c, d) = Matrix r c d
  435 
  436 -- |Covariance matrix of the historical relative returns across indexes.
  437 historicalIndexAnalysisCovariance :: HistoricalIndexAnalysis -> IO (Matrix Double)
  438 historicalIndexAnalysisCovariance hra = toMatrixDouble <$> qlHistoricalIndexAnalysisCovariance hra
  439 qlHistoricalIndexAnalysisCovariance :: (HistoricalIndexAnalysis) -> IO ((Word), (Word), ([Double]))
  440 qlHistoricalIndexAnalysisCovariance a1 =
  441   withHistoricalIndexAnalysis a1 $ \a1' -> 
  442   prePtr $ \a2' -> 
  443   prePtr $ \a3' -> 
  444   preArray $ \(a4'1, a4'2) -> 
  445   preErrorCheck $ \a5' -> 
  446   qlHistoricalIndexAnalysisCovariance'_ a1' a2' a3' a4'1  a4'2 a5' >>
  447   peekWord  a2'>>= \a2'' -> 
  448   peekWord  a3'>>= \a3'' -> 
  449   peekDoubleArray  a4'1  a4'2>>= \a4'' -> 
  450   errorCheck  a5'>>
  451   return (a2'', a3'', a4'')
  452 
  453 
  454 
  455 -- |Correlation matrix of the historical relative returns across indexes.
  456 historicalIndexAnalysisCorrelation :: HistoricalIndexAnalysis -> IO (Matrix Double)
  457 historicalIndexAnalysisCorrelation hra = toMatrixDouble <$> qlHistoricalIndexAnalysisCorrelation hra
  458 qlHistoricalIndexAnalysisCorrelation :: (HistoricalIndexAnalysis) -> IO ((Word), (Word), ([Double]))
  459 qlHistoricalIndexAnalysisCorrelation a1 =
  460   withHistoricalIndexAnalysis a1 $ \a1' -> 
  461   prePtr $ \a2' -> 
  462   prePtr $ \a3' -> 
  463   preArray $ \(a4'1, a4'2) -> 
  464   preErrorCheck $ \a5' -> 
  465   qlHistoricalIndexAnalysisCorrelation'_ a1' a2' a3' a4'1  a4'2 a5' >>
  466   peekWord  a2'>>= \a2'' -> 
  467   peekWord  a3'>>= \a3'' -> 
  468   peekDoubleArray  a4'1  a4'2>>= \a4'' -> 
  469   errorCheck  a5'>>
  470   return (a2'', a3'', a4'')
  471 
  472 
  473 
  474 -- vim: set ff=unix ts=8 sts=2 sw=2 et:
  475 
  476 foreign import ccall safe "QuantLib/Index.chs.h qlIndexAddFixing"
  477   addFixing'_ :: ((C2HSImp.Ptr (CIndex')) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))
  478 
  479 foreign import ccall safe "QuantLib/Index.chs.h qlIndexFixingCalendar"
  480   fixingCalendar'_ :: ((C2HSImp.Ptr (CIndex')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CCalendar)))))
  481 
  482 foreign import ccall safe "QuantLib/Index.chs.h qlIndexFixing"
  483   fixing'_ :: ((C2HSImp.Ptr (CIndex')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))
  484 
  485 foreign import ccall safe "QuantLib/Index.chs.h qlIndexHasHistoricalFixing"
  486   hasHistoricalFixing'_ :: ((C2HSImp.Ptr (CIndex')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CInt))))
  487 
  488 foreign import ccall safe "QuantLib/Index.chs.h qlIndexIsValidFixingDate"
  489   isValidFixingDate'_ :: ((C2HSImp.Ptr (CIndex')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CInt))))
  490 
  491 foreign import ccall safe "QuantLib/Index.chs.h qlIndexAddFixings"
  492   addFixings'_ :: ((C2HSImp.Ptr (CIndex')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))))
  493 
  494 foreign import ccall safe "QuantLib/Index.chs.h qlIndexClearFixings"
  495   clearFixings'_ :: ((C2HSImp.Ptr (CIndex')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))
  496 
  497 foreign import ccall safe "QuantLib/Index.chs.h qlHistoricalIndexAnalysis"
  498   historicalIndexAnalysis'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CIndex'))) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CHistoricalIndexAnalysis))))))))))
  499 
  500 foreign import ccall safe "QuantLib/Index.chs.h qlHistoricalIndexAnalysisSkippedDates"
  501   historicalIndexAnalysisSkippedDates'_ :: ((C2HSImp.Ptr (CHistoricalIndexAnalysis)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CInt)) -> (IO ()))))
  502 
  503 foreign import ccall safe "QuantLib/Index.chs.h qlHistoricalIndexAnalysisSkippedDatesErrorMessage"
  504   historicalIndexAnalysisSkippedDatesErrorMessage'_ :: ((C2HSImp.Ptr (CHistoricalIndexAnalysis)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar))) -> (IO ()))))
  505 
  506 foreign import ccall safe "QuantLib/Index.chs.h qlHistoricalIndexAnalysisMean"
  507   historicalIndexAnalysisMean'_ :: ((C2HSImp.Ptr (CHistoricalIndexAnalysis)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))
  508 
  509 foreign import ccall safe "QuantLib/Index.chs.h qlHistoricalIndexAnalysisStandardDeviation"
  510   historicalIndexAnalysisStandardDeviation'_ :: ((C2HSImp.Ptr (CHistoricalIndexAnalysis)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))
  511 
  512 foreign import ccall safe "QuantLib/Index.chs.h qlHistoricalIndexAnalysisSkewness"
  513   historicalIndexAnalysisSkewness'_ :: ((C2HSImp.Ptr (CHistoricalIndexAnalysis)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))
  514 
  515 foreign import ccall safe "QuantLib/Index.chs.h qlHistoricalIndexAnalysisKurtosis"
  516   historicalIndexAnalysisKurtosis'_ :: ((C2HSImp.Ptr (CHistoricalIndexAnalysis)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))
  517 
  518 foreign import ccall safe "QuantLib/Index.chs.h qlHistoricalIndexAnalysisMin"
  519   historicalIndexAnalysisMin'_ :: ((C2HSImp.Ptr (CHistoricalIndexAnalysis)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))
  520 
  521 foreign import ccall safe "QuantLib/Index.chs.h qlHistoricalIndexAnalysisMax"
  522   historicalIndexAnalysisMax'_ :: ((C2HSImp.Ptr (CHistoricalIndexAnalysis)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))
  523 
  524 foreign import ccall safe "QuantLib/Index.chs.h qlHistoricalIndexAnalysisSemiVariance"
  525   historicalIndexAnalysisSemiVariance'_ :: ((C2HSImp.Ptr (CHistoricalIndexAnalysis)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))
  526 
  527 foreign import ccall safe "QuantLib/Index.chs.h qlHistoricalIndexAnalysisSemiDeviation"
  528   historicalIndexAnalysisSemiDeviation'_ :: ((C2HSImp.Ptr (CHistoricalIndexAnalysis)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))
  529 
  530 foreign import ccall safe "QuantLib/Index.chs.h qlHistoricalIndexAnalysisDownsideVariance"
  531   historicalIndexAnalysisDownsideVariance'_ :: ((C2HSImp.Ptr (CHistoricalIndexAnalysis)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))
  532 
  533 foreign import ccall safe "QuantLib/Index.chs.h qlHistoricalIndexAnalysisDownsideDeviation"
  534   historicalIndexAnalysisDownsideDeviation'_ :: ((C2HSImp.Ptr (CHistoricalIndexAnalysis)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))
  535 
  536 foreign import ccall safe "QuantLib/Index.chs.h qlHistoricalIndexAnalysisPercentile"
  537   historicalIndexAnalysisPercentile'_ :: ((C2HSImp.Ptr (CHistoricalIndexAnalysis)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))
  538 
  539 foreign import ccall safe "QuantLib/Index.chs.h qlHistoricalIndexAnalysisGaussianPercentile"
  540   historicalIndexAnalysisGaussianPercentile'_ :: ((C2HSImp.Ptr (CHistoricalIndexAnalysis)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))
  541 
  542 foreign import ccall safe "QuantLib/Index.chs.h qlHistoricalIndexAnalysisValueAtRisk"
  543   historicalIndexAnalysisValueAtRisk'_ :: ((C2HSImp.Ptr (CHistoricalIndexAnalysis)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))
  544 
  545 foreign import ccall safe "QuantLib/Index.chs.h qlHistoricalIndexAnalysisGaussianValueAtRisk"
  546   historicalIndexAnalysisGaussianValueAtRisk'_ :: ((C2HSImp.Ptr (CHistoricalIndexAnalysis)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))
  547 
  548 foreign import ccall safe "QuantLib/Index.chs.h qlHistoricalIndexAnalysisExpectedShortfall"
  549   historicalIndexAnalysisExpectedShortfall'_ :: ((C2HSImp.Ptr (CHistoricalIndexAnalysis)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))
  550 
  551 foreign import ccall safe "QuantLib/Index.chs.h qlHistoricalIndexAnalysisGaussianExpectedShortfall"
  552   historicalIndexAnalysisGaussianExpectedShortfall'_ :: ((C2HSImp.Ptr (CHistoricalIndexAnalysis)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))
  553 
  554 foreign import ccall safe "QuantLib/Index.chs.h qlHistoricalIndexAnalysisCovariance"
  555   qlHistoricalIndexAnalysisCovariance'_ :: ((C2HSImp.Ptr (CHistoricalIndexAnalysis)) -> ((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 ())))))))
  556 
  557 foreign import ccall safe "QuantLib/Index.chs.h qlHistoricalIndexAnalysisCorrelation"
  558   qlHistoricalIndexAnalysisCorrelation'_ :: ((C2HSImp.Ptr (CHistoricalIndexAnalysis)) -> ((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 ())))))))