private void Write(Instrument instrument) { if (instrument is ForexInstrument forexCcy) { var forexHash = new[] { new HashEntry(nameof(ForexInstrument.Symbol), forexCcy.Symbol.Value), new HashEntry(nameof(ForexInstrument.BaseCurrency), forexCcy.BaseCurrency.ToString()), new HashEntry(nameof(ForexInstrument.QuoteCurrency), forexCcy.QuoteCurrency.ToString()), new HashEntry(nameof(ForexInstrument.SecurityType), forexCcy.SecurityType.ToString()), new HashEntry(nameof(ForexInstrument.PricePrecision), forexCcy.PricePrecision), new HashEntry(nameof(ForexInstrument.SizePrecision), instrument.SizePrecision), new HashEntry(nameof(ForexInstrument.MinStopDistanceEntry), forexCcy.MinStopDistanceEntry), new HashEntry(nameof(ForexInstrument.MinLimitDistanceEntry), forexCcy.MinLimitDistanceEntry), new HashEntry(nameof(ForexInstrument.MinStopDistance), forexCcy.MinStopDistance), new HashEntry(nameof(ForexInstrument.MinLimitDistance), forexCcy.MinLimitDistance), new HashEntry(nameof(ForexInstrument.TickSize), forexCcy.TickSize.ToString()), new HashEntry(nameof(ForexInstrument.RoundLotSize), forexCcy.RoundLotSize.ToString()), new HashEntry(nameof(ForexInstrument.MinTradeSize), forexCcy.MinTradeSize.ToString()), new HashEntry(nameof(ForexInstrument.MaxTradeSize), forexCcy.MaxTradeSize.ToString()), new HashEntry(nameof(ForexInstrument.RolloverInterestBuy), forexCcy.RolloverInterestBuy.ToString(CultureInfo.InvariantCulture)), new HashEntry(nameof(ForexInstrument.RolloverInterestSell), forexCcy.RolloverInterestSell.ToString(CultureInfo.InvariantCulture)), new HashEntry(nameof(ForexInstrument.Timestamp), forexCcy.Timestamp.ToIso8601String()), }; this.redisDatabase.HashSet(KeyProvider.GetInstrumentsKey(instrument.Symbol), forexHash); } var instrumentHash = new[] { new HashEntry(nameof(Instrument.Symbol), instrument.Symbol.Value), new HashEntry(nameof(Instrument.QuoteCurrency), instrument.QuoteCurrency.ToString()), new HashEntry(nameof(Instrument.SecurityType), instrument.SecurityType.ToString()), new HashEntry(nameof(Instrument.PricePrecision), instrument.PricePrecision), new HashEntry(nameof(Instrument.SizePrecision), instrument.SizePrecision), new HashEntry(nameof(Instrument.MinStopDistanceEntry), instrument.MinStopDistanceEntry), new HashEntry(nameof(Instrument.MinLimitDistanceEntry), instrument.MinLimitDistanceEntry), new HashEntry(nameof(Instrument.MinStopDistance), instrument.MinStopDistance), new HashEntry(nameof(Instrument.MinLimitDistance), instrument.MinLimitDistance), new HashEntry(nameof(Instrument.TickSize), instrument.TickSize.ToString()), new HashEntry(nameof(Instrument.RoundLotSize), instrument.RoundLotSize.ToString()), new HashEntry(nameof(Instrument.MinTradeSize), instrument.MinTradeSize.ToString()), new HashEntry(nameof(Instrument.MaxTradeSize), instrument.MaxTradeSize.ToString()), new HashEntry(nameof(Instrument.RolloverInterestBuy), instrument.RolloverInterestBuy.ToString(CultureInfo.InvariantCulture)), new HashEntry(nameof(Instrument.RolloverInterestSell), instrument.RolloverInterestSell.ToString(CultureInfo.InvariantCulture)), new HashEntry(nameof(Instrument.Timestamp), instrument.Timestamp.ToIso8601String()), }; this.redisDatabase.HashSet(KeyProvider.GetInstrumentsKey(instrument.Symbol), instrumentHash); }
/// <inheritdoc /> public void Delete(Symbol symbol) { this.redisDatabase.KeyDelete(KeyProvider.GetInstrumentsKey(symbol)); this.Logger.LogInformation(LogId.Database, $"Instrument {symbol.Value} deleted."); }