Files
quantconnect--lean/Common/Securities/SecurityPriceVariationModel.cs
AlexCatarino 82d81108ad Implements price variation models
Implements IPriceVariationModel interface which takes the security object and returns a decimal variation
Implemets SecurityVariationModel class: default implementation of IPriceVariationModel that returns a fixed value (read from symbol-properties-database) for decimal variation
Implemets EquityVariationModel class: implementaion of IPriceVariationModel that returns a decimal variation as a function of equity price
Implemets AdjustedPriceVariationModel class: implementaion of IPriceVariationModel that returns zero
Adds unit test
2016-09-20 15:36:04 -03:00

35 lines
1.4 KiB
C#

/*
* 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.
*
*/
namespace QuantConnect.Securities
{
/// <summary>
/// Provides default implementation of <see cref="IPriceVariationModel"/>
/// for use in defining the minimum price variation.
/// </summary>
public class SecurityPriceVariationModel : IPriceVariationModel
{
/// <summary>
/// Get the minimum price variation from a security
/// </summary>
/// <param name="security">Security which we want the minimum price variation from</param>
/// <returns>Decimal minimum price variation of a given security</returns>
public virtual decimal GetMinimumPriceVariation(Security security)
{
return security.SymbolProperties.MinimumPriceVariation;
}
}
}