greeks.js
function getTheta(s, k, t, v, r, callPut, scale)
{
  scale = scale || 365;
  if(callPut === "call")
  {
    return _callTheta(s, k, t, v, r) / scale;
  }
  else // put
  {
    return _putTheta(s, k, t, v, r) / scale;
  }
}
function getTheta(s, k, t, v, r, callPut, scale)
{
  scale = scale || 365;
  if(callPut === "call")
  {
    return _callTheta(s, k, t, v, r) / scale;
  }
  else // put
  {
    return _putTheta(s, k, t, v, r) / scale;
  }
}
function getTheta ( s , k , t , v , r , callPut , scale ) { scale = scale || 365 ; if ( callPut === "call" ) { return _callTheta ( s , k , t , v , r ) / scale ; } else // put { return _putTheta ( s , k , t , v , r ) / scale ; } }
Calculates the theta of an option.

@param {Number} s Current price of the underlying
@param {Number} k Strike price
@param {Number} t Time to experiation in years
@param {Number} v Volatility as a decimal
@param {Number} r Anual risk-free interest rate as a decimal
@param {String} callPut The type of option - "call" or "put"
@param {String} [scale=365] The number of days to scale theta by - usually 365 or 252
@returns {Number} The theta of the option
Calculates the theta of an option .