public void AddCrossInstrument(CrossInstrument crossInstrument) { if (CrossInstruments?.Any(o => o.AssetPairId == crossInstrument.AssetPairId) == true) { throw new InvalidOperationException("The cross instrument already exists"); } CrossInstruments = (CrossInstruments ?? new CrossInstrument[0]) .Union(new[] { crossInstrument }) .ToArray(); }
public void UpdateCrossInstrument(CrossInstrument crossInstrument) { CrossInstrument currentCrossInstrument = (CrossInstruments ?? new CrossInstrument[0]) .FirstOrDefault(o => o.AssetPairId == crossInstrument.AssetPairId); if (currentCrossInstrument == null) { throw new InvalidOperationException("The cross instrument does not exists"); } currentCrossInstrument.IsInverse = crossInstrument.IsInverse; currentCrossInstrument.QuoteSource = crossInstrument.QuoteSource; currentCrossInstrument.ExternalAssetPairId = crossInstrument.ExternalAssetPairId; }
public Instrument() { Levels = new InstrumentLevel[0]; CrossInstruments = new CrossInstrument[0]; }