コード例 #1
0
        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();
        }
コード例 #2
0
        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;
        }
コード例 #3
0
 public Instrument()
 {
     Levels           = new InstrumentLevel[0];
     CrossInstruments = new CrossInstrument[0];
 }