示例#1
0
        /// <summary>
        /// Base implementation for a security object
        /// </summary>
        /// <param name="ticker"></param>
        /// <param name="exchangeModel"></param>
        /// <param name="details"></param>
        /// <param name="type"></param>
        /// <param name="conversion"></param>
        protected SecurityBase(TickerSymbol ticker, ExchangeModel exchangeModel, SecurityDetails details, SecurityType type, Currency conversion)
        {
            //Set references
            _currencyConversion = conversion;
            Exchange            = exchangeModel;
            BaseCurrency        = ticker.Currency;
            Details             = details;
            Ticker = ticker;
            Type   = type;

            //Defaults
            LastTickEventUtc  = DateTime.MinValue;
            LastTradeEventUtc = DateTime.MinValue;
        }
示例#2
0
 /// <summary>
 /// Get security based on ticker name
 /// </summary>
 /// <param name="ticker"></param>
 /// <returns></returns>
 public Security this[TickerSymbol ticker] =>
 GetSecurities(x => x.Ticker.Name == ticker.Name).FirstOrDefault();
示例#3
0
 /// <summary>
 /// Create new Equity Security information
 /// </summary>
 /// <param name="ticker"></param>
 /// <param name="exchangeModel"></param>
 /// <param name="details"></param>
 /// <param name="conversion"></param>
 public EquitySecurity(TickerSymbol ticker, ExchangeModel exchangeModel, SecurityDetails details, Currency conversion)
     : base(ticker, exchangeModel, details, SecurityType.Equity, conversion)
 {
 }
示例#4
0
 /// <summary>
 /// Returns the weight of this security set for this universe
 /// </summary>
 /// <param name="ticker"></param>
 /// <returns></returns>
 public decimal GetWeight(TickerSymbol ticker) =>
 _securities.Select(x => x.Key.Ticker).Contains(ticker)
         ? _securities.First(x => x.Key.Ticker.Name == ticker.Name).Value
         : 0m;
示例#5
0
 /// <summary>
 /// Create unknown security type, cannot be used anywhere
 /// </summary>
 /// <param name="ticker"></param>
 public UnknownSecurity(string ticker)
     : base(TickerSymbol.NIL(ticker), null, SecurityDetails.NIL(), SecurityType.NIL, null)
 {
 }