private async Task <SectorCode> GetFilledSectorCode(SectorCode parsedSectorCode) { return(await _ctx.SectorCodes.FirstOrDefaultAsync(sc => !sc.IsDeleted && (string.IsNullOrWhiteSpace(parsedSectorCode.Code) || sc.Code == parsedSectorCode.Code) && (string.IsNullOrWhiteSpace(parsedSectorCode.Name) || sc.Name == parsedSectorCode.Name)) ?? throw new Exception($"Sector code by `{parsedSectorCode.Code}` code or `{parsedSectorCode.Name}` name not found")); }
public static SectorCode ParseSectorCode(string prop, string value, SectorCode prev) { var result = prev ?? new SectorCode(); switch (prop) { case nameof(SectorCode.Code): result.Code = value; break; case nameof(SectorCode.Name): result.Name = value; break; default: throw UnsupportedPropertyOf <SectorCode>(prop); } return(result); }
public override int GetHashCode() { unchecked { int hash = 17; hash = hash * 23 + ISIN.GetHashCode(); hash = hash * 23 + Name.GetHashCode(); hash = hash * 23 + Symbol.GetHashCode(); hash = hash * 23 + Currency?.GetHashCode() ?? 0; hash = hash * 23 + Segment.GetHashCode(); hash = hash * 23 + Sector?.GetHashCode() ?? 0; hash = hash * 23 + SectorCode?.GetHashCode() ?? 0; hash = hash * 23 + FactSheetUrl?.GetHashCode() ?? 0; hash = hash * 23 + NasdaqInstrumentId.GetHashCode(); return(hash); } }
public SectorAllocation(SectorCode code, double weight) { Code = code; Weight = weight; }