/*
* 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;
using QuantConnect.Securities;
namespace QuantConnect.Algorithm.Framework.Alphas.Analysis
{
///
/// Contains security values required by insight analysis components
///
///
/// The main purpose here is providing an ACL against the algorithm to remove the dependencies
///
public class SecurityValues
{
///
/// Gets the symbol these values are for
///
public Symbol Symbol { get; }
///
/// Gets the utc time these values were sampled
///
public DateTime TimeUtc { get; }
///
/// Gets the security price as of
///
public decimal Price { get; }
///
/// Gets the security's volatility as of
///
public decimal Volatility { get; }
///
/// Gets the volume traded in the security during this time step
///
public decimal Volume { get; }
///
/// Gets the conversion rate for the quote currency of the security
///
public decimal QuoteCurrencyConversionRate { get; }
///
/// Gets the exchange hours for the security
///
public SecurityExchangeHours ExchangeHours { get; }
///
/// Initializes a new instance of the class
///
/// The symbol of the security
/// The time these values were sampled
/// The security's exchange hours
/// The security price
/// The security's volatility
/// The volume traded at this time step
/// The conversion rate for the quote currency of the security
public SecurityValues(Symbol symbol, DateTime timeUtc, SecurityExchangeHours exchangeHours, decimal price, decimal volatility, decimal volume, decimal quoteCurrencyConversionRate)
{
Symbol = symbol;
Price = price;
Volume = volume;
TimeUtc = timeUtc;
Volatility = volatility;
ExchangeHours = exchangeHours;
QuoteCurrencyConversionRate = quoteCurrencyConversionRate;
}
///
/// Gets the security value corresponding to the specified insight type
///
/// The insight type
/// The security value for the specified insight type
public decimal Get(InsightType type)
{
switch (type)
{
case InsightType.Price:
return Price;
case InsightType.Volatility:
return Volatility;
default:
throw new ArgumentOutOfRangeException(nameof(type), type, null);
}
}
}
}