/// <summary> /// Construct the Equity Object /// </summary> public Equity(Symbol symbol, SecurityExchangeHours exchangeHours, Cash quoteCurrency, SymbolProperties symbolProperties, ICurrencyConverter currencyConverter, IRegisteredSecurityDataTypesProvider registeredTypes, SecurityCache securityCache, PrimaryExchange primaryExchange = PrimaryExchange.UNKNOWN) : base(symbol, quoteCurrency, symbolProperties, new EquityExchange(exchangeHours), securityCache, new SecurityPortfolioModel(), new EquityFillModel(), new InteractiveBrokersFeeModel(), new ConstantSlippageModel(0m), new ImmediateSettlementModel(), Securities.VolatilityModel.Null, new SecurityMarginModel(2m), new EquityDataFilter(), new AdjustedPriceVariationModel(), currencyConverter, registeredTypes ) { Holdings = new EquityHolding(this, currencyConverter); PrimaryExchange = primaryExchange; }
/// <summary> /// Serves as a hash function for a particular type. /// </summary> /// <returns> /// A hash code for the current <see cref="T:System.Object"/>. /// </returns> /// <filterpriority>2</filterpriority> public override int GetHashCode() { unchecked { return((Date.GetHashCode() * 397) ^ (MappedSymbol != null ? MappedSymbol.GetHashCode() : 0) ^ (DataMappingMode != null ? DataMappingMode.GetHashCode() : 0) ^ (PrimaryExchange.GetHashCode())); } }
public void ParsesRowWithExchangesCorrectly(string mapFileRow, PrimaryExchange expectedPrimaryExchange) { // Arrange var rowParts = mapFileRow.Split(','); var expectedMapFileRow = new MapFileRow( DateTime.ParseExact(rowParts[0], DateFormat.EightCharacter, CultureInfo.InvariantCulture), rowParts[1], Convert.ToChar(rowParts[2], CultureInfo.InvariantCulture)); // Act var actualMapFileRow = MapFileRow.Parse(mapFileRow); // Assert Assert.AreEqual(expectedPrimaryExchange, actualMapFileRow.PrimaryExchange); Assert.AreEqual(expectedMapFileRow, actualMapFileRow); }
/// <summary> /// Initializes a new instance of the <see cref="MapFileRow"/> class. /// </summary> public MapFileRow(DateTime date, string mappedSymbol, PrimaryExchange primaryExchange) { Date = date; MappedSymbol = mappedSymbol.LazyToUpper(); PrimaryExchange = primaryExchange; }