/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; namespace QuantConnect.Data.Market { /// /// Defines the greeks /// internal class ModeledGreeks : Greeks { private Lazy _delta; private Lazy _gamma; private Lazy _vega; private Lazy _theta; private Lazy _rho; private Lazy _lambda; /// /// Gets the delta /// public override decimal Delta => _delta.Value; /// /// Gets the gamma /// public override decimal Gamma => _gamma.Value; /// /// Gets the vega /// public override decimal Vega => _vega.Value; /// /// Gets the theta /// public override decimal Theta => _theta.Value; /// /// Gets the rho /// public override decimal Rho => _rho.Value; /// /// Gets the lambda /// public override decimal Lambda => _lambda.Value; /// /// Initializes a new instance of the class /// public ModeledGreeks(Func delta, Func gamma, Func vega, Func theta, Func rho, Func lambda) { _delta = new Lazy(delta, isThreadSafe: false); _gamma = new Lazy(gamma, isThreadSafe: false); _vega = new Lazy(vega, isThreadSafe: false); _theta = new Lazy(theta, isThreadSafe: false); _rho = new Lazy(rho, isThreadSafe: false); _lambda = new Lazy(lambda, isThreadSafe: false); } } }