2013-04-02

Functions in ThetaML

Many users asked for the introduction of function call into ThetaML. Since today, we provide a test release of Theta Suite version 2.4 together with the new function syntax. Besides the usual function concept, ThetaML functions also support function handles and partial evaluation with model time sensitive default values for some parameters. You will be surprised how much this can simplify your coding.

Now, you can implement e.g. a function with the following interface


interface iPayoff
  import spot
  export value
end


and include an additional parameter (strike) in the function definition

function callPayoff implements iPayoff
  import spot
  import strike
  export value

  value = max(0, spot - strike)
end

and use the function as of it would be implementing iPayoff with "_" as spot and "100" as strike.

:

type f : function iPayoff
f = callPayoff( _ , 100)
:

Now, evaluate the function at sport = 100:
:
myPayoff = f(123)
:



Drop us a line to support(at)thetaris.com from testing the new release.

No comments:

Post a Comment